Added cIniFile::HasValue() function.
This commit is contained in:
parent
b4c6ad0036
commit
fac89d0c43
@ -668,6 +668,24 @@ void cIniFile::Clear(void)
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
bool cIniFile::HasValue(const AString & a_KeyName, const AString & a_ValueName)
|
||||||
|
{
|
||||||
|
// Find the key:
|
||||||
|
int keyID = FindKey(a_KeyName);
|
||||||
|
if (keyID == noID)
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Find the value:
|
||||||
|
int valueID = FindValue(keyID, a_ValueName);
|
||||||
|
return (valueID != noID);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
void cIniFile::AddHeaderComment(const AString & comment)
|
void cIniFile::AddHeaderComment(const AString & comment)
|
||||||
{
|
{
|
||||||
comments.push_back(comment);
|
comments.push_back(comment);
|
||||||
|
@ -53,7 +53,9 @@ private:
|
|||||||
|
|
||||||
/// Removes the UTF-8 BOMs (Byte order makers), if present.
|
/// Removes the UTF-8 BOMs (Byte order makers), if present.
|
||||||
void RemoveBom(AString & a_line) const;
|
void RemoveBom(AString & a_line) const;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
|
||||||
enum errors
|
enum errors
|
||||||
{
|
{
|
||||||
noID = -1,
|
noID = -1,
|
||||||
@ -79,6 +81,9 @@ public:
|
|||||||
|
|
||||||
/// Deletes all stored ini data (but doesn't touch the file)
|
/// Deletes all stored ini data (but doesn't touch the file)
|
||||||
void Clear(void);
|
void Clear(void);
|
||||||
|
|
||||||
|
/** Returns true iff the specified value exists. */
|
||||||
|
bool HasValue(const AString & a_KeyName, const AString & a_ValueName);
|
||||||
|
|
||||||
/// Returns index of specified key, or noID if not found
|
/// Returns index of specified key, or noID if not found
|
||||||
int FindKey(const AString & keyname) const;
|
int FindKey(const AString & keyname) const;
|
||||||
|
Loading…
Reference in New Issue
Block a user