ADTF
inifile.h
Go to the documentation of this file.
1 
7 #ifndef _INIFILE_CLASS_HEADER_
8 #define _INIFILE_CLASS_HEADER_
9 
10 namespace A_UTILS_NS
11 {
12 
18 class DOEXPORT cIniFile
19 {
21 
22  protected:
24  mutable cDOM m_oDoc;
25 
26  public:
31 
35  virtual ~cIniFile();
36 
46  tResult Load(const cFilename& strFilename = "", const tBool& bParse = tTrue);
47 
53  tResult Save(const cFilename& strFilename = "");
54 
60  tResult RemoveSection(const cString& strSection);
61 
68  tResult RemoveKey(const cString& strSection, const cString& strName);
69 
77  tBool Set (const cString& strSection, const cString& strName, const cString& strValue="");
85  tBool SetBool (const cString& strSection, const cString& strName, const tBool &bValue);
93  tBool SetInt (const cString& strSection, const cString& strName, const int &iValue);
94 
102  tBool SetFloat64 (const cString& strSection, const cString& strName, const tFloat64 &f64Value);
103 
111  cString Get (const cString& strSection, const cString& strName, const cString& strDefault="") const;
112 
120  tBool GetBool (const cString& strSection, const cString& strName, const tBool &bDefault=false) const;
121 
128  tBool Exists (const cString& strSection, const cString& strName) const;
129 
137  int GetInt (const cString& strSection, const cString& strName, const int &iDefault=0) const;
145  tFloat64 GetFloat64 (const cString& strSection, const cString& strName, const tFloat64 &f64Default=0) const;
146 
152  tVoid SetSectionName(const cString& strSection);
158 
165  cString SectionGet (const cString& strName, const cString& strDefault="") const;
166 
173  tBool SectionGetBool (const cString& strName, const tBool &bDefault=false) const;
180  int SectionGetInt (const cString& strName, const int &iDefault=0) const;
187  tFloat64 SectionGetFloat64 (const cString& strName, const tFloat64 &f64Default=0) const;
188 
189  protected:
195 
196 };
197 
198 } // namespace A_UTILS_NS
199 
200 #endif // _INIFILE_CLASS_HEADER_
void tVoid
The tVoid is always the definition for the void (non-type).
double tFloat64
type definition for Float64 (64bit double values) (platform and compiler independent type).
bool tBool
The tBool defines the type for the Values tTrue and tFalse (platform and compiler dependent).
cDOM implements a XML parser which can be used to read in XML files and perform simple (!...
File name class.
Definition: filename.h:59
INI file handling.
Definition: inifile.h:19
cString m_strSection
Internally used name of section.
Definition: inifile.h:23
int GetInt(const cString &strSection, const cString &strName, const int &iDefault=0) const
Returns an integer value.
tBool SetFloat64(const cString &strSection, const cString &strName, const tFloat64 &f64Value)
Sets a float value.
tBool SetInt(const cString &strSection, const cString &strName, const int &iValue)
Sets an integer value.
tResult RemoveKey(const cString &strSection, const cString &strName)
Removes a key from a section.
cDOM m_oDoc
Internally used DOM object.
Definition: inifile.h:24
tFloat64 GetFloat64(const cString &strSection, const cString &strName, const tFloat64 &f64Default=0) const
Returns a float value.
cString GetSectionName() const
Returns the current section name.
virtual ~cIniFile()
Destructor.
tResult Load(const cFilename &strFilename="", const tBool &bParse=tTrue)
Loads an INI file.
tBool GetBool(const cString &strSection, const cString &strName, const tBool &bDefault=false) const
Returns a bool value.
int SectionGetInt(const cString &strName, const int &iDefault=0) const
Returns an integer value.
cIniFile()
Default constructor.
tResult Save(const cFilename &strFilename="")
Saves an INI file.
tBool SetBool(const cString &strSection, const cString &strName, const tBool &bValue)
Sets a bool value.
cString Get(const cString &strSection, const cString &strName, const cString &strDefault="") const
Returns a string value.
tBool SectionGetBool(const cString &strName, const tBool &bDefault=false) const
Returns a bool value.
tVoid SetSectionName(const cString &strSection)
Sets the current section for the Section* methods.
tResult RemoveSection(const cString &strSection)
Removes an entire section.
cFilename LookupFile() const
Returns the default filename.
tBool Set(const cString &strSection, const cString &strName, const cString &strValue="")
Sets a string value.
cString SectionGet(const cString &strName, const cString &strDefault="") const
Returns a string value.
tBool Exists(const cString &strSection, const cString &strName) const
Checks if an entry exists in the ini file.
tFloat64 SectionGetFloat64(const cString &strName, const tFloat64 &f64Default=0) const
Returns a float value.
#define tTrue
Value for tBool.
Definition: constants.h:62
#define A_UTILS_D(__pclassname_)
Helper macro for d-pattern definitions.
Definition: d_ptr.h:270
ADTF A_UTIL Namespace - Within adtf this is used as adtf::util or adtf_util.
Definition: d_ptr.h:11