.. 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 Overview ~~~~~~~~ .. ref-code-block:: cpp :class: doxyrest-overview-code-block #include class IniFile { public: // enums enum :ref:`errors`; // structs struct :ref:`key`; // construction :ref:`IniFile`(const std::string& iniPath = "", bool autoLoad = true); :ref:`IniFile`(const :ref:`Uint8`* RAWData, const :ref:`Uint32`& size, bool autoLoad = true); :ref:`IniFile`(:ref:`Pack`* Pack, const std::string& iniPackPath, bool autoLoad = true); :ref:`IniFile`(:ref:`IOStream`& stream, bool autoLoad = true); virtual :target:`~IniFile`(); // methods bool :ref:`loadFromFile`(const std::string& iniPath); bool :ref:`loadFromMemory`(const :ref:`Uint8`* RAWData, const :ref:`Uint32`& size); bool :ref:`loadFromPack`(:ref:`Pack`* Pack, const std::string& iniPackPath); bool :ref:`loadFromStream`(:ref:`IOStream`& stream); void :ref:`path`(const std::string& newPath); std::string :ref:`path`() const; bool :ref:`readFile`(); bool :ref:`writeFile`(); void :ref:`clear`(); long :ref:`findKey`(const std::string& keyname) const; long :target:`findKey`(const std::string_view& keyname) const; long :ref:`findValue`(unsigned const keyID, const std::string& valuename) const; long :target:`findValue`(unsigned const keyID, const std::string_view& valuename) const; unsigned :ref:`getNumKeys`() const; unsigned :ref:`addKeyName`(const std::string& keyname); unsigned :target:`addKeyName`(const std::string_view& keyname); std::string :ref:`getKeyName`(unsigned const keyID) const; unsigned :ref:`getNumValues`(unsigned const keyID); unsigned :ref:`getNumValues`(const std::string& keyname); std::string :ref:`getValueName`(unsigned const keyID, unsigned const valueID) const; std::string :ref:`getValueName`(const std::string& keyname, unsigned const valueID) const; std::string :ref:`getValue`(unsigned const keyID, unsigned const valueID, const std::string& defValue = "") const; std::string :ref:`getValue`(const std::string& keyname, const std::string& valuename, const std::string& defValue = "") const; int :ref:`getValueI`(const std::string& keyname, const std::string& valuename, int const defValue = 0) const; unsigned long :ref:`getValueU`(const std::string& keyname, const std::string& valuename, unsigned long const defValue = 0) const; bool :ref:`getValueB`(const std::string& keyname, const std::string& valuename, bool const defValue = false) const; double :ref:`getValueF`(const std::string& keyname, const std::string& valuename, double const defValue = 0.0) const; bool :ref:`setValue`(unsigned const keyID, unsigned const valueID, const std::string& value); bool :ref:`setValue`(const std::string& keyname, const std::string& valuename, const std::string& value, bool create = true); bool :target:`setValue`(const std::string_view& keyname, const std::string_view& valuename, const std::string_view& value, bool create = true); bool :ref:`setValueI`(const std::string& keyname, const std::string& valuename, int const value, bool create = true); bool :ref:`setValueU`(const std::string& keyname, const std::string& valuename, unsigned long const value, bool create = true); bool :ref:`setValueB`(const std::string& keyname, const std::string& valuename, bool const value, bool create = true); bool :ref:`setValueF`(const std::string& keyname, const std::string& valuename, double const value, bool create = true); bool :ref:`setValueV`(const std::string& keyname, const std::string& valuename, char* format, ...); bool :ref:`deleteValue`(const std::string& keyname, const std::string& valuename); bool :ref:`deleteKey`(const std::string& keyname); unsigned :ref:`numHeaderComments`(); void :ref:`addHeaderComment`(const std::string& 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`(const std::string& keyname) const; std::unordered_map :target:`getKeyUnorderedMap`(const unsigned& keyID) const; std::unordered_map :target:`getKeyUnorderedMap`(const std::string& keyname) const; unsigned :ref:`getNumKeyComments`(unsigned const keyID) const; unsigned :target:`getNumKeyComments`(const std::string& keyname) const; bool :ref:`addKeyComment`(unsigned const keyID, const std::string& comment); bool :target:`addKeyComment`(unsigned const keyID, const std::string_view& comment); bool :target:`addKeyComment`(const std::string& keyname, const std::string& comment); bool :target:`addKeyComment`(const std::string_view& keyname, const std::string_view& comment); std::string :ref:`getKeyComment`(unsigned const keyID, unsigned const commentID) const; std::string :target:`getKeyComment`(const std::string& keyname, unsigned const commentID) const; bool :ref:`deleteKeyComment`(unsigned const keyID, unsigned const commentID); bool :target:`deleteKeyComment`(const std::string& keyname, unsigned const commentID); bool :ref:`deleteKeyComments`(unsigned const keyID); bool :target:`deleteKeyComments`(const std::string& keyname); bool :target:`iniParsed`(); bool :target:`keyExists`(const std::string& keyname) const; bool :target:`keyValueExists`(const std::string& keyname, const std::string& 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_1ae20f967bfaa2aa1bbf7761413b5c8f05: .. ref-code-block:: cpp :class: doxyrest-title-code-block IniFile(const std::string& 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_1ab14cc017e8b0b93da68f073a16b3f7ca: .. ref-code-block:: cpp :class: doxyrest-title-code-block IniFile(:ref:`Pack`* Pack, const std::string& 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_1a05369609f6169be19f4b3f3ac80d8c31: .. ref-code-block:: cpp :class: doxyrest-title-code-block bool loadFromFile(const std::string& 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_1aed125cbb490f70455ad7d26af1bab710: .. ref-code-block:: cpp :class: doxyrest-title-code-block bool loadFromPack(:ref:`Pack`* Pack, const std::string& 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_1a9f4a7497bdd2d1753d5c95f8a03f48b0: .. ref-code-block:: cpp :class: doxyrest-title-code-block void path(const std::string& 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_1acbd856a1a57eee7a9d199dfe7fe356b3: .. ref-code-block:: cpp :class: doxyrest-title-code-block 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; 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_1aa666c25d58325017cfcc77b08e0c9faa: .. ref-code-block:: cpp :class: doxyrest-title-code-block long findKey(const std::string& 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_1a22caf326632d1bd9b7f8c67b3696b8f3: .. ref-code-block:: cpp :class: doxyrest-title-code-block long findValue(unsigned const keyID, const std::string& 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_1a1ad39cbde687cec3bb91103fea530aad: .. ref-code-block:: cpp :class: doxyrest-title-code-block unsigned addKeyName(const std::string& 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_1a9e768c48ec347a93b29f70947d3a3a32: .. ref-code-block:: cpp :class: doxyrest-title-code-block unsigned getNumValues(const std::string& 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_1a549146bc882b864595939603b85efe48: .. ref-code-block:: cpp :class: doxyrest-title-code-block std::string getValueName(const std::string& 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_1aa7ea8da30fb99675a9c382e6c3decbfe: .. ref-code-block:: cpp :class: doxyrest-title-code-block std::string getValue(unsigned const keyID, unsigned const valueID, const std::string& defValue = "") const Gets value of [keyname] valuename =. 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_1abc6462191c8c8aaf583f15870776b7c1: .. ref-code-block:: cpp :class: doxyrest-title-code-block std::string getValue(const std::string& keyname, const std::string& valuename, const std::string& 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_1a9371b8df915a7c4006f101be10e131ca: .. ref-code-block:: cpp :class: doxyrest-title-code-block int getValueI(const std::string& keyname, const std::string& 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_1a3ae0f06dc27d317a98df06ff93fe30aa: .. ref-code-block:: cpp :class: doxyrest-title-code-block unsigned long getValueU(const std::string& keyname, const std::string& 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_1af45fb0895468dab410ab5b034849a96a: .. ref-code-block:: cpp :class: doxyrest-title-code-block bool getValueB(const std::string& keyname, const std::string& 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_1ab57175d64b6646a86ec83e5a2f07415b: .. ref-code-block:: cpp :class: doxyrest-title-code-block double getValueF(const std::string& keyname, const std::string& 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_1a77ed2eb80d757bb2ce2bc9aa4191a478: .. ref-code-block:: cpp :class: doxyrest-title-code-block bool setValue(unsigned const keyID, unsigned const valueID, const std::string& value) Sets value of [keyname] valuename =. Specify the optional paramter 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. Overloaded to accept std::string, int, and double. .. index:: pair: function; setValue .. _doxid-class_e_e_1_1_system_1_1_ini_file_1a1ddaed2febebe83b0c5b09240f81b323: .. ref-code-block:: cpp :class: doxyrest-title-code-block bool setValue(const std::string& keyname, const std::string& valuename, const std::string& 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_1a570f5578a4a42699b7533b801860f9bb: .. ref-code-block:: cpp :class: doxyrest-title-code-block bool setValueI(const std::string& keyname, const std::string& 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_1a14a5ec8b86151cecc19d56c5bef443a7: .. ref-code-block:: cpp :class: doxyrest-title-code-block bool setValueU(const std::string& keyname, const std::string& 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_1a6e3a6a8a96748aef3f57e598c8763a33: .. ref-code-block:: cpp :class: doxyrest-title-code-block bool setValueB(const std::string& keyname, const std::string& 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_1a09a5bcbd5a9c31e06617b11cdf53a3f9: .. ref-code-block:: cpp :class: doxyrest-title-code-block bool setValueF(const std::string& keyname, const std::string& 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_1af874dd8881f12da6c084a5a18881a7de: .. ref-code-block:: cpp :class: doxyrest-title-code-block bool setValueV(const std::string& keyname, const std::string& valuename, char* format, ...) Sets a formated value from a keyname and a valuename .. index:: pair: function; deleteValue .. _doxid-class_e_e_1_1_system_1_1_ini_file_1a8c936ed72b52ccd96067a20038af92c4: .. ref-code-block:: cpp :class: doxyrest-title-code-block bool deleteValue(const std::string& keyname, const std::string& 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_1adca1d2e114392b9d98dff128fd51077d: .. ref-code-block:: cpp :class: doxyrest-title-code-block bool deleteKey(const std::string& 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_1a17b6ac4497109d182c3450d51dc514ae: .. ref-code-block:: cpp :class: doxyrest-title-code-block void addHeaderComment(const std::string& 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_1a31d9b9bf56edc072ba709021a2b21140: .. ref-code-block:: cpp :class: doxyrest-title-code-block bool addKeyComment(unsigned const keyID, const std::string& 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.