Codechange: use std::string for script config

This commit is contained in:
Rubidium
2023-05-06 09:44:35 +02:00
committed by rubidium42
parent bbcb55ebc9
commit ab51175db2
12 changed files with 45 additions and 62 deletions

View File

@@ -32,14 +32,7 @@ public:
ScriptInfo() :
engine(nullptr),
SQ_instance(nullptr),
author(nullptr),
name(nullptr),
short_name(nullptr),
description(nullptr),
date(nullptr),
instance_name(nullptr),
version(0),
url(nullptr),
scanner(nullptr)
{}
~ScriptInfo();
@@ -47,22 +40,22 @@ public:
/**
* Get the Author of the script.
*/
const char *GetAuthor() const { return this->author; }
const std::string &GetAuthor() const { return this->author; }
/**
* Get the Name of the script.
*/
const char *GetName() const { return this->name; }
const std::string &GetName() const { return this->name; }
/**
* Get the 4 character long short name of the script.
*/
const char *GetShortName() const { return this->short_name; }
const std::string &GetShortName() const { return this->short_name; }
/**
* Get the description of the script.
*/
const char *GetDescription() const { return this->description; }
const std::string &GetDescription() const { return this->description; }
/**
* Get the version of the script.
@@ -72,27 +65,27 @@ public:
/**
* Get the last-modified date of the script.
*/
const char *GetDate() const { return this->date; }
const std::string &GetDate() const { return this->date; }
/**
* Get the name of the instance of the script to create.
*/
const char *GetInstanceName() const { return this->instance_name; }
const std::string &GetInstanceName() const { return this->instance_name; }
/**
* Get the website for this script.
*/
const char *GetURL() const { return this->url; }
const std::string &GetURL() const { return this->url; }
/**
* Get the filename of the main.nut script.
*/
const char *GetMainScript() const { return this->main_script.c_str(); }
const std::string &GetMainScript() const { return this->main_script; }
/**
* Get the filename of the tar the script is in.
*/
std::string GetTarFile() const { return this->tar_file; }
const std::string &GetTarFile() const { return this->tar_file; }
/**
* Check if a given method exists.
@@ -152,14 +145,14 @@ protected:
private:
std::string main_script; ///< The full path of the script.
std::string tar_file; ///< If, which tar file the script was in.
const char *author; ///< Author of the script.
const char *name; ///< Full name of the script.
const char *short_name; ///< Short name (4 chars) which uniquely identifies the script.
const char *description; ///< Small description of the script.
const char *date; ///< The date the script was written at.
const char *instance_name; ///< Name of the main class in the script.
std::string author; ///< Author of the script.
std::string name; ///< Full name of the script.
std::string short_name; ///< Short name (4 chars) which uniquely identifies the script.
std::string description; ///< Small description of the script.
std::string date; ///< The date the script was written at.
std::string instance_name; ///< Name of the main class in the script.
int version; ///< Version of the script.
const char *url; ///< URL of the script.
std::string url; ///< URL of the script.
class ScriptScanner *scanner; ///< ScriptScanner object that was used to scan this script info.
};