ADTF
|
INI file handling. More...
Public Member Functions | |
cIniFile () | |
Default constructor. | |
virtual | ~cIniFile () |
Destructor. | |
tResult | Load (const cFilename &strFilename="", const tBool &bParse=tTrue) |
Loads an INI file. More... | |
tResult | Save (const cFilename &strFilename="") |
Saves an INI file. More... | |
tResult | RemoveSection (const cString &strSection) |
Removes an entire section. More... | |
tResult | RemoveKey (const cString &strSection, const cString &strName) |
Removes a key from a section. More... | |
tBool | Set (const cString &strSection, const cString &strName, const cString &strValue="") |
Sets a string value. More... | |
tBool | SetBool (const cString &strSection, const cString &strName, const tBool &bValue) |
Sets a bool value. More... | |
tBool | SetInt (const cString &strSection, const cString &strName, const int &iValue) |
Sets an integer value. More... | |
tBool | SetFloat64 (const cString &strSection, const cString &strName, const tFloat64 &f64Value) |
Sets a float value. More... | |
cString | Get (const cString &strSection, const cString &strName, const cString &strDefault="") const |
Returns a string value. More... | |
tBool | GetBool (const cString &strSection, const cString &strName, const tBool &bDefault=false) const |
Returns a bool value. More... | |
tBool | Exists (const cString &strSection, const cString &strName) const |
Checks if an entry exists in the ini file. More... | |
int | GetInt (const cString &strSection, const cString &strName, const int &iDefault=0) const |
Returns an integer value. More... | |
tFloat64 | GetFloat64 (const cString &strSection, const cString &strName, const tFloat64 &f64Default=0) const |
Returns a float value. More... | |
tVoid | SetSectionName (const cString &strSection) |
Sets the current section for the Section* methods. More... | |
cString | GetSectionName () const |
Returns the current section name. More... | |
cString | SectionGet (const cString &strName, const cString &strDefault="") const |
Returns a string value. More... | |
tBool | SectionGetBool (const cString &strName, const tBool &bDefault=false) const |
Returns a bool value. More... | |
int | SectionGetInt (const cString &strName, const int &iDefault=0) const |
Returns an integer value. More... | |
tFloat64 | SectionGetFloat64 (const cString &strName, const tFloat64 &f64Default=0) const |
Returns a float value. More... | |
Protected Member Functions | |
cFilename | LookupFile () const |
Returns the default filename. More... | |
Protected Attributes | |
cString | m_strSection |
Internally used name of section. | |
cDOM | m_oDoc |
Internally used DOM object. | |
Checks if an entry exists in the ini file.
strSection | [in] The section of the ini file. |
strName | [in] The name of the value. |
cString Get | ( | const cString & | strSection, |
const cString & | strName, | ||
const cString & | strDefault = "" |
||
) | const |
Returns a string value.
strSection | [in] The section of the ini file. |
strName | [in] The name of the value. |
strDefault | [in] The default which is returned if the value does not exist. |
tBool GetBool | ( | const cString & | strSection, |
const cString & | strName, | ||
const tBool & | bDefault = false |
||
) | const |
Returns a bool value.
strSection | [in] The section of the ini file. |
strName | [in] The name of the value. |
bDefault | [in] The default which is returned if the value does not exist. |
tFloat64 GetFloat64 | ( | const cString & | strSection, |
const cString & | strName, | ||
const tFloat64 & | f64Default = 0 |
||
) | const |
Returns a float value.
strSection | [in] The section of the ini file. |
strName | [in] The name of the value. |
f64Default | [in] The default which is returned if the value does not exist. |
Returns an integer value.
strSection | [in] The section of the ini file. |
strName | [in] The name of the value. |
iDefault | [in] The default which is returned if the value does not exist. |
cString GetSectionName | ( | ) | const |
Returns the current section name.
Loads an INI file.
strFilename | [in] The filename, if empty than the class will lock for one based on the application name. |
bParse | [in] If true (default) the value of an item will be parsed. I.e. will generate a linebreak. If false the value is taken as it is. |
|
protected |
Returns the default filename.
Removes a key from a section.
strSection | [in] the section that contains the key |
strName | [in] the key to remove |
Removes an entire section.
strSection | [in] the name of the section to remove |
Saves an INI file.
strFilename | [in] The filename, if empty than the class will lock for one based on the application name. |
Returns a string value.
strName | [in] The name of the value. |
strDefault | [in] The default which is returned if the value does not exist. |
Returns a bool value.
strName | [in] The name of the value. |
bDefault | [in] The default which is returned if the value does not exist. |
Returns a float value.
strName | [in] The name of the value. |
f64Default | [in] The default which is returned if the value does not exist. |
int SectionGetInt | ( | const cString & | strName, |
const int & | iDefault = 0 |
||
) | const |
Returns an integer value.
strName | [in] The name of the value. |
iDefault | [in] The default which is returned if the value does not exist. |
Sets a string value.
strSection | [in] The section of the ini file. |
strName | [in] The name of the value. |
strValue | [in] The value. |
Sets a bool value.
strSection | [in] The section of the ini file. |
strName | [in] The name of the value. |
bValue | [in] The value. |
Sets a float value.
strSection | [in] The section of the ini file. |
strName | [in] The name of the value. |
f64Value | [in] The value. |
Sets an integer value.
strSection | [in] The section of the ini file. |
strName | [in] The name of the value. |
iValue | [in] The value. |