summaryrefslogtreecommitdiffstats
path: root/iniFile/iniFile.cpp
diff options
context:
space:
mode:
authorfaketruth <faketruth@0a769ca7-a7f5-676a-18bf-c427514a06d6>2012-02-01 01:02:48 +0100
committerfaketruth <faketruth@0a769ca7-a7f5-676a-18bf-c427514a06d6>2012-02-01 01:02:48 +0100
commit28bc14e267daff85d66efc9467f40ce87bfcb858 (patch)
treea2ab38d5f8805c64294905a4b65b694d6dfeacf7 /iniFile/iniFile.cpp
parentChanged how Lua handles the (Post)Params in the HTTPRequest of a WebPlugin (diff)
downloadcuberite-28bc14e267daff85d66efc9467f40ce87bfcb858.tar
cuberite-28bc14e267daff85d66efc9467f40ce87bfcb858.tar.gz
cuberite-28bc14e267daff85d66efc9467f40ce87bfcb858.tar.bz2
cuberite-28bc14e267daff85d66efc9467f40ce87bfcb858.tar.lz
cuberite-28bc14e267daff85d66efc9467f40ce87bfcb858.tar.xz
cuberite-28bc14e267daff85d66efc9467f40ce87bfcb858.tar.zst
cuberite-28bc14e267daff85d66efc9467f40ce87bfcb858.zip
Diffstat (limited to 'iniFile/iniFile.cpp')
-rw-r--r--iniFile/iniFile.cpp22
1 files changed, 15 insertions, 7 deletions
diff --git a/iniFile/iniFile.cpp b/iniFile/iniFile.cpp
index f4381c64f..d1c15df16 100644
--- a/iniFile/iniFile.cpp
+++ b/iniFile/iniFile.cpp
@@ -342,6 +342,20 @@ unsigned cIniFile::GetValueV( const string & keyname, const string & valuename,
return nVals;
}
+bool cIniFile::DeleteValueByID( const unsigned keyID, const unsigned valueID )
+{
+ if ( keyID < keys.size() && valueID < keys[keyID].names.size())
+ {
+ // This looks strange, but is neccessary.
+ vector<string>::iterator npos = keys[keyID].names.begin() + valueID;
+ vector<string>::iterator vpos = keys[keyID].values.begin() + valueID;
+ keys[keyID].names.erase( npos, npos + 1);
+ keys[keyID].values.erase( vpos, vpos + 1);
+ return true;
+ }
+ return false;
+}
+
bool cIniFile::DeleteValue( const string & keyname, const string & valuename)
{
long keyID = FindKey( keyname);
@@ -352,13 +366,7 @@ bool cIniFile::DeleteValue( const string & keyname, const string & valuename)
if ( valueID == noID)
return false;
- // This looks strange, but is neccessary.
- vector<string>::iterator npos = keys[keyID].names.begin() + valueID;
- vector<string>::iterator vpos = keys[keyID].values.begin() + valueID;
- keys[keyID].names.erase( npos, npos + 1);
- keys[keyID].values.erase( vpos, vpos + 1);
-
- return true;
+ return DeleteValueByID( keyID, valueID );
}
bool cIniFile::DeleteKey( const string & keyname)