ADTF  v2.14.3
cIniFile Class Reference

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.
 

Detailed Description

INI file handling.

Definition at line 26 of file inifile.h.

Member Function Documentation

tBool Exists ( const cString strSection,
const cString strName 
) const

Checks if an entry exists in the ini file.

Parameters
strSection[in] The section of the ini file.
strName[in] The name of the value.
Returns
tTrue if entry exists, otherwise tFalse
cString Get ( const cString strSection,
const cString strName,
const cString strDefault = "" 
) const

Returns a string value.

Parameters
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.
Returns
The value.
tBool GetBool ( const cString strSection,
const cString strName,
const tBool bDefault = false 
) const

Returns a bool value.

Parameters
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.
Returns
The value.
tFloat64 GetFloat64 ( const cString strSection,
const cString strName,
const tFloat64 f64Default = 0 
) const

Returns a float value.

Parameters
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
The value.
int GetInt ( const cString strSection,
const cString strName,
const int &  iDefault = 0 
) const

Returns an integer value.

Parameters
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.
Returns
The value.
cString GetSectionName ( ) const

Returns the current section name.

Returns
The current section name.
tResult Load ( const cFilename strFilename = "",
const tBool bParse = tTrue 
)

Loads an INI file.

Parameters
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.
Returns
Standard result.
cFilename LookupFile ( ) const
protected

Returns the default filename.

Returns
Default filename
tResult RemoveKey ( const cString strSection,
const cString strName 
)

Removes a key from a section.

Parameters
strSection[in] the section that contains the key
strName[in] the key to remove
Returns
Standard result.
tResult RemoveSection ( const cString strSection)

Removes an entire section.

Parameters
strSection[in] the name of the section to remove
Returns
Standard result.
tResult Save ( const cFilename strFilename = "")

Saves an INI file.

Parameters
strFilename[in] The filename, if empty than the class will lock for one based on the application name.
Returns
Standard result.
cString SectionGet ( const cString strName,
const cString strDefault = "" 
) const

Returns a string value.

Parameters
strName[in] The name of the value.
strDefault[in] The default which is returned if the value does not exist.
Returns
The value.
tBool SectionGetBool ( const cString strName,
const tBool bDefault = false 
) const

Returns a bool value.

Parameters
strName[in] The name of the value.
bDefault[in] The default which is returned if the value does not exist.
Returns
The value.
tFloat64 SectionGetFloat64 ( const cString strName,
const tFloat64 f64Default = 0 
) const

Returns a float value.

Parameters
strName[in] The name of the value.
f64Default[in] The default which is returned if the value does not exist.
Returns
The value.
int SectionGetInt ( const cString strName,
const int &  iDefault = 0 
) const

Returns an integer value.

Parameters
strName[in] The name of the value.
iDefault[in] The default which is returned if the value does not exist.
Returns
The value.
tBool Set ( const cString strSection,
const cString strName,
const cString strValue = "" 
)

Sets a string value.

Parameters
strSection[in] The section of the ini file.
strName[in] The name of the value.
strValue[in] The value.
Returns
tTrue if successful, otherwise tFalse.
tBool SetBool ( const cString strSection,
const cString strName,
const tBool bValue 
)

Sets a bool value.

Parameters
strSection[in] The section of the ini file.
strName[in] The name of the value.
bValue[in] The value.
Returns
tTrue if successful, otherwise tFalse.
tBool SetFloat64 ( const cString strSection,
const cString strName,
const tFloat64 f64Value 
)

Sets a float value.

Parameters
strSection[in] The section of the ini file.
strName[in] The name of the value.
f64Value[in] The value.
Returns
tTrue if successful, otherwise tFalse.
tBool SetInt ( const cString strSection,
const cString strName,
const int &  iValue 
)

Sets an integer value.

Parameters
strSection[in] The section of the ini file.
strName[in] The name of the value.
iValue[in] The value.
Returns
tTrue if successful, otherwise tFalse.
tVoid SetSectionName ( const cString strSection)

Sets the current section for the Section* methods.

Parameters
strSection[in] The section.
Returns
void

Copyright © Audi Electronics Venture GmbH. All rights reserved. (Generated on Fri Mar 22 2019 by doxygen 1.8.10)