#include <MboIniData.h>
Public Member Functions | |
CIniData (const MboString &strFilename, const MboString &strSectionPrefix="") | |
virtual | ~CIniData () |
virtual const MboString & | GetFilename () const |
virtual MboString | GetIniDirectory () const |
virtual const MboString & | GetSectionPrefix () const |
bool | GetSectionNames (const MboString &strSectionPrefix, CStrList &vstrSectionNames) const |
bool | GetSectionNames (CStrList &vstrSectionNames) const |
bool | SectionExists (const MboString &strSection) const |
virtual bool | GetKeyNames (const MboString &strSection, CStrList &vstrKeyNames) const |
virtual bool | KeyNameExists (const MboString &strSection, const MboString &strKeyname) const |
virtual bool | ReadString (const MboString &strSection, const MboString &strKeyname, MboString &strValue, const MboString &strDefault="", bool bWriteDefault=false, bool bParseEnvVars=false) const |
virtual MboString | GetString (const MboString &strSection, const MboString &strKeyname, const MboString &strDefault="", bool bWriteDefault=false, bool bParseEnvVars=false) const |
virtual bool | ReadInt (const MboString &strSection, const MboString &strKeyname, int &nValue, int nDefault=0, bool bWriteDefault=false, int nMinimum=INT_MIN, int nMaximum=INT_MAX) const |
virtual int | GetInt (const MboString &strSection, const MboString &strKeyname, int nDefault=0, bool bWriteDefault=false, int nMinimum=INT_MIN, int nMaximum=INT_MAX) const |
virtual bool | ReadLong (const MboString &strSection, const MboString &strKeyname, long &lValue, long lDefault=0, bool bWriteDefault=false, long lMinimum=LONG_MIN, long lMaximum=LONG_MAX) const |
virtual long | GetLong (const MboString &strSection, const MboString &strKeyname, long lDefault=0L, bool bWriteDefault=false, long lMinimum=LONG_MIN, long lMaximum=LONG_MAX) const |
virtual bool | ReadFloat (const MboString &strSection, const MboString &strKeyname, float &fValue, float fDefault=0.0f, bool bWriteDefault=false, float fMinimum=-FLT_MAX, float fMaximum=FLT_MAX) const |
virtual float | GetFloat (const MboString &strSection, const MboString &strKeyname, float fDefault=0.0f, bool bWriteDefault=false, float fMinimum=-FLT_MAX, float fMaximum=FLT_MAX) const |
virtual bool | ReadDouble (const MboString &strSection, const MboString &strKeyname, double &fValue, double fDefault=0.0, bool bWriteDefault=false, double fMinimum=-DBL_MAX, double fMaximum=DBL_MAX) const |
virtual double | GetDouble (const MboString &strSection, const MboString &strKeyname, double fDefault=0.0, bool bWriteDefault=false, double fMinimum=-DBL_MAX, double fMaximum=DBL_MAX) const |
virtual bool | ReadBool (const MboString &strSection, const MboString &strKeyname, bool &bValue, bool bDefault=false, bool bWriteDefault=false) const |
virtual bool | GetBool (const MboString &strSection, const MboString &strKeyname, bool bDefault=false, bool bWriteDefault=false) const |
virtual bool | ReadColor (const MboString &strSection, const MboString &strKeyname, COLORREF &colValue, COLORREF colDefault=RGB(0, 0, 0), bool bWriteDefault=false) const |
virtual COLORREF | GetColor (const MboString &strSection, const MboString &strKeyname, COLORREF colDefault=RGB(0, 0, 0), bool bWriteDefault=false) const |
virtual bool | ReadMap (const MboString &strSection, CStrMapStr &msstrValue, const CStrMapStr &msstrDefault=CStrMapStr(), bool bWriteDefault=false, bool bWriteEmpty=false, bool bRetrieveAll=false) const |
virtual CStrMapStr | GetMap (const MboString &strSection, const CStrMapStr &msstrDefault=CStrMapStr(), bool bWriteDefault=false, bool bWriteEmpty=false, bool bRetrieveAll=false) const |
virtual bool | ReadSectionList (const MboString &strSection, CIniSectionList &vsstrValue, const CIniSectionList &vsstrDefault=CIniSectionList(), bool bWriteDefault=false, bool bWriteEmpty=false, bool bRetrieveAll=false) const |
virtual bool | EmptySection (const MboString &strSection, bool bKeepComments=true) |
virtual bool | ClearSection (const MboString &strSection) |
virtual bool | DeleteKey (const MboString &strSection, const MboString &strKeyname) |
virtual bool | RenameKey (const MboString &strSection, const MboString &strKeynameOld, const MboString &strKeynameNew) |
virtual bool | WriteString (const MboString &strSection, const MboString &strKeyname, const MboString &strValue) |
virtual bool | WriteInt (const MboString &strSection, const MboString &strKeyname, int nValue) |
virtual bool | WriteLong (const MboString &strSection, const MboString &strKeyname, long lValue) |
virtual bool | WriteFloat (const MboString &strSection, const MboString &strKeyname, float fValue) |
virtual bool | WriteDouble (const MboString &strSection, const MboString &strKeyname, double fValue) |
virtual bool | WriteBool (const MboString &strSection, const MboString &strKeyname, bool bValue) |
virtual bool | WriteColor (const MboString &strSection, const MboString &strKeyname, COLORREF colValue) |
virtual bool | WriteMap (const MboString &strSection, CStrMapStr msstrValue, bool bWriteEmpty=false, bool bKeepComments=true) |
virtual bool | WriteSectionList (const MboString &strSection, CIniSectionList vsstrValue, bool bWriteEmpty=false, bool bKeepComments=true) |
virtual bool | ReplaceSectionList (const MboString &strSection, const CIniSectionList &vsstrValue, bool bWriteEmpty=false) |
bool | IsValidKey (const MboString &strKeyName, bool bAcceptComment=false) const |
mbo::CLock | IniDataGetLock () const |
Static Public Member Functions | |
static MboString | GetIniString (const MboString &strFilename, const MboString &strSection, const MboString &strKeyname, const MboString &strDefault="", bool bWriteDefault=false, bool bParseEnvVars=false) |
static int | GetIniInt (const MboString &strFilename, const MboString &strSection, const MboString &strKeyname, int nDefault=0, bool bWriteDefault=false, int nMinimum=INT_MIN, int nMaximum=INT_MAX) |
static long | GetIniLong (const MboString &strFilename, const MboString &strSection, const MboString &strKeyname, long lDefault=0L, bool bWriteDefault=false, long lMinimum=LONG_MIN, long lMaximum=LONG_MAX) |
static float | GetIniFloat (const MboString &strFilename, const MboString &strSection, const MboString &strKeyname, float fDefault=0.0f, bool bWriteDefault=false, float fMinimum=-FLT_MAX, float fMaximum=FLT_MAX) |
static double | GetIniDouble (const MboString &strFilename, const MboString &strSection, const MboString &strKeyname, double fDefault=0.0, bool bWriteDefault=false, double fMinimum=-DBL_MAX, double fMaximum=DBL_MAX) |
static bool | GetIniBool (const MboString &strFilename, const MboString &strSection, const MboString &strKeyname, bool bDefault=false, bool bWriteDefault=false) |
static COLORREF | GetIniColor (const MboString &strFilename, const MboString &strSection, const MboString &strKeyname, COLORREF colDefault=RGB(0, 0, 0), bool bWriteDefault=false) |
static CStrMapStr | GetIniMap (const MboString &strFilename, const MboString &strSection, const CStrMapStr &msstrDefault=CStrMapStr(), bool bWriteDefault=false, bool bWriteEmpty=false) |
Protected Types | |
typedef mbo::quaternion< bool, MboString, MboString, MboString > | TIniValue |
typedef std::list< TIniValue > | TIniData |
typedef std::pair< MboString, TIniData > | TIniSection |
typedef std::list< TIniSection > | TIniCache |
Protected Member Functions | |
virtual bool | ReadFile () |
virtual bool | IniDataFlush (bool bModified=false) const |
bool | IsEmptyIniValue (const TIniValue &val) const |
TIniCache::iterator | GetSection (const MboString &strSection) |
TIniCache::const_iterator | GetSection (const MboString &strSection) const |
TIniCache::iterator | GetSectionOrCreate (const MboString &strSection) |
TIniValue * | GetValuePtr (const TIniCache::iterator &itSection, const MboString &strKeyName) |
const TIniValue * | GetValuePtr (const TIniCache::const_iterator &itSection, const MboString &strKeyName) const |
TIniValue * | GetValuePtr (const MboString &strSection, const MboString &strKeyName) |
const TIniValue * | GetValuePtr (const MboString &strSection, const MboString &strKeyName) const |
TIniData::iterator | FindFirstEmpty (TIniCache::iterator &itSection) |
TIniData::iterator | AddValue (TIniCache::iterator &itSection, TIniData::iterator itValue, const MboString &strKeyName, const MboString &strValue) |
TIniData::iterator | AddValue (TIniCache::iterator &itSection, const MboString &strKeyName, const MboString &strValue) |
TIniData::iterator | AddValue (const MboString &strSection, const MboString &strKeyName, const MboString &strValue) |
Classes | |
class | CIniMutex |
extended mutex that enables auto-flushing |
Features:
Definition at line 274 of file MboIniData.h.
typedef mbo::quaternion<bool, MboString, MboString, MboString> mbo::CIniData::TIniValue [protected] |
Definition at line 1220 of file MboIniData.h.
typedef std::list<TIniValue> mbo::CIniData::TIniData [protected] |
Definition at line 1221 of file MboIniData.h.
typedef std::pair<MboString, TIniData> mbo::CIniData::TIniSection [protected] |
Definition at line 1222 of file MboIniData.h.
typedef std::list<TIniSection> mbo::CIniData::TIniCache [protected] |
Definition at line 1223 of file MboIniData.h.
mbo::CIniData::CIniData | ( | const MboString & | strFilename, | |
const MboString & | strSectionPrefix = "" | |||
) | [explicit] |
Construct an interface that uses the ini file strFilename.
If that file does not exist it will be created in the WINDOWS (WINNT) directory. All actions are atomic. With the exeption that some functions first clear sections with an atomic function and then write some data into the new section.
When strSectionPrefix is given each Section that will be read or written will be prepended by that prefix.
strFilename | Name of ini file to open or create. | |
strSectionPrefix | Section prefix to use for all section names. |
virtual mbo::CIniData::~CIniData | ( | ) | [virtual] |
The destructor does not do anything with the file. As all actions are performed directly.
virtual const MboString& mbo::CIniData::GetFilename | ( | ) | const [virtual] |
Read access to the name of the file used internally.
virtual MboString mbo::CIniData::GetIniDirectory | ( | ) | const [virtual] |
virtual const MboString& mbo::CIniData::GetSectionPrefix | ( | ) | const [virtual] |
Read access to the section prefix applied to all functions.
bool mbo::CIniData::GetSectionNames | ( | const MboString & | strSectionPrefix, | |
CStrList & | vstrSectionNames | |||
) | const |
Retrieve all sectionnames starting with strSection The returned Names will not contain the global SectionPrefix but the local strSectionPrefix.
strSectionPrefix | Additional section prefix to search for. |
vstrSectionNames | Retrieves all found (matched) sections. The list will be cleared first. |
bool mbo::CIniData::GetSectionNames | ( | CStrList & | vstrSectionNames | ) | const |
Retrieve all sectionnames starting with strSection The returned Names will not contain the global SectionPrefix.
vstrSectionNames | Retrieves all found (matched) sections. The list will be cleared first. |
bool mbo::CIniData::SectionExists | ( | const MboString & | strSection | ) | const |
Check if a specific section exists
strSection | Name of section to search |
virtual bool mbo::CIniData::GetKeyNames | ( | const MboString & | strSection, | |
CStrList & | vstrKeyNames | |||
) | const [virtual] |
Retrieves all keynames in section strSection.
strSection | Name of section to search. |
vstrKeyNames | Keynames contained in specified section. |
virtual bool mbo::CIniData::KeyNameExists | ( | const MboString & | strSection, | |
const MboString & | strKeyname | |||
) | const [virtual] |
Check whether or not a specific KeyName exists in section strSection.
strSection | Name of section to search. | |
strKeyname | Name of key to search. |
virtual bool mbo::CIniData::ReadString | ( | const MboString & | strSection, | |
const MboString & | strKeyname, | |||
MboString & | strValue, | |||
const MboString & | strDefault = "" , |
|||
bool | bWriteDefault = false , |
|||
bool | bParseEnvVars = false | |||
) | const [virtual] |
Read a string value from strSection with name strKeyname. When there is no such value stored in the file the default value strDefault is used. The function returns whether or not the returned value was read from file.
If bParseEnvVars is true
then the result will be paresed for environment variables recursively.
strSection | Name of section to search. | |
strKeyname | Name of key to search. |
strValue | Value for key if found or default. |
strDefault | Default value to use if key not present. | |
bWriteDefault | Whether or not the default should be written to the ini file if key is not present in ini file. | |
bParseEnvVars | Whether or not environment variables should be parsed. If so "%name%" will be replaced by the value of the environment variable "name". |
virtual MboString mbo::CIniData::GetString | ( | const MboString & | strSection, | |
const MboString & | strKeyname, | |||
const MboString & | strDefault = "" , |
|||
bool | bWriteDefault = false , |
|||
bool | bParseEnvVars = false | |||
) | const [virtual] |
Same as ReadString but here the value (read or default) is returned.
strSection | Name of section to search. | |
strKeyname | Name of key to search. | |
strDefault | Default value to use if key not present. | |
bWriteDefault | Whether or not the default should be written to the ini file if key is not present in ini file. | |
bParseEnvVars | Whether or not environment variables should be parsed. If so "%name%" will be replaced by the value of the environment variable "name". |
static MboString mbo::CIniData::GetIniString | ( | const MboString & | strFilename, | |
const MboString & | strSection, | |||
const MboString & | strKeyname, | |||
const MboString & | strDefault = "" , |
|||
bool | bWriteDefault = false , |
|||
bool | bParseEnvVars = false | |||
) | [static] |
Same as GetString but static from file without the need to first create a CIniData instance. Use this only if you access one single value.
strFilename | Name of ini file to read. | |
strSection | Name of section to search. | |
strKeyname | Name of key to search. | |
strDefault | Default value to use if key not present. | |
bWriteDefault | Whether or not the default should be written to the ini file if key is not present in ini file. | |
bParseEnvVars | Whether or not environment variables should be parsed. If so "%name%" will be replaced by the value of the environment variable "name". |
virtual bool mbo::CIniData::ReadInt | ( | const MboString & | strSection, | |
const MboString & | strKeyname, | |||
int & | nValue, | |||
int | nDefault = 0 , |
|||
bool | bWriteDefault = false , |
|||
int | nMinimum = INT_MIN , |
|||
int | nMaximum = INT_MAX | |||
) | const [virtual] |
Read an integer value from strSection with name strKeyname. When there is no such value stored in the file the default value nDefault is used. The function returns whether or not the returned value was read from file. When the value was read from file and a conversion error occures the returned value is zero (not default). The parameter bWriteDefault can be set true to ensure the ini directive exists after first read attempt in case it could not be found while reading. In that case this read function is no longer a const function.
strSection | Name of section to search. | |
strKeyname | Name of key to search. |
nValue | Value for key if found or default. |
nDefault | Default value to use if key not present. | |
bWriteDefault | Whether or not the default should be written to the ini file if key is not present in ini file. | |
nMinimum | Lower values will be replaced by this minimum. | |
nMaximum | Higher values will be replaced by this maximum. |
virtual int mbo::CIniData::GetInt | ( | const MboString & | strSection, | |
const MboString & | strKeyname, | |||
int | nDefault = 0 , |
|||
bool | bWriteDefault = false , |
|||
int | nMinimum = INT_MIN , |
|||
int | nMaximum = INT_MAX | |||
) | const [virtual] |
Same as ReadInt but here the value (read or default) is returned.
strSection | Name of section to search. | |
strKeyname | Name of key to search. | |
nDefault | Default value to use if key not present. | |
bWriteDefault | Whether or not the default should be written to the ini file if key is not present in ini file. | |
nMinimum | Lower values will be replaced by this minimum. | |
nMaximum | Higher values will be replaced by this maximum. |
static int mbo::CIniData::GetIniInt | ( | const MboString & | strFilename, | |
const MboString & | strSection, | |||
const MboString & | strKeyname, | |||
int | nDefault = 0 , |
|||
bool | bWriteDefault = false , |
|||
int | nMinimum = INT_MIN , |
|||
int | nMaximum = INT_MAX | |||
) | [static] |
Same as GetInt but static from file without the need to first create a CIniData instance. Use this only if you access one single value.
strFilename | Name of ini file to read. | |
strSection | Name of section to search. | |
strKeyname | Name of key to search. | |
nDefault | Default value to use if key not present. | |
bWriteDefault | Whether or not the default should be written to the ini file if key is not present in ini file. | |
nMinimum | Lower values will be replaced by this minimum. | |
nMaximum | Higher values will be replaced by this maximum. |
virtual bool mbo::CIniData::ReadLong | ( | const MboString & | strSection, | |
const MboString & | strKeyname, | |||
long & | lValue, | |||
long | lDefault = 0 , |
|||
bool | bWriteDefault = false , |
|||
long | lMinimum = LONG_MIN , |
|||
long | lMaximum = LONG_MAX | |||
) | const [virtual] |
Read a long value from strSection with name strKeyname. When there is no such value stored in the file the default value lDefault is used. The function returns whether or not the returned value was read from file. When the value was read from file and a conversion error occures the returned value is zero (not default). The parameter bWriteDefault can be set true to ensure the ini directive exists after first read attempt in case it could not be found while reading. In that case this read function is no longer a const function.
strSection | Name of section to search. | |
strKeyname | Name of key to search. |
lValue | Value for key if found or default. |
lDefault | Default value to use if key not present. | |
bWriteDefault | Whether or not the default should be written to the ini file if key is not present in ini file. | |
lMinimum | Lower values will be replaced by this minimum. | |
lMaximum | Higher values will be replaced by this maximum. |
virtual long mbo::CIniData::GetLong | ( | const MboString & | strSection, | |
const MboString & | strKeyname, | |||
long | lDefault = 0L , |
|||
bool | bWriteDefault = false , |
|||
long | lMinimum = LONG_MIN , |
|||
long | lMaximum = LONG_MAX | |||
) | const [virtual] |
Same as ReadLong but here the value (read or default) is returned.
strSection | Name of section to search. | |
strKeyname | Name of key to search. | |
lDefault | Default value to use if key not present. | |
bWriteDefault | Whether or not the default should be written to the ini file if key is not present in ini file. | |
lMinimum | Lower values will be replaced by this minimum. | |
lMaximum | Higher values will be replaced by this maximum. |
static long mbo::CIniData::GetIniLong | ( | const MboString & | strFilename, | |
const MboString & | strSection, | |||
const MboString & | strKeyname, | |||
long | lDefault = 0L , |
|||
bool | bWriteDefault = false , |
|||
long | lMinimum = LONG_MIN , |
|||
long | lMaximum = LONG_MAX | |||
) | [static] |
Same as GetIni but static from file without the need to first create a CIniData instance. Use this only if you access one single value.
strFilename | Name of ini file to read. | |
strSection | Name of section to search. | |
strKeyname | Name of key to search. | |
lDefault | Default value to use if key not present. | |
bWriteDefault | Whether or not the default should be written to the ini file if key is not present in ini file. | |
lMinimum | Lower values will be replaced by this minimum. | |
lMaximum | Higher values will be replaced by this maximum. |
virtual bool mbo::CIniData::ReadFloat | ( | const MboString & | strSection, | |
const MboString & | strKeyname, | |||
float & | fValue, | |||
float | fDefault = 0.0f , |
|||
bool | bWriteDefault = false , |
|||
float | fMinimum = -FLT_MAX , |
|||
float | fMaximum = FLT_MAX | |||
) | const [virtual] |
Read a float value from strSection with name strKeyname. When there is no such value stored in the file the default value fDefault is used. The function returns whether or not the returned value was read from file. When the value was read from file and a conversion error occures the returned value is zero (not default). The parameter bWriteDefault can be set true to ensure the ini directive exists after first read attempt in case it could not be found while reading. In that case this read function is no longer a const function.
strSection | Name of section to search. | |
strKeyname | Name of key to search. |
fValue | Value for key if found or default. |
fDefault | Default value to use if key not present. | |
bWriteDefault | Whether or not the default should be written to the ini file if key is not present in ini file. | |
fMinimum | Lower values will be replaced by this minimum. | |
fMaximum | Higher values will be replaced by this maximum. |
virtual float mbo::CIniData::GetFloat | ( | const MboString & | strSection, | |
const MboString & | strKeyname, | |||
float | fDefault = 0.0f , |
|||
bool | bWriteDefault = false , |
|||
float | fMinimum = -FLT_MAX , |
|||
float | fMaximum = FLT_MAX | |||
) | const [virtual] |
Same as ReadFloat but here the value (read or default) is returned.
strSection | Name of section to search. | |
strKeyname | Name of key to search. | |
fDefault | Default value to use if key not present. | |
bWriteDefault | Whether or not the default should be written to the ini file if key is not present in ini file. | |
fMinimum | Lower values will be replaced by this minimum. | |
fMaximum | Higher values will be replaced by this maximum. |
static float mbo::CIniData::GetIniFloat | ( | const MboString & | strFilename, | |
const MboString & | strSection, | |||
const MboString & | strKeyname, | |||
float | fDefault = 0.0f , |
|||
bool | bWriteDefault = false , |
|||
float | fMinimum = -FLT_MAX , |
|||
float | fMaximum = FLT_MAX | |||
) | [static] |
Same as GetFloat but static from file without the need to first create a CIniData instance. Use this only if you access one single value.
strFilename | Name of ini file to read. | |
strSection | Name of section to search. | |
strKeyname | Name of key to search. | |
fDefault | Default value to use if key not present. | |
bWriteDefault | Whether or not the default should be written to the ini file if key is not present in ini file. | |
fMinimum | Lower values will be replaced by this minimum. | |
fMaximum | Higher values will be replaced by this maximum. |
virtual bool mbo::CIniData::ReadDouble | ( | const MboString & | strSection, | |
const MboString & | strKeyname, | |||
double & | fValue, | |||
double | fDefault = 0.0 , |
|||
bool | bWriteDefault = false , |
|||
double | fMinimum = -DBL_MAX , |
|||
double | fMaximum = DBL_MAX | |||
) | const [virtual] |
Read a double value from strSection with name strKeyname. When there is no such value stored in the file the default value fDefault is used. The function returns whether or not the returned value was read from file. When the value was read from file and a conversion error occures the returned value is zero (not default). The parameter bWriteDefault can be set true to ensure the ini directive exists after first read attempt in case it could not be found while reading. In that case this read function is no longer a const function.
strSection | Name of section to search. | |
strKeyname | Name of key to search. |
fValue | Value for key if found or default. |
fDefault | Default value to use if key not present. | |
bWriteDefault | Whether or not the default should be written to the ini file if key is not present in ini file. | |
fMinimum | Lower values will be replaced by this minimum. | |
fMaximum | Higher values will be replaced by this maximum. |
virtual double mbo::CIniData::GetDouble | ( | const MboString & | strSection, | |
const MboString & | strKeyname, | |||
double | fDefault = 0.0 , |
|||
bool | bWriteDefault = false , |
|||
double | fMinimum = -DBL_MAX , |
|||
double | fMaximum = DBL_MAX | |||
) | const [virtual] |
Same as ReadDouble but here the value (read or default) is returned.
strSection | Name of section to search. | |
strKeyname | Name of key to search. | |
fDefault | Default value to use if key not present. | |
bWriteDefault | Whether or not the default should be written to the ini file if key is not present in ini file. | |
fMinimum | Lower values will be replaced by this minimum. | |
fMaximum | Higher values will be replaced by this maximum. |
static double mbo::CIniData::GetIniDouble | ( | const MboString & | strFilename, | |
const MboString & | strSection, | |||
const MboString & | strKeyname, | |||
double | fDefault = 0.0 , |
|||
bool | bWriteDefault = false , |
|||
double | fMinimum = -DBL_MAX , |
|||
double | fMaximum = DBL_MAX | |||
) | [static] |
Same as GetDouble but static from file without the need to first create a CIniData instance. Use this only if you access one single value.
strFilename | Name of ini file to read. | |
strSection | Name of section to search. | |
strKeyname | Name of key to search. | |
fDefault | Default value to use if key not present. | |
bWriteDefault | Whether or not the default should be written to the ini file if key is not present in ini file. | |
fMinimum | Lower values will be replaced by this minimum. | |
fMaximum | Higher values will be replaced by this maximum. |
virtual bool mbo::CIniData::ReadBool | ( | const MboString & | strSection, | |
const MboString & | strKeyname, | |||
bool & | bValue, | |||
bool | bDefault = false , |
|||
bool | bWriteDefault = false | |||
) | const [virtual] |
Read a boolean value from strSection with name strKeyname. When there is no such value stored in the file the default value bDefault is used. The function returns whether or not the returned value was read from file. When the value was read from file and a conversion error occures the returned value is zero (not default). The parameter bWriteDefault can be set true to ensure the ini directive exists after first read attempt in case it could not be found while reading. In that case this read function is no longer a const function.
strSection | Name of section to search. | |
strKeyname | Name of key to search. |
bValue | Value for key if found or default. |
bDefault | Default value to use if key not present. | |
bWriteDefault | Whether or not the default should be written to the ini file if key is not present in ini file. |
virtual bool mbo::CIniData::GetBool | ( | const MboString & | strSection, | |
const MboString & | strKeyname, | |||
bool | bDefault = false , |
|||
bool | bWriteDefault = false | |||
) | const [virtual] |
Same as ReadBool but here the value (read or default) is returned.
strSection | Name of section to search. | |
strKeyname | Name of key to search. | |
bDefault | Default value to use if key not present. | |
bWriteDefault | Whether or not the default should be written to the ini file if key is not present in ini file. |
static bool mbo::CIniData::GetIniBool | ( | const MboString & | strFilename, | |
const MboString & | strSection, | |||
const MboString & | strKeyname, | |||
bool | bDefault = false , |
|||
bool | bWriteDefault = false | |||
) | [static] |
Same as GetBool but static from file without the need to first create a CIniData instance. Use this only if you access one single value.
strFilename | Name of ini file to read. | |
strSection | Name of section to search. | |
strKeyname | Name of key to search. | |
bDefault | Default value to use if key not present. | |
bWriteDefault | Whether or not the default should be written to the ini file if key is not present in ini file. |
virtual bool mbo::CIniData::ReadColor | ( | const MboString & | strSection, | |
const MboString & | strKeyname, | |||
COLORREF & | colValue, | |||
COLORREF | colDefault = RGB(0, 0, 0) , |
|||
bool | bWriteDefault = false | |||
) | const [virtual] |
Read a COLORREF value from strSection with name strKeyname. When there is no such value stored in the file the default value colDefault is used. The function returns whether or not the returned value was read from file. When the value was read from file and a conversion error occures for any color component that value is set to zero. The parameter bWriteDefault can be set true to ensure the ini directive exists after first read attempt in case it could not be found while reading. In that case this read function is no longer a const function.
strSection | Name of section to search. | |
strKeyname | Name of key to search. |
colValue | Value for key if found or default. |
colDefault | Default value to use if key not present. | |
bWriteDefault | Whether or not the default should be written to the ini file if key is not present in ini file. |
virtual COLORREF mbo::CIniData::GetColor | ( | const MboString & | strSection, | |
const MboString & | strKeyname, | |||
COLORREF | colDefault = RGB(0, 0, 0) , |
|||
bool | bWriteDefault = false | |||
) | const [virtual] |
Same as ReadColor but here the value (read or default) is returned.
strSection | Name of section to search. | |
strKeyname | Name of key to search. | |
colDefault | Default value to use if key not present. | |
bWriteDefault | Whether or not the default should be written to the ini file if key is not present in ini file. |
static COLORREF mbo::CIniData::GetIniColor | ( | const MboString & | strFilename, | |
const MboString & | strSection, | |||
const MboString & | strKeyname, | |||
COLORREF | colDefault = RGB(0, 0, 0) , |
|||
bool | bWriteDefault = false | |||
) | [static] |
Same as GetColor but static from file without the need to first create a CIniData instance. Use this only if you access one single value.
strFilename | Name of ini file to read. | |
strSection | Name of section to search. | |
strKeyname | Name of key to search. | |
colDefault | Default value to use if key not present. | |
bWriteDefault | Whether or not the default should be written to the ini file if key is not present in ini file. |
virtual bool mbo::CIniData::ReadMap | ( | const MboString & | strSection, | |
CStrMapStr & | msstrValue, | |||
const CStrMapStr & | msstrDefault = CStrMapStr() , |
|||
bool | bWriteDefault = false , |
|||
bool | bWriteEmpty = false , |
|||
bool | bRetrieveAll = false | |||
) | const [virtual] |
Read a string map from strSection. When there is no such section stored in the file the default value msstrDefault is used. The function returns whether or not the map contains elements. The parameter bWriteDefault can be set true to ensure the ini directive exists after first read attempt in case it could not be found while reading. In that case this read function is no longer a const function.
This method requires that both key and values are string types and will return those pairs in a map (key - > value).
The return data will contain the default overwritten with the actual contents.
strSection | Name of section to search. |
msstrValue | Section Map if found or default. |
msstrDefault | Default value to use if key not present. | |
bWriteDefault | Whether or not the default should be written to the ini file if section is not present in the ini file. | |
bWriteEmpty | If the section is not present in the ini file this parameter determines wether or not empty values result in writing "key=" lines to the ini file. | |
bRetrieveAll | Return comments and empty lines |
virtual CStrMapStr mbo::CIniData::GetMap | ( | const MboString & | strSection, | |
const CStrMapStr & | msstrDefault = CStrMapStr() , |
|||
bool | bWriteDefault = false , |
|||
bool | bWriteEmpty = false , |
|||
bool | bRetrieveAll = false | |||
) | const [virtual] |
Same as ReadMap but here the value (read or default) is returned.
strSection | Name of section to search. | |
msstrDefault | Default value to use if section not present. | |
bWriteDefault | Whether or not the default should be written to the ini file if section is not present in the ini file. | |
bWriteEmpty | If the section is not present in the ini file this parameter determines wether or not empty values result in writing "key=" lines to the ini file. | |
bRetrieveAll | Return comments and empty lines |
static CStrMapStr mbo::CIniData::GetIniMap | ( | const MboString & | strFilename, | |
const MboString & | strSection, | |||
const CStrMapStr & | msstrDefault = CStrMapStr() , |
|||
bool | bWriteDefault = false , |
|||
bool | bWriteEmpty = false | |||
) | [static] |
Same as GetMap but static from file without the need to first create a CIniData instance. Use this only if you access one single value.
strFilename | Name of ini file to read. | |
strSection | Name of section to search. | |
msstrDefault | Default value to use if key not present. | |
bWriteDefault | Whether or not the default should be written to the ini file if section is not present in the ini file. | |
bWriteEmpty | If the section is not present in the ini file this parameter determines wether or not empty values result in writing "key=" lines to the ini file. |
virtual bool mbo::CIniData::ReadSectionList | ( | const MboString & | strSection, | |
CIniSectionList & | vsstrValue, | |||
const CIniSectionList & | vsstrDefault = CIniSectionList() , |
|||
bool | bWriteDefault = false , |
|||
bool | bWriteEmpty = false , |
|||
bool | bRetrieveAll = false | |||
) | const [virtual] |
Read a CIniSectionList from strSection. When there is no such section in the file the default value msstrDefault is used. The function returns whether or not the map contains elements. The parameter bWriteDefault can be set true to ensure the ini directive exists after first read attempt in case it could not be found while reading. In that case this read function is no longer a const function.
This method requires that both key and values are string types and will return those pairs in a map (key - > value).
In contrast to ReadMap this function will return duplicate entries. It also does not return default entries if the section is not empty.
strSection | Name of section to search. |
vsstrValue | SectionList if found or default. |
vsstrDefault | Default value to use if key not present. | |
bWriteDefault | Whether or not the default should be written to the ini file if section is not present in the ini file. | |
bWriteEmpty | If the section is not present in the ini file this parameter determines wether or not empty values result in writing "key=" lines to the ini file. | |
bRetrieveAll | Return comments and empty lines |
virtual bool mbo::CIniData::EmptySection | ( | const MboString & | strSection, | |
bool | bKeepComments = true | |||
) | [virtual] |
Empty specified section (delete entries).
Removes all "key=value" lines but not the section header "[name]". It can optionally keep the comments and empty lines.
strSection | Name of section to delete. | |
bKeepComments | Whether to keep comments in original section. |
virtual bool mbo::CIniData::ClearSection | ( | const MboString & | strSection | ) | [virtual] |
Remove specified section completely.
Removes the section header "[name]" and all "key=value" lines.
strSection | Name of section to delete. |
virtual bool mbo::CIniData::DeleteKey | ( | const MboString & | strSection, | |
const MboString & | strKeyname | |||
) | [virtual] |
Delete specified key.
Removes the key "key" in section "[section]"
strSection | Section to delete from. | |
strKeyname | Name of Key to delete. |
virtual bool mbo::CIniData::RenameKey | ( | const MboString & | strSection, | |
const MboString & | strKeynameOld, | |||
const MboString & | strKeynameNew | |||
) | [virtual] |
Rename an existing key
strSection | Section to delete from. | |
strKeynameOld | old name of Key to rename | |
strKeynameNew | new name of Key to rename |
virtual bool mbo::CIniData::WriteString | ( | const MboString & | strSection, | |
const MboString & | strKeyname, | |||
const MboString & | strValue | |||
) | [virtual] |
Store a MboString
value into a specified section as given key.
strSection | Section to write to (will be created if not present). | |
strKeyname | Name of Key to update/create. | |
strValue | Value to write. |
virtual bool mbo::CIniData::WriteInt | ( | const MboString & | strSection, | |
const MboString & | strKeyname, | |||
int | nValue | |||
) | [virtual] |
Store an int
value into a specified section as given key.
strSection | Section to write to (will be created if not present). | |
strKeyname | Name of Key to update/create. | |
nValue | Value to write. |
virtual bool mbo::CIniData::WriteLong | ( | const MboString & | strSection, | |
const MboString & | strKeyname, | |||
long | lValue | |||
) | [virtual] |
Store a long
value into a specified section as given key.
strSection | Section to write to (will be created if not present). | |
strKeyname | Name of Key to update/create. | |
lValue | Value to write. |
virtual bool mbo::CIniData::WriteFloat | ( | const MboString & | strSection, | |
const MboString & | strKeyname, | |||
float | fValue | |||
) | [virtual] |
Store a float
value into a specified section as given key.
strSection | Section to write to (will be created if not present). | |
strKeyname | Name of Key to update/create. | |
fValue | Value to write. |
virtual bool mbo::CIniData::WriteDouble | ( | const MboString & | strSection, | |
const MboString & | strKeyname, | |||
double | fValue | |||
) | [virtual] |
Store a double
value into a specified section as given key.
strSection | Section to write to (will be created if not present). | |
strKeyname | Name of Key to update/create. | |
fValue | Value to write. |
virtual bool mbo::CIniData::WriteBool | ( | const MboString & | strSection, | |
const MboString & | strKeyname, | |||
bool | bValue | |||
) | [virtual] |
Store a boolean
value into a specified section as given key.
strSection | Section to write to (will be created if not present). | |
strKeyname | Name of Key to update/create. | |
bValue | Value to write. |
virtual bool mbo::CIniData::WriteColor | ( | const MboString & | strSection, | |
const MboString & | strKeyname, | |||
COLORREF | colValue | |||
) | [virtual] |
Store a COLORREF
value into a specified section as given key.
strSection | Section to write to (will be created if not present). | |
strKeyname | Name of Key to update/create. | |
colValue | Value to write. |
virtual bool mbo::CIniData::WriteMap | ( | const MboString & | strSection, | |
CStrMapStr | msstrValue, | |||
bool | bWriteEmpty = false , |
|||
bool | bKeepComments = true | |||
) | [virtual] |
Store string map msstrValue in section strSection. The optional parameter bWriteEmpty can be set true to force writing empty strings into the file.
strSection | Section to write to (will be created if not present). | |
msstrValue | String map to write as section. | |
bWriteEmpty | Wether or not empty values result in writing "key=" lines. | |
bKeepComments | Whether to keep comments in original section. |
virtual bool mbo::CIniData::WriteSectionList | ( | const MboString & | strSection, | |
CIniSectionList | vsstrValue, | |||
bool | bWriteEmpty = false , |
|||
bool | bKeepComments = true | |||
) | [virtual] |
Store SectionList vsstrValue in section strSection. The optional parameter bWriteEmpty can be set true to force writing empty strings into the file.
In contrast to WriteMap this function allows to write duplicate entries.
strSection | Section to write to (will be created if not present). | |
vsstrValue | Section to write. | |
bWriteEmpty | Wether or not empty values result in writing "key=" lines. | |
bKeepComments | Whether to keep comments in original section. |
virtual bool mbo::CIniData::ReplaceSectionList | ( | const MboString & | strSection, | |
const CIniSectionList & | vsstrValue, | |||
bool | bWriteEmpty = false | |||
) | [virtual] |
Store SectionList vsstrValue in section strSection. The optional parameter bWriteEmpty can be set true to force writing empty strings into the file.
In contrast to WriteMap this function allows to write duplicate entries. And unlike WriteSectionList it replaces the original contents of the section entirely.
strSection | Section to write to (will be created if not present). | |
vsstrValue | Section to write. | |
bWriteEmpty | Wether or not empty values result in writing "key=" lines. |
bool mbo::CIniData::IsValidKey | ( | const MboString & | strKeyName, | |
bool | bAcceptComment = false | |||
) | const |
Verify key
strKeyName | key to verify. | |
bAcceptComment | whether comments are ok, if so only empty and invalid lines are not ok. |
mbo::CLock mbo::CIniData::IniDataGetLock | ( | ) | const |
Get Lock for instance
virtual bool mbo::CIniData::ReadFile | ( | ) | [protected, virtual] |
Clear cache and re-read file
virtual bool mbo::CIniData::IniDataFlush | ( | bool | bModified = false |
) | const [protected, virtual] |
Flush data to disk
bModified | whether last operation modified contents |
bool mbo::CIniData::IsEmptyIniValue | ( | const TIniValue & | val | ) | const [protected] |
TIniCache::iterator mbo::CIniData::GetSection | ( | const MboString & | strSection | ) | [protected] |
strSection | name of requested section |
TIniCache::const_iterator mbo::CIniData::GetSection | ( | const MboString & | strSection | ) | const [protected] |
strSection | name of requested section |
TIniCache::iterator mbo::CIniData::GetSectionOrCreate | ( | const MboString & | strSection | ) | [protected] |
strSection | name of requested section |
TIniValue* mbo::CIniData::GetValuePtr | ( | const TIniCache::iterator & | itSection, | |
const MboString & | strKeyName | |||
) | [protected] |
itSection | iterator to requested section | |
strKeyName | name of key=value pair |
const TIniValue* mbo::CIniData::GetValuePtr | ( | const TIniCache::const_iterator & | itSection, | |
const MboString & | strKeyName | |||
) | const [protected] |
itSection | iterator to requested section | |
strKeyName | name of key=value pair |
TIniValue* mbo::CIniData::GetValuePtr | ( | const MboString & | strSection, | |
const MboString & | strKeyName | |||
) | [protected] |
strSection | name of requested section | |
strKeyName | name of key=value pair |
const TIniValue* mbo::CIniData::GetValuePtr | ( | const MboString & | strSection, | |
const MboString & | strKeyName | |||
) | const [protected] |
strSection | name of requested section | |
strKeyName | name of key=value pair |
TIniData::iterator mbo::CIniData::FindFirstEmpty | ( | TIniCache::iterator & | itSection | ) | [protected] |
itSection | iterator to section |
TIniData::iterator mbo::CIniData::AddValue | ( | TIniCache::iterator & | itSection, | |
TIniData::iterator | itValue, | |||
const MboString & | strKeyName, | |||
const MboString & | strValue | |||
) | [protected] |
Add new entry into section at specific position
itSection | iterator to requested section | |
itValue | insert position | |
strKeyName | name of key=value pair | |
strValue | value of key=value pair |
TIniData::iterator mbo::CIniData::AddValue | ( | TIniCache::iterator & | itSection, | |
const MboString & | strKeyName, | |||
const MboString & | strValue | |||
) | [protected] |
Add new entry into section as last entry prior to empty lines
itSection | iterator to requested section | |
strKeyName | name of key=value pair | |
strValue | value of key=value pair |
TIniData::iterator mbo::CIniData::AddValue | ( | const MboString & | strSection, | |
const MboString & | strKeyName, | |||
const MboString & | strValue | |||
) | [protected] |
Add new entry into section as last entry prior to empty lines
strSection | name of requested section | |
strKeyName | name of key=value pair | |
strValue | value of key=value pair |
Hosted on code.google.com | © Marcus Börger | Generated on Fri Jan 18 21:21:11 2008 for MBO-lib by ![]() |