.. index:: pair: class; EE::System::IniFile .. _doxid-class_e_e_1_1_system_1_1_ini_file: class EE::System::IniFile ========================= .. toctree:: :hidden: enum_EE_System_IniFile_errors.rst struct_EE_System_IniFile_key.rst struct_EE_System_IniFile_value.rst Overview ~~~~~~~~ .. ref-code-block:: cpp :class: doxyrest-overview-code-block #include class IniFile { public: // enums enum :ref:`errors`; // structs struct :ref:`key`; struct :ref:`value`; // construction :ref:`IniFile`(std::string_view iniPath = {}, bool autoLoad = true); :ref:`IniFile`(const :ref:`Uint8`* RAWData, const :ref:`Uint32`& size, bool autoLoad = true); :ref:`IniFile`(:ref:`Pack`* Pack, std::string_view iniPackPath, bool autoLoad = true); :ref:`IniFile`(:ref:`IOStream`& stream, bool autoLoad = true); virtual :target:`~IniFile`(); // methods bool :ref:`loadFromFile`(std::string_view iniPath); bool :ref:`loadFromMemory`(const :ref:`Uint8`* RAWData, const :ref:`Uint32`& size); bool :ref:`loadFromPack`(:ref:`Pack`* Pack, std::string_view iniPackPath); bool :ref:`loadFromStream`(:ref:`IOStream`& stream); void :ref:`path`(std::string_view newPath); const std::string& :ref:`path`() const; bool :ref:`readFile`(); bool :ref:`writeFile`(); bool :ref:`writeStream`(:ref:`IOStream`& stream); void :ref:`clear`(); long :ref:`findKey`(std::string_view keyname) const; long :ref:`findValue`(unsigned const keyID, std::string_view valuename) const; unsigned :ref:`getNumKeys`() const; unsigned :ref:`addKeyName`(std::string_view keyname); std::string :ref:`getKeyName`(unsigned const keyID) const; unsigned :ref:`getNumValues`(unsigned const keyID); unsigned :ref:`getNumValues`(std::string_view keyname); std::string :ref:`getValueName`(unsigned const keyID, unsigned const valueID) const; std::string :ref:`getValueName`(std::string_view keyname, unsigned const valueID) const; std::string :ref:`getValue`(unsigned const keyID, unsigned const valueID, std::string_view defValue = {}) const; std::string :ref:`getValue`(std::string_view keyname, std::string_view valuename, std::string_view defValue = {}) const; int :ref:`getValueI`(std::string_view keyname, std::string_view valuename, int const defValue = 0) const; unsigned long :ref:`getValueU`(std::string_view keyname, std::string_view valuename, unsigned long const defValue = 0) const; bool :ref:`getValueB`(std::string_view keyname, std::string_view valuename, bool const defValue = false) const; double :ref:`getValueF`(std::string_view keyname, std::string_view valuename, double const defValue = 0.0) const; bool :ref:`setValue`(unsigned const keyID, unsigned const valueID, std::string_view value); bool :ref:`setValue`(std::string_view keyname, std::string_view valuename, std::string_view value, bool create = true); bool :ref:`setValueI`(std::string_view keyname, std::string_view valuename, int const value, bool create = true); bool :ref:`setValueU`(std::string_view keyname, std::string_view valuename, unsigned long const value, bool create = true); bool :ref:`setValueB`(std::string_view keyname, std::string_view valuename, bool const value, bool create = true); bool :ref:`setValueF`(std::string_view keyname, std::string_view valuename, double const value, bool create = true); bool :ref:`setValueV`(std::string_view keyname, std::string_view valuename, char* format, ...); bool :ref:`deleteValue`(std::string_view keyname, std::string_view valuename); bool :ref:`deleteKey`(std::string_view keyname); unsigned :ref:`numHeaderComments`(); void :ref:`addHeaderComment`(std::string_view comment); std::string :ref:`getHeaderComment`(unsigned const commentID) const; bool :ref:`deleteHeaderComment`(unsigned commentID); void :ref:`deleteHeaderComments`(); std::map :target:`getKeyMap`(const unsigned& keyID) const; std::map :target:`getKeyMap`(std::string_view keyname) const; std::unordered_map :target:`getKeyUnorderedMap`(const unsigned& keyID) const; std::unordered_map :target:`getKeyUnorderedMap`(std::string_view keyname) const; unsigned :ref:`getNumKeyComments`(unsigned const keyID) const; unsigned :target:`getNumKeyComments`(std::string_view keyname) const; bool :ref:`addKeyComment`(unsigned const keyID, std::string_view comment); bool :target:`addKeyComment`(std::string_view keyname, std::string_view comment); std::string :ref:`getKeyComment`(unsigned const keyID, unsigned const commentID) const; std::string :target:`getKeyComment`(std::string_view keyname, unsigned const commentID) const; bool :ref:`deleteKeyComment`(unsigned const keyID, unsigned const commentID); bool :target:`deleteKeyComment`(std::string_view keyname, unsigned const commentID); bool :ref:`deleteKeyComments`(unsigned const keyID); bool :target:`deleteKeyComments`(std::string_view keyname); bool :target:`iniParsed`(); bool :target:`keyExists`(std::string_view keyname) const; bool :target:`keyValueExists`(std::string_view keyname, std::string_view valuename) const; }; .. _details-class_e_e_1_1_system_1_1_ini_file: Detailed Documentation ~~~~~~~~~~~~~~~~~~~~~~ Construction ------------ .. index:: pair: function; IniFile .. _doxid-class_e_e_1_1_system_1_1_ini_file_1a5ea56622ea02d367d4b8a9bc00f19601: .. ref-code-block:: cpp :class: doxyrest-title-code-block IniFile(std::string_view iniPath = {}, bool autoLoad = true) Initialize and load the ini file from path .. index:: pair: function; IniFile .. _doxid-class_e_e_1_1_system_1_1_ini_file_1af06b7fb04b43005e54446ddc757e6590: .. ref-code-block:: cpp :class: doxyrest-title-code-block IniFile(const :ref:`Uint8`* RAWData, const :ref:`Uint32`& size, bool autoLoad = true) Initialize and load the ini file from memory .. index:: pair: function; IniFile .. _doxid-class_e_e_1_1_system_1_1_ini_file_1a71aabdc6d7bef1934d92cbcb2dbccd62: .. ref-code-block:: cpp :class: doxyrest-title-code-block IniFile(:ref:`Pack`* Pack, std::string_view iniPackPath, bool autoLoad = true) Initialize and load the ini file from a pack file .. index:: pair: function; IniFile .. _doxid-class_e_e_1_1_system_1_1_ini_file_1ab1f73ad0e92573226652727b8c13d062: .. ref-code-block:: cpp :class: doxyrest-title-code-block IniFile(:ref:`IOStream`& stream, bool autoLoad = true) Initialize and load the ini file from a stream Methods ------- .. index:: pair: function; loadFromFile .. _doxid-class_e_e_1_1_system_1_1_ini_file_1ab1f91e33b1bfd4310f0d0fbf2d002066: .. ref-code-block:: cpp :class: doxyrest-title-code-block bool loadFromFile(std::string_view iniPath) Loads an ini file from path .. index:: pair: function; loadFromMemory .. _doxid-class_e_e_1_1_system_1_1_ini_file_1aca151f664bdce91556bd3a04d86775be: .. ref-code-block:: cpp :class: doxyrest-title-code-block bool loadFromMemory(const :ref:`Uint8`* RAWData, const :ref:`Uint32`& size) Loads an ini file from memory .. index:: pair: function; loadFromPack .. _doxid-class_e_e_1_1_system_1_1_ini_file_1a0854865c6c43ea0dccd3f8a916d8b13f: .. ref-code-block:: cpp :class: doxyrest-title-code-block bool loadFromPack(:ref:`Pack`* Pack, std::string_view iniPackPath) Loads an ini file from a pack file .. index:: pair: function; loadFromStream .. _doxid-class_e_e_1_1_system_1_1_ini_file_1a72164a9991a92b010656ebf8bcc88d86: .. ref-code-block:: cpp :class: doxyrest-title-code-block bool loadFromStream(:ref:`IOStream`& stream) Loads an ini file from a stream .. index:: pair: function; path .. _doxid-class_e_e_1_1_system_1_1_ini_file_1ae54806660b51aef5210e363214e9d52f: .. ref-code-block:: cpp :class: doxyrest-title-code-block void path(std::string_view newPath) Sets mPath of ini file to read and write from. .. index:: pair: function; path .. _doxid-class_e_e_1_1_system_1_1_ini_file_1a823c6fc047cbd38c10d41dcb95d8f165: .. ref-code-block:: cpp :class: doxyrest-title-code-block const std::string& path() const .. rubric:: Returns: The ini file path .. index:: pair: function; readFile .. _doxid-class_e_e_1_1_system_1_1_ini_file_1a6a8d372562567b7a2cecdf38e9c9260a: .. ref-code-block:: cpp :class: doxyrest-title-code-block bool readFile() Reads ini file specified using mPath. .. rubric:: Returns: true if successful, false otherwise. .. index:: pair: function; writeFile .. _doxid-class_e_e_1_1_system_1_1_ini_file_1a41877d4f3299d4986323abb15c25273f: .. ref-code-block:: cpp :class: doxyrest-title-code-block bool writeFile() Writes data stored in class to ini file. .. index:: pair: function; writeStream .. _doxid-class_e_e_1_1_system_1_1_ini_file_1a21b1d986eef7f78f5eb0b357c326a65e: .. ref-code-block:: cpp :class: doxyrest-title-code-block bool writeStream(:ref:`IOStream`& stream) Writes data stored in class to a :ref:`IOStream `. .. index:: pair: function; clear .. _doxid-class_e_e_1_1_system_1_1_ini_file_1ae09a47ccdeec8325370ee471c7a6bd3e: .. ref-code-block:: cpp :class: doxyrest-title-code-block void clear() Deletes all stored ini data. .. index:: pair: function; findKey .. _doxid-class_e_e_1_1_system_1_1_ini_file_1a4b7b3b0a7db4029d9392d343371c7439: .. ref-code-block:: cpp :class: doxyrest-title-code-block long findKey(std::string_view keyname) const .. rubric:: Returns: index of specified key, or noID if not found. .. index:: pair: function; findValue .. _doxid-class_e_e_1_1_system_1_1_ini_file_1a3ed528ee64cfbbc4ce046d21956c6aba: .. ref-code-block:: cpp :class: doxyrest-title-code-block long findValue(unsigned const keyID, std::string_view valuename) const .. rubric:: Returns: index of specified value, in the specified key, or noID if not found. .. index:: pair: function; getNumKeys .. _doxid-class_e_e_1_1_system_1_1_ini_file_1a6dcde4d66cdac0f2b5a2fc7b15759496: .. ref-code-block:: cpp :class: doxyrest-title-code-block unsigned getNumKeys() const .. rubric:: Returns: number of Keys currently in the ini. .. index:: pair: function; addKeyName .. _doxid-class_e_e_1_1_system_1_1_ini_file_1adaf8b499c17dafe63dfe5dca3833af0c: .. ref-code-block:: cpp :class: doxyrest-title-code-block unsigned addKeyName(std::string_view keyname) Add a key name. .. index:: pair: function; getKeyName .. _doxid-class_e_e_1_1_system_1_1_ini_file_1a732036f38bbc4e01d671d0a044209862: .. ref-code-block:: cpp :class: doxyrest-title-code-block std::string getKeyName(unsigned const keyID) const .. rubric:: Returns: key Names by index. .. index:: pair: function; getNumValues .. _doxid-class_e_e_1_1_system_1_1_ini_file_1a911239851cd564b1aca69a72f2c7a6ca: .. ref-code-block:: cpp :class: doxyrest-title-code-block unsigned getNumValues(unsigned const keyID) .. rubric:: Returns: number of values stored for specified key. .. index:: pair: function; getNumValues .. _doxid-class_e_e_1_1_system_1_1_ini_file_1a848e827e7e237325cb8e222b6004588d: .. ref-code-block:: cpp :class: doxyrest-title-code-block unsigned getNumValues(std::string_view keyname) .. rubric:: Returns: number of values stored for specified key from its name. .. index:: pair: function; getValueName .. _doxid-class_e_e_1_1_system_1_1_ini_file_1aec7ae8f638e48c2c17405ce4c47ddbee: .. ref-code-block:: cpp :class: doxyrest-title-code-block std::string getValueName(unsigned const keyID, unsigned const valueID) const .. rubric:: Returns: value name by index for a given keyname or keyID. .. index:: pair: function; getValueName .. _doxid-class_e_e_1_1_system_1_1_ini_file_1a42e225c6ea7ca1f6595dfc53aba8a5c0: .. ref-code-block:: cpp :class: doxyrest-title-code-block std::string getValueName(std::string_view keyname, unsigned const valueID) const .. rubric:: Returns: A value name from keyname and valueId .. index:: pair: function; getValue .. _doxid-class_e_e_1_1_system_1_1_ini_file_1a8a78c2ec94ab6ff416c0e2697219a359: .. ref-code-block:: cpp :class: doxyrest-title-code-block std::string getValue(unsigned const keyID, unsigned const valueID, std::string_view defValue = {}) const Gets value of [keyname] valuename =. :ref:`Overloaded ` to return std::string, int, and double. .. rubric:: Returns: defValue if key/value not found otherwise the value obtained. .. index:: pair: function; getValue .. _doxid-class_e_e_1_1_system_1_1_ini_file_1a86f63ec90b8bb5580ac7094aa39503c8: .. ref-code-block:: cpp :class: doxyrest-title-code-block std::string getValue(std::string_view keyname, std::string_view valuename, std::string_view defValue = {}) const Gets a value from a keyname and valuename .. index:: pair: function; getValueI .. _doxid-class_e_e_1_1_system_1_1_ini_file_1afa03db46349dfd71f4e635b9348602be: .. ref-code-block:: cpp :class: doxyrest-title-code-block int getValueI(std::string_view keyname, std::string_view valuename, int const defValue = 0) const Gets the value as integer .. index:: pair: function; getValueU .. _doxid-class_e_e_1_1_system_1_1_ini_file_1aac9145797abbdcedfd7e08f574eae0ed: .. ref-code-block:: cpp :class: doxyrest-title-code-block unsigned long getValueU(std::string_view keyname, std::string_view valuename, unsigned long const defValue = 0) const Gets the value as an unsigned long .. index:: pair: function; getValueB .. _doxid-class_e_e_1_1_system_1_1_ini_file_1aae9319ab0a05a4d7808a50743a8640ba: .. ref-code-block:: cpp :class: doxyrest-title-code-block bool getValueB(std::string_view keyname, std::string_view valuename, bool const defValue = false) const Gets the value as boolean .. index:: pair: function; getValueF .. _doxid-class_e_e_1_1_system_1_1_ini_file_1a280e73057c712a69cd8761a8099bebe1: .. ref-code-block:: cpp :class: doxyrest-title-code-block double getValueF(std::string_view keyname, std::string_view valuename, double const defValue = 0.0) const Gets the value as double .. index:: pair: function; setValue .. _doxid-class_e_e_1_1_system_1_1_ini_file_1a4df12b4917914b227c9a127ea4c68d3a: .. ref-code-block:: cpp :class: doxyrest-title-code-block bool setValue(unsigned const keyID, unsigned const valueID, std::string_view value) Sets value of [keyname] valuename =. Specify the optional parameter as false (0) if you do not want it to create the key if it doesn't exist. .. rubric:: Returns: true if data entered, false otherwise. :ref:`Overloaded ` to accept std::string, int, and double. .. index:: pair: function; setValue .. _doxid-class_e_e_1_1_system_1_1_ini_file_1a92737ee85fee646724dd8346782f3658: .. ref-code-block:: cpp :class: doxyrest-title-code-block bool setValue(std::string_view keyname, std::string_view valuename, std::string_view value, bool create = true) Sets the value from a keyname and a valuename .. rubric:: Parameters: .. list-table:: :widths: 20 80 * - keyname - The key name * - valuename - The value name * - value - The value to assign * - create - If true it will create the keyname if doesn't exists .. index:: pair: function; setValueI .. _doxid-class_e_e_1_1_system_1_1_ini_file_1a6370158a4fc5328391c0f64b1a016440: .. ref-code-block:: cpp :class: doxyrest-title-code-block bool setValueI(std::string_view keyname, std::string_view valuename, int const value, bool create = true) Sets a integer value from a keyname and a valuename .. rubric:: Parameters: .. list-table:: :widths: 20 80 * - keyname - The key name * - valuename - The value name * - value - The value to assign * - create - If true it will create the keyname if doesn't exists .. index:: pair: function; setValueU .. _doxid-class_e_e_1_1_system_1_1_ini_file_1abe4909ca5d5c5f99c48bcb86ced19034: .. ref-code-block:: cpp :class: doxyrest-title-code-block bool setValueU(std::string_view keyname, std::string_view valuename, unsigned long const value, bool create = true) Sets a unsigned long value from a keyname and a valuename .. rubric:: Parameters: .. list-table:: :widths: 20 80 * - keyname - The key name * - valuename - The value name * - value - The value to assign * - create - If true it will create the keyname if doesn't exists .. index:: pair: function; setValueB .. _doxid-class_e_e_1_1_system_1_1_ini_file_1aabe1a9c9e3a0b27195f1f0990cadd8ed: .. ref-code-block:: cpp :class: doxyrest-title-code-block bool setValueB(std::string_view keyname, std::string_view valuename, bool const value, bool create = true) Sets a boolean value from a keyname and a valuename .. rubric:: Parameters: .. list-table:: :widths: 20 80 * - keyname - The key name * - valuename - The value name * - value - The value to assign * - create - If true it will create the keyname if doesn't exists .. index:: pair: function; setValueF .. _doxid-class_e_e_1_1_system_1_1_ini_file_1ac436a8c194de4111ecc04174d759b252: .. ref-code-block:: cpp :class: doxyrest-title-code-block bool setValueF(std::string_view keyname, std::string_view valuename, double const value, bool create = true) Sets a double value from a keyname and a valuename .. rubric:: Parameters: .. list-table:: :widths: 20 80 * - keyname - The key name * - valuename - The value name * - value - The value to assign * - create - If true it will create the keyname if doesn't exists .. index:: pair: function; setValueV .. _doxid-class_e_e_1_1_system_1_1_ini_file_1a0de0e8a42d95d067409971e9734eed4e: .. ref-code-block:: cpp :class: doxyrest-title-code-block bool setValueV(std::string_view keyname, std::string_view valuename, char* format, ...) Sets a formatted value from a keyname and a valuename .. index:: pair: function; deleteValue .. _doxid-class_e_e_1_1_system_1_1_ini_file_1a7b33445f34d3df866476b7fd83269e65: .. ref-code-block:: cpp :class: doxyrest-title-code-block bool deleteValue(std::string_view keyname, std::string_view valuename) Deletes specified value. .. rubric:: Returns: true if value existed and deleted, false otherwise. .. index:: pair: function; deleteKey .. _doxid-class_e_e_1_1_system_1_1_ini_file_1a7f1fd4680a76e841374f591201641b17: .. ref-code-block:: cpp :class: doxyrest-title-code-block bool deleteKey(std::string_view keyname) Deletes specified key and all values contained within. .. rubric:: Returns: true if key existed and deleted, false otherwise. .. index:: pair: function; numHeaderComments .. _doxid-class_e_e_1_1_system_1_1_ini_file_1aed4fd9e506a54046c6b6dd040afd9c9c: .. ref-code-block:: cpp :class: doxyrest-title-code-block unsigned numHeaderComments() Header comment functions. Header comments are those comments before the first key. Number of header comments. .. index:: pair: function; addHeaderComment .. _doxid-class_e_e_1_1_system_1_1_ini_file_1a059fd250ca9e9c5efd1539cc88cfa42a: .. ref-code-block:: cpp :class: doxyrest-title-code-block void addHeaderComment(std::string_view comment) Add a header comment. .. index:: pair: function; getHeaderComment .. _doxid-class_e_e_1_1_system_1_1_ini_file_1a9f61064d9d8ecb8d4de20b4b1cee3fd4: .. ref-code-block:: cpp :class: doxyrest-title-code-block std::string getHeaderComment(unsigned const commentID) const Return a header comment. .. index:: pair: function; deleteHeaderComment .. _doxid-class_e_e_1_1_system_1_1_ini_file_1ac7ad71c7c598c71452586ebe51f2138d: .. ref-code-block:: cpp :class: doxyrest-title-code-block bool deleteHeaderComment(unsigned commentID) Delete a header comment. .. index:: pair: function; deleteHeaderComments .. _doxid-class_e_e_1_1_system_1_1_ini_file_1aaf2596216a718e8397d736a89815b01c: .. ref-code-block:: cpp :class: doxyrest-title-code-block void deleteHeaderComments() Delete all header comments. .. index:: pair: function; getNumKeyComments .. _doxid-class_e_e_1_1_system_1_1_ini_file_1ad752e275015046ddd6003be3c5a727b1: .. ref-code-block:: cpp :class: doxyrest-title-code-block unsigned getNumKeyComments(unsigned const keyID) const Key comment functions. Key comments are those comments within a key. Any comments defined within value Names will be added to this list. Therefore, these comments will be moved to the top of the key definition when the :ref:`IniFile::writeFile() ` is called. Number of key comments. .. index:: pair: function; addKeyComment .. _doxid-class_e_e_1_1_system_1_1_ini_file_1a133ee688468000e797206b54abedfb93: .. ref-code-block:: cpp :class: doxyrest-title-code-block bool addKeyComment(unsigned const keyID, std::string_view comment) Add a key comment. .. index:: pair: function; getKeyComment .. _doxid-class_e_e_1_1_system_1_1_ini_file_1adde6645fe5865271e7868deeb8b81c2a: .. ref-code-block:: cpp :class: doxyrest-title-code-block std::string getKeyComment(unsigned const keyID, unsigned const commentID) const Return a key comment. .. index:: pair: function; deleteKeyComment .. _doxid-class_e_e_1_1_system_1_1_ini_file_1a6959c392030f2eda1efdc3afe55f4019: .. ref-code-block:: cpp :class: doxyrest-title-code-block bool deleteKeyComment(unsigned const keyID, unsigned const commentID) Delete a key comment. .. index:: pair: function; deleteKeyComments .. _doxid-class_e_e_1_1_system_1_1_ini_file_1a1f05e7d31342f05b6060ad8c5ca04798: .. ref-code-block:: cpp :class: doxyrest-title-code-block bool deleteKeyComments(unsigned const keyID) Delete all comments for a key.