summaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authormadmaxoft <github@xoft.cz>2014-07-31 23:17:49 +0200
committermadmaxoft <github@xoft.cz>2014-07-31 23:17:49 +0200
commit6d02fce9a26d4272baea08dc58238321cca0183a (patch)
tree0109076ae52c67513259d7946a44b9f7b5a563fb /lib
parentRemoved trailing whitespace. (diff)
parentMerge pull request #1267 from mc-server/RoofedForest (diff)
downloadcuberite-6d02fce9a26d4272baea08dc58238321cca0183a.tar
cuberite-6d02fce9a26d4272baea08dc58238321cca0183a.tar.gz
cuberite-6d02fce9a26d4272baea08dc58238321cca0183a.tar.bz2
cuberite-6d02fce9a26d4272baea08dc58238321cca0183a.tar.lz
cuberite-6d02fce9a26d4272baea08dc58238321cca0183a.tar.xz
cuberite-6d02fce9a26d4272baea08dc58238321cca0183a.tar.zst
cuberite-6d02fce9a26d4272baea08dc58238321cca0183a.zip
Diffstat (limited to 'lib')
-rw-r--r--lib/inifile/iniFile.cpp27
-rw-r--r--lib/inifile/iniFile.h2
2 files changed, 29 insertions, 0 deletions
diff --git a/lib/inifile/iniFile.cpp b/lib/inifile/iniFile.cpp
index ea03f5d35..2bf6c91ed 100644
--- a/lib/inifile/iniFile.cpp
+++ b/lib/inifile/iniFile.cpp
@@ -447,6 +447,15 @@ bool cIniFile::SetValueI(const AString & a_KeyName, const AString & a_ValueName,
+bool cIniFile::SetValueI(const AString & a_Keyname, const AString & a_ValueName, const Int64 a_Value, const bool a_CreateIfNotExists)
+{
+ return SetValue(a_Keyname, a_ValueName, Printf("%lld", a_Value), a_CreateIfNotExists);
+}
+
+
+
+
+
bool cIniFile::SetValueF(const AString & a_KeyName, const AString & a_ValueName, double const a_Value, const bool a_CreateIfNotExists)
{
return SetValue(a_KeyName, a_ValueName, Printf("%f", a_Value), a_CreateIfNotExists);
@@ -571,6 +580,24 @@ int cIniFile::GetValueSetI(const AString & keyname, const AString & valuename, c
+Int64 cIniFile::GetValueSetI(const AString & keyname, const AString & valuename, const Int64 defValue)
+{
+ AString Data;
+ Printf(Data, "%lld", defValue);
+ AString resultstring = GetValueSet(keyname, valuename, Data);
+ Int64 result = defValue;
+#ifdef _WIN32
+ sscanf_s(resultstring.c_str(), "%lld", &result);
+#else
+ sscanf(resultstring.c_str(), "%lld", &result);
+#endif
+ return result;
+}
+
+
+
+
+
bool cIniFile::DeleteValueByID(const int keyID, const int valueID)
{
if ((keyID < (int)keys.size()) && (valueID < (int)keys[keyID].names.size()))
diff --git a/lib/inifile/iniFile.h b/lib/inifile/iniFile.h
index 0bf1d917e..58fecd0cf 100644
--- a/lib/inifile/iniFile.h
+++ b/lib/inifile/iniFile.h
@@ -119,6 +119,7 @@ public:
AString GetValueSet (const AString & keyname, const AString & valuename, const AString & defValue = "");
double GetValueSetF(const AString & keyname, const AString & valuename, const double defValue = 0.0);
int GetValueSetI(const AString & keyname, const AString & valuename, const int defValue = 0);
+ Int64 GetValueSetI(const AString & keyname, const AString & valuename, const Int64 defValue = 0);
bool GetValueSetB(const AString & keyname, const AString & valuename, const bool defValue = false)
{
return (GetValueSetI(keyname, valuename, defValue ? 1 : 0) != 0);
@@ -141,6 +142,7 @@ public:
bool SetValue (const int keyID, const int valueID, const AString & value);
bool SetValue (const AString & a_KeyName, const AString & a_ValueName, const AString & a_Value, const bool a_CreateIfNotExists = true);
bool SetValueI(const AString & a_KeyName, const AString & a_ValueName, const int a_Value, const bool a_CreateIfNotExists = true);
+ bool SetValueI(const AString & a_Keyname, const AString & a_ValueName, const Int64 a_Value, const bool a_CreateIfNotExists = true);
bool SetValueB(const AString & a_KeyName, const AString & a_ValueName, const bool a_Value, const bool a_CreateIfNotExists = true)
{
return SetValueI(a_KeyName, a_ValueName, int(a_Value), a_CreateIfNotExists);