summaryrefslogtreecommitdiffstats
path: root/lib/inifile
diff options
context:
space:
mode:
authorHowaner <franzi.moos@googlemail.com>2014-09-23 14:39:49 +0200
committerHowaner <franzi.moos@googlemail.com>2014-09-23 14:39:49 +0200
commit4b38e077cf8d27d1c7ef26d4148f7825c5aeaabd (patch)
treecd86062eb50ba870f73b6f29dec0205f87205bf8 /lib/inifile
parentMerge branch 'master' into EntityCustomName (diff)
parentQtBiomeVisualiser: Fixed confusion about Globals.h. (diff)
downloadcuberite-4b38e077cf8d27d1c7ef26d4148f7825c5aeaabd.tar
cuberite-4b38e077cf8d27d1c7ef26d4148f7825c5aeaabd.tar.gz
cuberite-4b38e077cf8d27d1c7ef26d4148f7825c5aeaabd.tar.bz2
cuberite-4b38e077cf8d27d1c7ef26d4148f7825c5aeaabd.tar.lz
cuberite-4b38e077cf8d27d1c7ef26d4148f7825c5aeaabd.tar.xz
cuberite-4b38e077cf8d27d1c7ef26d4148f7825c5aeaabd.tar.zst
cuberite-4b38e077cf8d27d1c7ef26d4148f7825c5aeaabd.zip
Diffstat (limited to 'lib/inifile')
-rw-r--r--lib/inifile/iniFile.cpp18
-rw-r--r--lib/inifile/iniFile.h5
2 files changed, 23 insertions, 0 deletions
diff --git a/lib/inifile/iniFile.cpp b/lib/inifile/iniFile.cpp
index 2bf6c91ed..7cfe7661f 100644
--- a/lib/inifile/iniFile.cpp
+++ b/lib/inifile/iniFile.cpp
@@ -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)
{
comments.push_back(comment);
diff --git a/lib/inifile/iniFile.h b/lib/inifile/iniFile.h
index 58fecd0cf..33229bff0 100644
--- a/lib/inifile/iniFile.h
+++ b/lib/inifile/iniFile.h
@@ -53,7 +53,9 @@ private:
/// Removes the UTF-8 BOMs (Byte order makers), if present.
void RemoveBom(AString & a_line) const;
+
public:
+
enum errors
{
noID = -1,
@@ -79,6 +81,9 @@ public:
/// Deletes all stored ini data (but doesn't touch the file)
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
int FindKey(const AString & keyname) const;