diff options
author | madmaxoft <github@xoft.cz> | 2013-10-25 11:38:14 +0200 |
---|---|---|
committer | madmaxoft <github@xoft.cz> | 2013-10-25 11:38:14 +0200 |
commit | 323ebf119f35dc2bb689715a05f182238d7088f8 (patch) | |
tree | 8dfc7fbbb457da1a6cce38da1de7ba155a4671f6 | |
parent | cIniFile doesn't store filename internally anymore. (diff) | |
download | cuberite-323ebf119f35dc2bb689715a05f182238d7088f8.tar cuberite-323ebf119f35dc2bb689715a05f182238d7088f8.tar.gz cuberite-323ebf119f35dc2bb689715a05f182238d7088f8.tar.bz2 cuberite-323ebf119f35dc2bb689715a05f182238d7088f8.tar.lz cuberite-323ebf119f35dc2bb689715a05f182238d7088f8.tar.xz cuberite-323ebf119f35dc2bb689715a05f182238d7088f8.tar.zst cuberite-323ebf119f35dc2bb689715a05f182238d7088f8.zip |
Diffstat (limited to '')
-rw-r--r-- | iniFile/iniFile.cpp | 202 | ||||
-rw-r--r-- | iniFile/iniFile.h | 128 | ||||
-rw-r--r-- | source/Bindings.cpp | 562 | ||||
-rw-r--r-- | source/Bindings.h | 2 | ||||
-rw-r--r-- | source/BlockID.cpp | 8 | ||||
-rw-r--r-- | source/MonsterConfig.cpp | 4 |
6 files changed, 322 insertions, 584 deletions
diff --git a/iniFile/iniFile.cpp b/iniFile/iniFile.cpp index 06f5e5592..da523e783 100644 --- a/iniFile/iniFile.cpp +++ b/iniFile/iniFile.cpp @@ -56,9 +56,9 @@ bool cIniFile::ReadFile(const AString & a_FileName, bool a_AllowExampleRedirect) // Normally you would use ifstream, but the SGI CC compiler has // a few bugs with ifstream. So ... fstream used. fstream f; - string line; - string keyname, valuename, value; - string::size_type pLeft, pRight; + AString line; + AString keyname, valuename, value; + AString::size_type pLeft, pRight; bool IsFromExampleRedirect = false; f.open((FILE_IO_PREFIX + a_FileName).c_str(), ios::in); @@ -68,7 +68,7 @@ bool cIniFile::ReadFile(const AString & a_FileName, bool a_AllowExampleRedirect) if (a_AllowExampleRedirect) { // Retry with the .example.ini file instead of .ini: - string ExPath(a_FileName.substr(0, a_FileName.length() - 4)); + AString ExPath(a_FileName.substr(0, a_FileName.length() - 4)); ExPath.append(".example.ini"); f.open((FILE_IO_PREFIX + ExPath).c_str(), ios::in); if (f.fail()) @@ -90,7 +90,7 @@ bool cIniFile::ReadFile(const AString & a_FileName, bool a_AllowExampleRedirect) // Note that the '\r' will be written to INI files from // Unix so that the created INI file can be read under Win32 // without change. - unsigned int lineLength = line.length(); + size_t lineLength = line.length(); if (lineLength == 0) { continue; @@ -113,7 +113,7 @@ bool cIniFile::ReadFile(const AString & a_FileName, bool a_AllowExampleRedirect) f.close(); return false; } - if ((pLeft = line.find_first_of(";#[=")) == string::npos) + if ((pLeft = line.find_first_of(";#[=")) == AString::npos) { continue; } @@ -123,7 +123,7 @@ bool cIniFile::ReadFile(const AString & a_FileName, bool a_AllowExampleRedirect) case '[': { if ( - ((pRight = line.find_last_of("]")) != string::npos) && + ((pRight = line.find_last_of("]")) != AString::npos) && (pRight > pLeft) ) { @@ -146,11 +146,11 @@ bool cIniFile::ReadFile(const AString & a_FileName, bool a_AllowExampleRedirect) { if (names.size() == 0) { - HeaderComment(line.substr(pLeft + 1)); + AddHeaderComment(line.substr(pLeft + 1)); } else { - KeyComment(keyname, line.substr(pLeft + 1)); + AddKeyComment(keyname, line.substr(pLeft + 1)); } break; } @@ -176,7 +176,6 @@ bool cIniFile::ReadFile(const AString & a_FileName, bool a_AllowExampleRedirect) bool cIniFile::WriteFile(const AString & a_FileName) const { - unsigned commentID, keyID, valueID; // Normally you would use ofstream, but the SGI CC compiler has // a few bugs with ofstream. So ... fstream used. fstream f; @@ -188,28 +187,29 @@ bool cIniFile::WriteFile(const AString & a_FileName) const } // Write header comments. - for (commentID = 0; commentID < comments.size(); ++commentID) + size_t NumComments = comments.size(); + for (size_t commentID = 0; commentID < NumComments; ++commentID) { f << ';' << comments[commentID] << iniEOL; } - if (comments.size()) + if (NumComments > 0) { f << iniEOL; } // Write keys and values. - for (keyID = 0; keyID < keys.size(); ++keyID) + for (size_t keyID = 0; keyID < keys.size(); ++keyID) { f << '[' << names[keyID] << ']' << iniEOL; // Comments. - for (commentID = 0; commentID < keys[keyID].comments.size(); ++commentID) + for (size_t commentID = 0; commentID < keys[keyID].comments.size(); ++commentID) { f << ';' << keys[keyID].comments[commentID] << iniEOL; } // Values. - for (valueID = 0; valueID < keys[keyID].names.size(); ++valueID) + for (size_t valueID = 0; valueID < keys[keyID].names.size(); ++valueID) { f << keys[keyID].names[valueID] << '=' << keys[keyID].values[valueID] << iniEOL; } @@ -224,14 +224,14 @@ bool cIniFile::WriteFile(const AString & a_FileName) const -long cIniFile::FindKey(const string & a_KeyName) const +int cIniFile::FindKey(const AString & a_KeyName) const { - string CaseKeyName = CheckCase(a_KeyName); - for (unsigned keyID = 0; keyID < names.size(); ++keyID) + AString CaseKeyName = CheckCase(a_KeyName); + for (size_t keyID = 0; keyID < names.size(); ++keyID) { if (CheckCase(names[keyID]) == CaseKeyName) { - return long(keyID); + return keyID; } } return noID; @@ -241,19 +241,19 @@ long cIniFile::FindKey(const string & a_KeyName) const -long cIniFile::FindValue(unsigned const keyID, const string & a_ValueName) const +int cIniFile::FindValue(const int keyID, const AString & a_ValueName) const { - if (!keys.size() || (keyID >= keys.size())) + if (!keys.size() || (keyID >= (int)keys.size())) { return noID; } - string CaseValueName = CheckCase(a_ValueName); - for (unsigned valueID = 0; valueID < keys[keyID].names.size(); ++valueID) + AString CaseValueName = CheckCase(a_ValueName); + for (size_t valueID = 0; valueID < keys[keyID].names.size(); ++valueID) { if (CheckCase(keys[keyID].names[valueID]) == CaseValueName) { - return long(valueID); + return int(valueID); } } return noID; @@ -263,7 +263,7 @@ long cIniFile::FindValue(unsigned const keyID, const string & a_ValueName) const -unsigned cIniFile::AddKeyName(const string & keyname) +int cIniFile::AddKeyName(const AString & keyname) { names.resize(names.size() + 1, keyname); keys.resize(keys.size() + 1); @@ -274,9 +274,9 @@ unsigned cIniFile::AddKeyName(const string & keyname) -string cIniFile::KeyName(unsigned const keyID) const +AString cIniFile::GetKeyName(const int keyID) const { - if (keyID < names.size()) + if (keyID < (int)names.size()) { return names[keyID]; } @@ -290,11 +290,11 @@ string cIniFile::KeyName(unsigned const keyID) const -unsigned cIniFile::NumValues(unsigned const keyID) +int cIniFile::GetNumValues(const int keyID) const { - if (keyID < keys.size()) + if (keyID < (int)keys.size()) { - return keys[keyID].names.size(); + return (int)keys[keyID].names.size(); } return 0; } @@ -303,23 +303,23 @@ unsigned cIniFile::NumValues(unsigned const keyID) -unsigned cIniFile::NumValues(const string & keyname) +int cIniFile::GetNumValues(const AString & keyname) const { - long keyID = FindKey(keyname); + int keyID = FindKey(keyname); if (keyID == noID) { return 0; } - return keys[keyID].names.size(); + return (int)keys[keyID].names.size(); } -string cIniFile::ValueName(unsigned const keyID, unsigned const valueID) const +AString cIniFile::GetValueName(const int keyID, const int valueID) const { - if (keyID < keys.size() && valueID < keys[keyID].names.size()) + if ((keyID < (int)keys.size()) && (valueID < (int)keys[keyID].names.size())) { return keys[keyID].names[valueID]; } @@ -330,23 +330,23 @@ string cIniFile::ValueName(unsigned const keyID, unsigned const valueID) const -string cIniFile::ValueName(const string & keyname, unsigned const valueID) const +AString cIniFile::GetValueName(const AString & keyname, const int valueID) const { - long keyID = FindKey(keyname); + int keyID = FindKey(keyname); if (keyID == noID) { return ""; } - return ValueName(keyID, valueID); + return GetValueName(keyID, valueID); } -bool cIniFile::SetValue(unsigned const keyID, unsigned const valueID, const string & value) +bool cIniFile::SetValue(const int keyID, const int valueID, const AString & value) { - if ((keyID < keys.size()) && (valueID < keys[keyID].names.size())) + if ((keyID < (int)keys.size()) && (valueID < (int)keys[keyID].names.size())) { keys[keyID].values[valueID] = value; } @@ -357,14 +357,14 @@ bool cIniFile::SetValue(unsigned const keyID, unsigned const valueID, const stri -bool cIniFile::SetValue(const string & keyname, const string & valuename, const string & value, bool const create) +bool cIniFile::SetValue(const AString & keyname, const AString & valuename, const AString & value, bool const create) { - long keyID = FindKey(keyname); + int keyID = FindKey(keyname); if (keyID == noID) { if (create) { - keyID = long(AddKeyName(keyname)); + keyID = int(AddKeyName(keyname)); } else { @@ -372,7 +372,7 @@ bool cIniFile::SetValue(const string & keyname, const string & valuename, const } } - long valueID = FindValue(unsigned(keyID), valuename); + int valueID = FindValue(int(keyID), valuename); if (valueID == noID) { if (!create) @@ -402,7 +402,7 @@ bool cIniFile::SetValue(const string & keyname, const string & valuename, const -bool cIniFile::SetValueI(const string & keyname, const string & valuename, int const value, bool const create) +bool cIniFile::SetValueI(const AString & keyname, const AString & valuename, const int value, bool const create) { AString Data; Printf(Data, "%d", value); @@ -413,7 +413,7 @@ bool cIniFile::SetValueI(const string & keyname, const string & valuename, int c -bool cIniFile::SetValueF(const string & keyname, const string & valuename, double const value, bool const create) +bool cIniFile::SetValueF(const AString & keyname, const AString & valuename, double const value, bool const create) { AString Data; Printf(Data, "%f", value); @@ -424,7 +424,7 @@ bool cIniFile::SetValueF(const string & keyname, const string & valuename, doubl -bool cIniFile::SetValueV(const string & keyname, const string & valuename, char * format, ...) +bool cIniFile::SetValueV(const AString & keyname, const AString & valuename, char * format, ...) { va_list args; va_start(args, format); @@ -439,9 +439,9 @@ bool cIniFile::SetValueV(const string & keyname, const string & valuename, char -string cIniFile::GetValue(unsigned const keyID, unsigned const valueID, const string & defValue) const +AString cIniFile::GetValue(const int keyID, const int valueID, const AString & defValue) const { - if ((keyID < keys.size()) && (valueID < keys[keyID].names.size())) + if ((keyID < (int)keys.size()) && (valueID < (int)keys[keyID].names.size())) { return keys[keyID].values[valueID]; } @@ -452,15 +452,15 @@ string cIniFile::GetValue(unsigned const keyID, unsigned const valueID, const st -string cIniFile::GetValue(const string & keyname, const string & valuename, const string & defValue) const +AString cIniFile::GetValue(const AString & keyname, const AString & valuename, const AString & defValue) const { - long keyID = FindKey(keyname); + int keyID = FindKey(keyname); if (keyID == noID) { return defValue; } - long valueID = FindValue(unsigned(keyID), valuename); + int valueID = FindValue(int(keyID), valuename); if (valueID == noID) { return defValue; @@ -473,7 +473,7 @@ string cIniFile::GetValue(const string & keyname, const string & valuename, cons -int cIniFile::GetValueI(const string & keyname, const string & valuename, int const defValue) const +int cIniFile::GetValueI(const AString & keyname, const AString & valuename, const int defValue) const { AString Data; Printf(Data, "%d", defValue); @@ -484,7 +484,7 @@ int cIniFile::GetValueI(const string & keyname, const string & valuename, int co -double cIniFile::GetValueF(const string & keyname, const string & valuename, double const defValue) const +double cIniFile::GetValueF(const AString & keyname, const AString & valuename, double const defValue) const { AString Data; Printf(Data, "%f", defValue); @@ -497,14 +497,14 @@ double cIniFile::GetValueF(const string & keyname, const string & valuename, dou AString cIniFile::GetValueSet(const AString & keyname, const AString & valuename, const AString & defValue) { - long keyID = FindKey(keyname); + int keyID = FindKey(keyname); if (keyID == noID) { SetValue(keyname, valuename, defValue); return defValue; } - long valueID = FindValue(unsigned(keyID), valuename); + int valueID = FindValue(int(keyID), valuename); if (valueID == noID) { SetValue(keyname, valuename, defValue); @@ -540,13 +540,13 @@ int cIniFile::GetValueSetI(const AString & keyname, const AString & valuename, c -bool cIniFile::DeleteValueByID(const unsigned keyID, const unsigned valueID) +bool cIniFile::DeleteValueByID(const int keyID, const int valueID) { - if (keyID < keys.size() && valueID < keys[keyID].names.size()) + if ((keyID < (int)keys.size()) && (valueID < (int)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; + vector<AString>::iterator npos = keys[keyID].names.begin() + valueID; + vector<AString>::iterator vpos = keys[keyID].values.begin() + valueID; keys[keyID].names.erase(npos, npos + 1); keys[keyID].values.erase(vpos, vpos + 1); return true; @@ -558,15 +558,15 @@ bool cIniFile::DeleteValueByID(const unsigned keyID, const unsigned valueID) -bool cIniFile::DeleteValue(const string & keyname, const string & valuename) +bool cIniFile::DeleteValue(const AString & keyname, const AString & valuename) { - long keyID = FindKey(keyname); + int keyID = FindKey(keyname); if (keyID == noID) { return false; } - long valueID = FindValue(unsigned(keyID), valuename); + int valueID = FindValue(int(keyID), valuename); if (valueID == noID) { return false; @@ -579,15 +579,15 @@ bool cIniFile::DeleteValue(const string & keyname, const string & valuename) -bool cIniFile::DeleteKey(const string & keyname) +bool cIniFile::DeleteKey(const AString & keyname) { - long keyID = FindKey(keyname); + int keyID = FindKey(keyname); if (keyID == noID) { return false; } - vector<string>::iterator npos = names.begin() + keyID; + vector<AString>::iterator npos = names.begin() + keyID; vector<key>::iterator kpos = keys.begin() + keyID; names.erase(npos, npos + 1); keys.erase(kpos, kpos + 1); @@ -610,7 +610,7 @@ void cIniFile::Clear(void) -void cIniFile::HeaderComment(const string & comment) +void cIniFile::AddHeaderComment(const AString & comment) { comments.push_back(comment); // comments.resize(comments.size() + 1, comment); @@ -620,9 +620,9 @@ void cIniFile::HeaderComment(const string & comment) -string cIniFile::HeaderComment(unsigned const commentID) const +AString cIniFile::GetHeaderComment(const int commentID) const { - if (commentID < comments.size()) + if (commentID < (int)comments.size()) { return comments[commentID]; } @@ -633,11 +633,11 @@ string cIniFile::HeaderComment(unsigned const commentID) const -bool cIniFile::DeleteHeaderComment(unsigned commentID) +bool cIniFile::DeleteHeaderComment(int commentID) { - if (commentID < comments.size()) + if (commentID < (int)comments.size()) { - vector<string>::iterator cpos = comments.begin() + commentID; + vector<AString>::iterator cpos = comments.begin() + commentID; comments.erase(cpos, cpos + 1); return true; } @@ -648,9 +648,9 @@ bool cIniFile::DeleteHeaderComment(unsigned commentID) -unsigned cIniFile::NumKeyComments(unsigned const keyID) const +int cIniFile::GetNumKeyComments(const int keyID) const { - if (keyID < keys.size()) + if (keyID < (int)keys.size()) { return keys[keyID].comments.size(); } @@ -661,21 +661,23 @@ unsigned cIniFile::NumKeyComments(unsigned const keyID) const -unsigned cIniFile::NumKeyComments(const string & keyname) const +int cIniFile::GetNumKeyComments(const AString & keyname) const { - long keyID = FindKey(keyname); + int keyID = FindKey(keyname); if (keyID == noID) + { return 0; - return keys[keyID].comments.size(); + } + return (int)keys[keyID].comments.size(); } -bool cIniFile::KeyComment(unsigned const keyID, const string & comment) +bool cIniFile::AddKeyComment(const int keyID, const AString & comment) { - if (keyID < keys.size()) + if (keyID < (int)keys.size()) { keys[keyID].comments.resize(keys[keyID].comments.size() + 1, comment); return true; @@ -687,23 +689,23 @@ bool cIniFile::KeyComment(unsigned const keyID, const string & comment) -bool cIniFile::KeyComment(const string & keyname, const string & comment) +bool cIniFile::AddKeyComment(const AString & keyname, const AString & comment) { - long keyID = FindKey(keyname); + int keyID = FindKey(keyname); if (keyID == noID) { return false; } - return KeyComment(unsigned(keyID), comment); + return AddKeyComment(keyID, comment); } -string cIniFile::KeyComment(unsigned const keyID, unsigned const commentID) const +AString cIniFile::GetKeyComment(const int keyID, const int commentID) const { - if ((keyID < keys.size()) && (commentID < keys[keyID].comments.size())) + if ((keyID < (int)keys.size()) && (commentID < (int)keys[keyID].comments.size())) { return keys[keyID].comments[commentID]; } @@ -714,25 +716,25 @@ string cIniFile::KeyComment(unsigned const keyID, unsigned const commentID) cons -string cIniFile::KeyComment(const string & keyname, unsigned const commentID) const +AString cIniFile::GetKeyComment(const AString & keyname, const int commentID) const { - long keyID = FindKey(keyname); + int keyID = FindKey(keyname); if (keyID == noID) { return ""; } - return KeyComment(unsigned(keyID), commentID); + return GetKeyComment(int(keyID), commentID); } -bool cIniFile::DeleteKeyComment(unsigned const keyID, unsigned const commentID) +bool cIniFile::DeleteKeyComment(const int keyID, const int commentID) { - if ((keyID < keys.size()) && (commentID < keys[keyID].comments.size())) + if ((keyID < (int)keys.size()) && (commentID < (int)keys[keyID].comments.size())) { - vector<string>::iterator cpos = keys[keyID].comments.begin() + commentID; + vector<AString>::iterator cpos = keys[keyID].comments.begin() + commentID; keys[keyID].comments.erase(cpos, cpos + 1); return true; } @@ -743,23 +745,23 @@ bool cIniFile::DeleteKeyComment(unsigned const keyID, unsigned const commentID) -bool cIniFile::DeleteKeyComment(const string & keyname, unsigned const commentID) +bool cIniFile::DeleteKeyComment(const AString & keyname, const int commentID) { - long keyID = FindKey(keyname); + int keyID = FindKey(keyname); if (keyID == noID) { return false; } - return DeleteKeyComment(unsigned(keyID), commentID); + return DeleteKeyComment(int(keyID), commentID); } -bool cIniFile::DeleteKeyComments(unsigned const keyID) +bool cIniFile::DeleteKeyComments(const int keyID) { - if (keyID < keys.size()) + if (keyID < (int)keys.size()) { keys[keyID].comments.clear(); return true; @@ -771,27 +773,27 @@ bool cIniFile::DeleteKeyComments(unsigned const keyID) -bool cIniFile::DeleteKeyComments(const string & keyname) +bool cIniFile::DeleteKeyComments(const AString & keyname) { - long keyID = FindKey(keyname); + int keyID = FindKey(keyname); if (keyID == noID) { return false; } - return DeleteKeyComments(unsigned(keyID)); + return DeleteKeyComments(int(keyID)); } -string cIniFile::CheckCase(const string & s) const +AString cIniFile::CheckCase(const AString & s) const { if (!m_IsCaseInsensitive) { return s; } - string res(s); + AString res(s); size_t len = res.length(); for (size_t i = 0; i < len; i++) { diff --git a/iniFile/iniFile.h b/iniFile/iniFile.h index 70342604f..223e0237f 100644 --- a/iniFile/iniFile.h +++ b/iniFile/iniFile.h @@ -39,17 +39,17 @@ private: struct key { - std::vector<std::string> names; - std::vector<std::string> values; - std::vector<std::string> comments; + std::vector<AString> names; + std::vector<AString> values; + std::vector<AString> comments; } ; - std::vector<key> keys; - std::vector<std::string> names; - std::vector<std::string> comments; + std::vector<key> keys; + std::vector<AString> names; + std::vector<AString> comments; /// If the object is case-insensitive, returns s as lowercase; otherwise returns s as-is - std::string CheckCase(const std::string & s) const; + AString CheckCase(const AString & s) const; public: enum errors @@ -77,54 +77,40 @@ public: /// Deletes all stored ini data (but doesn't touch the file) void Clear(void); - void Reset(void) { Clear(); } - void Erase(void) { Clear(); } // OBSOLETE, this name is misguiding and will be removed from the interface /// Returns index of specified key, or noID if not found - long FindKey(const std::string & keyname) const; + int FindKey(const AString & keyname) const; /// Returns index of specified value, in the specified key, or noID if not found - long FindValue(const unsigned keyID, const std::string & valuename) const; + int FindValue(const int keyID, const AString & valuename) const; /// Returns number of keys currently in the ini - unsigned NumKeys (void) const {return names.size();} - unsigned GetNumKeys(void) const {return NumKeys();} + int GetNumKeys(void) const { return (int)keys.size(); } /// Add a key name - unsigned AddKeyName(const std::string & keyname); + int AddKeyName(const AString & keyname); // Returns key names by index. - std::string KeyName(const unsigned keyID) const; - std::string GetKeyName(const unsigned keyID) const {return KeyName(keyID);} + AString GetKeyName(const int keyID) const; // Returns number of values stored for specified key. - unsigned NumValues (const std::string & keyname); - unsigned GetNumValues(const std::string & keyname) {return NumValues(keyname);} - unsigned NumValues (const unsigned keyID); - unsigned GetNumValues(const unsigned keyID) {return NumValues(keyID);} + int GetNumValues(const AString & keyname) const; + int GetNumValues(const int keyID) const; // Returns value name by index for a given keyname or keyID. - std::string ValueName( const std::string & keyname, const unsigned valueID) const; - std::string GetValueName( const std::string & keyname, const unsigned valueID) const - { - return ValueName(keyname, valueID); - } - std::string ValueName (const unsigned keyID, const unsigned valueID) const; - std::string GetValueName(const unsigned keyID, const unsigned valueID) const - { - return ValueName(keyID, valueID); - } + AString GetValueName(const AString & keyname, const int valueID) const; + AString GetValueName(const int keyID, const int valueID) const; // Gets value of [keyname] valuename =. // Overloaded to return string, int, and double. // Returns defValue if key/value not found. AString GetValue (const AString & keyname, const AString & valuename, const AString & defValue = "") const; - AString GetValue (const unsigned keyID, const unsigned valueID, const AString & defValue = "") const; + AString GetValue (const int keyID, const int valueID, const AString & defValue = "") const; double GetValueF(const AString & keyname, const AString & valuename, const double defValue = 0) const; int GetValueI(const AString & keyname, const AString & valuename, const int defValue = 0) const; bool GetValueB(const AString & keyname, const AString & valuename, const bool defValue = false) const { - return (GetValueI(keyname, valuename, int(defValue)) > 0); + return (GetValueI(keyname, valuename, defValue ? 1 : 0) != 0); } // Gets the value; if not found, write the default to the INI file @@ -133,50 +119,54 @@ public: int GetValueSetI(const AString & keyname, const AString & valuename, const int defValue = 0); bool GetValueSetB(const AString & keyname, const AString & valuename, const bool defValue = false) { - return (GetValueSetI(keyname, valuename, defValue ? 1 : 0) > 0); + return (GetValueSetI(keyname, valuename, defValue ? 1 : 0) != 0); } // Sets value of [keyname] valuename =. // Specify the optional paramter as false (0) if you do not want it to create // the key if it doesn't exist. Returns true if data entered, false otherwise. // Overloaded to accept string, int, and double. - bool SetValue( const unsigned keyID, const unsigned valueID, const std::string & value); - bool SetValue( const std::string & keyname, const std::string & valuename, const std::string & value, const bool create = true); - bool SetValueI( const std::string & keyname, const std::string & valuename, const int value, const bool create = true); - bool SetValueB( const std::string & keyname, const std::string & valuename, const bool value, const bool create = true) + bool SetValue( const int keyID, const int valueID, const AString & value); + bool SetValue( const AString & keyname, const AString & valuename, const AString & value, const bool create = true); + bool SetValueI( const AString & keyname, const AString & valuename, const int value, const bool create = true); + bool SetValueB( const AString & keyname, const AString & valuename, const bool value, const bool create = true) { return SetValueI( keyname, valuename, int(value), create); } - bool SetValueF( const std::string & keyname, const std::string & valuename, const double value, const bool create = true); + bool SetValueF( const AString & keyname, const AString & valuename, const double value, const bool create = true); // tolua_end - bool SetValueV( const std::string & keyname, const std::string & valuename, char *format, ...); + bool SetValueV( const AString & keyname, const AString & valuename, char *format, ...); // tolua_begin // Deletes specified value. // Returns true if value existed and deleted, false otherwise. - bool DeleteValueByID( const unsigned keyID, const unsigned valueID ); - bool DeleteValue( const std::string & keyname, const std::string & valuename); + bool DeleteValueByID(const int keyID, const int valueID); + bool DeleteValue(const AString & keyname, const AString & valuename); // Deletes specified key and all values contained within. // Returns true if key existed and deleted, false otherwise. - bool DeleteKey(const std::string & keyname); + bool DeleteKey(const AString & keyname); // Header comment functions. // Header comments are those comments before the first key. - // - // Number of header comments. - unsigned NumHeaderComments(void) {return comments.size();} - // Add a header comment. - void HeaderComment(const std::string & comment); - // Return a header comment. - std::string HeaderComment(const unsigned commentID) const; - // Delete a header comment. - bool DeleteHeaderComment(unsigned commentID); - // Delete all header comments. - void DeleteHeaderComments(void) {comments.clear();} + + /// Get number of header comments + int GetNumHeaderComments(void) {return (int)comments.size();} + + /// Add a header comment + void AddHeaderComment(const AString & comment); + + /// Return a header comment + AString GetHeaderComment(const int commentID) const; + + /// Delete a header comment. + bool DeleteHeaderComment(int commentID); + + /// Delete all header comments. + void DeleteHeaderComments(void) {comments.clear();} // Key comment functions. @@ -184,26 +174,30 @@ public: // defined within value names will be added to this list. Therefore, // these comments will be moved to the top of the key definition when // the CIniFile::WriteFile() is called. - // - // Number of key comments. - unsigned NumKeyComments( const unsigned keyID) const; - unsigned NumKeyComments( const std::string & keyname) const; + + /// Get number of key comments + int GetNumKeyComments(const int keyID) const; + + /// Get number of key comments + int GetNumKeyComments(const AString & keyname) const; - // Add a key comment. - bool KeyComment(const unsigned keyID, const std::string & comment); - bool KeyComment(const std::string & keyname, const std::string & comment); + /// Add a key comment + bool AddKeyComment(const int keyID, const AString & comment); + + /// Add a key comment + bool AddKeyComment(const AString & keyname, const AString & comment); - // Return a key comment. - std::string KeyComment(const unsigned keyID, const unsigned commentID) const; - std::string KeyComment(const std::string & keyname, const unsigned commentID) const; + /// Return a key comment + AString GetKeyComment(const int keyID, const int commentID) const; + AString GetKeyComment(const AString & keyname, const int commentID) const; // Delete a key comment. - bool DeleteKeyComment(const unsigned keyID, const unsigned commentID); - bool DeleteKeyComment(const std::string & keyname, const unsigned commentID); + bool DeleteKeyComment(const int keyID, const int commentID); + bool DeleteKeyComment(const AString & keyname, const int commentID); // Delete all comments for a key. - bool DeleteKeyComments(const unsigned keyID); - bool DeleteKeyComments(const std::string & keyname); + bool DeleteKeyComments(const int keyID); + bool DeleteKeyComments(const AString & keyname); }; // tolua_end diff --git a/source/Bindings.cpp b/source/Bindings.cpp index f32f796bd..5de3a3b38 100644 --- a/source/Bindings.cpp +++ b/source/Bindings.cpp @@ -1,6 +1,6 @@ /* ** Lua binding: AllToLua -** Generated automatically by tolua++-1.0.92 on 10/25/13 10:38:50. +** Generated automatically by tolua++-1.0.92 on 10/25/13 11:34:58. */ #ifndef __cplusplus @@ -230,7 +230,7 @@ static void tolua_reg_types (lua_State* tolua_S) tolua_usertype(tolua_S,"cRoot"); tolua_usertype(tolua_S,"std::vector<cIniFile::key>"); tolua_usertype(tolua_S,"cPickup"); - tolua_usertype(tolua_S,"cItems"); + tolua_usertype(tolua_S,"sWebAdminPage"); tolua_usertype(tolua_S,"cFireChargeEntity"); tolua_usertype(tolua_S,"cWorld"); tolua_usertype(tolua_S,"cChunkDesc"); @@ -253,39 +253,39 @@ static void tolua_reg_types (lua_State* tolua_S) tolua_usertype(tolua_S,"cLuaWindow"); tolua_usertype(tolua_S,"cInventory"); tolua_usertype(tolua_S,"cHopperEntity"); + tolua_usertype(tolua_S,"std::vector<AString>"); tolua_usertype(tolua_S,"cBlockEntityWithItems"); tolua_usertype(tolua_S,"cWindow"); - tolua_usertype(tolua_S,"cGroup"); tolua_usertype(tolua_S,"HTTPFormData"); - tolua_usertype(tolua_S,"cCraftingGrid"); + tolua_usertype(tolua_S,"cGroup"); tolua_usertype(tolua_S,"cArrowEntity"); tolua_usertype(tolua_S,"cDropSpenserEntity"); + tolua_usertype(tolua_S,"cCraftingGrid"); + tolua_usertype(tolua_S,"cPlayer"); tolua_usertype(tolua_S,"cBlockArea"); tolua_usertype(tolua_S,"cTracer"); tolua_usertype(tolua_S,"cStringMap"); - tolua_usertype(tolua_S,"cBoundingBox"); - tolua_usertype(tolua_S,"cServer"); tolua_usertype(tolua_S,"cBlockEntity"); tolua_usertype(tolua_S,"cCriticalSection"); tolua_usertype(tolua_S,"HTTPTemplateRequest"); + tolua_usertype(tolua_S,"cBoundingBox"); + tolua_usertype(tolua_S,"cServer"); tolua_usertype(tolua_S,"Vector3i"); tolua_usertype(tolua_S,"cFile"); - tolua_usertype(tolua_S,"std::vector<std::string>"); + tolua_usertype(tolua_S,"cItems"); tolua_usertype(tolua_S,"cClientHandle"); + tolua_usertype(tolua_S,"cIniFile"); tolua_usertype(tolua_S,"cChatColor"); tolua_usertype(tolua_S,"cWebPlugin"); - tolua_usertype(tolua_S,"cIniFile"); - tolua_usertype(tolua_S,"cWebAdmin"); - tolua_usertype(tolua_S,"sWebAdminPage"); tolua_usertype(tolua_S,"cPawn"); - tolua_usertype(tolua_S,"cPlayer"); + tolua_usertype(tolua_S,"cThrownEggEntity"); tolua_usertype(tolua_S,"cGroupManager"); + tolua_usertype(tolua_S,"cWebAdmin"); tolua_usertype(tolua_S,"cItem"); - tolua_usertype(tolua_S,"HTTPRequest"); tolua_usertype(tolua_S,"cProjectileEntity"); + tolua_usertype(tolua_S,"HTTPRequest"); tolua_usertype(tolua_S,"cItemGrid::cListener"); tolua_usertype(tolua_S,"cDropperEntity"); - tolua_usertype(tolua_S,"cThrownEggEntity"); } /* method: new of class cIniFile */ @@ -510,68 +510,6 @@ static int tolua_AllToLua_cIniFile_Clear00(lua_State* tolua_S) } #endif //#ifndef TOLUA_DISABLE -/* method: Reset of class cIniFile */ -#ifndef TOLUA_DISABLE_tolua_AllToLua_cIniFile_Reset00 -static int tolua_AllToLua_cIniFile_Reset00(lua_State* tolua_S) -{ -#ifndef TOLUA_RELEASE - tolua_Error tolua_err; - if ( - !tolua_isusertype(tolua_S,1,"cIniFile",0,&tolua_err) || - !tolua_isnoobj(tolua_S,2,&tolua_err) - ) - goto tolua_lerror; - else -#endif - { - cIniFile* self = (cIniFile*) tolua_tousertype(tolua_S,1,0); -#ifndef TOLUA_RELEASE - if (!self) tolua_error(tolua_S,"invalid 'self' in function 'Reset'", NULL); -#endif - { - self->Reset(); - } - } - return 0; -#ifndef TOLUA_RELEASE - tolua_lerror: - tolua_error(tolua_S,"#ferror in function 'Reset'.",&tolua_err); - return 0; -#endif -} -#endif //#ifndef TOLUA_DISABLE - -/* method: Erase of class cIniFile */ -#ifndef TOLUA_DISABLE_tolua_AllToLua_cIniFile_Erase00 -static int tolua_AllToLua_cIniFile_Erase00(lua_State* tolua_S) -{ -#ifndef TOLUA_RELEASE - tolua_Error tolua_err; - if ( - !tolua_isusertype(tolua_S,1,"cIniFile",0,&tolua_err) || - !tolua_isnoobj(tolua_S,2,&tolua_err) - ) - goto tolua_lerror; - else -#endif - { - cIniFile* self = (cIniFile*) tolua_tousertype(tolua_S,1,0); -#ifndef TOLUA_RELEASE - if (!self) tolua_error(tolua_S,"invalid 'self' in function 'Erase'", NULL); -#endif - { - self->Erase(); - } - } - return 0; -#ifndef TOLUA_RELEASE - tolua_lerror: - tolua_error(tolua_S,"#ferror in function 'Erase'.",&tolua_err); - return 0; -#endif -} -#endif //#ifndef TOLUA_DISABLE - /* method: FindKey of class cIniFile */ #ifndef TOLUA_DISABLE_tolua_AllToLua_cIniFile_FindKey00 static int tolua_AllToLua_cIniFile_FindKey00(lua_State* tolua_S) @@ -588,12 +526,12 @@ static int tolua_AllToLua_cIniFile_FindKey00(lua_State* tolua_S) #endif { const cIniFile* self = (const cIniFile*) tolua_tousertype(tolua_S,1,0); - const std::string keyname = ((const std::string) tolua_tocppstring(tolua_S,2,0)); + const AString keyname = ((const AString) tolua_tocppstring(tolua_S,2,0)); #ifndef TOLUA_RELEASE if (!self) tolua_error(tolua_S,"invalid 'self' in function 'FindKey'", NULL); #endif { - long tolua_ret = (long) self->FindKey(keyname); + int tolua_ret = (int) self->FindKey(keyname); tolua_pushnumber(tolua_S,(lua_Number)tolua_ret); tolua_pushcppstring(tolua_S,(const char*)keyname); } @@ -624,13 +562,13 @@ static int tolua_AllToLua_cIniFile_FindValue00(lua_State* tolua_S) #endif { const cIniFile* self = (const cIniFile*) tolua_tousertype(tolua_S,1,0); - const unsigned keyID = ((const unsigned) tolua_tonumber(tolua_S,2,0)); - const std::string valuename = ((const std::string) tolua_tocppstring(tolua_S,3,0)); + const int keyID = ((const int) tolua_tonumber(tolua_S,2,0)); + const AString valuename = ((const AString) tolua_tocppstring(tolua_S,3,0)); #ifndef TOLUA_RELEASE if (!self) tolua_error(tolua_S,"invalid 'self' in function 'FindValue'", NULL); #endif { - long tolua_ret = (long) self->FindValue(keyID,valuename); + int tolua_ret = (int) self->FindValue(keyID,valuename); tolua_pushnumber(tolua_S,(lua_Number)tolua_ret); tolua_pushcppstring(tolua_S,(const char*)valuename); } @@ -644,38 +582,6 @@ static int tolua_AllToLua_cIniFile_FindValue00(lua_State* tolua_S) } #endif //#ifndef TOLUA_DISABLE -/* method: NumKeys of class cIniFile */ -#ifndef TOLUA_DISABLE_tolua_AllToLua_cIniFile_NumKeys00 -static int tolua_AllToLua_cIniFile_NumKeys00(lua_State* tolua_S) -{ -#ifndef TOLUA_RELEASE - tolua_Error tolua_err; - if ( - !tolua_isusertype(tolua_S,1,"const cIniFile",0,&tolua_err) || - !tolua_isnoobj(tolua_S,2,&tolua_err) - ) - goto tolua_lerror; - else -#endif - { - const cIniFile* self = (const cIniFile*) tolua_tousertype(tolua_S,1,0); -#ifndef TOLUA_RELEASE - if (!self) tolua_error(tolua_S,"invalid 'self' in function 'NumKeys'", NULL); -#endif - { - unsigned tolua_ret = (unsigned) self->NumKeys(); - tolua_pushnumber(tolua_S,(lua_Number)tolua_ret); - } - } - return 1; -#ifndef TOLUA_RELEASE - tolua_lerror: - tolua_error(tolua_S,"#ferror in function 'NumKeys'.",&tolua_err); - return 0; -#endif -} -#endif //#ifndef TOLUA_DISABLE - /* method: GetNumKeys of class cIniFile */ #ifndef TOLUA_DISABLE_tolua_AllToLua_cIniFile_GetNumKeys00 static int tolua_AllToLua_cIniFile_GetNumKeys00(lua_State* tolua_S) @@ -695,7 +601,7 @@ static int tolua_AllToLua_cIniFile_GetNumKeys00(lua_State* tolua_S) if (!self) tolua_error(tolua_S,"invalid 'self' in function 'GetNumKeys'", NULL); #endif { - unsigned tolua_ret = (unsigned) self->GetNumKeys(); + int tolua_ret = (int) self->GetNumKeys(); tolua_pushnumber(tolua_S,(lua_Number)tolua_ret); } } @@ -724,12 +630,12 @@ static int tolua_AllToLua_cIniFile_AddKeyName00(lua_State* tolua_S) #endif { cIniFile* self = (cIniFile*) tolua_tousertype(tolua_S,1,0); - const std::string keyname = ((const std::string) tolua_tocppstring(tolua_S,2,0)); + const AString keyname = ((const AString) tolua_tocppstring(tolua_S,2,0)); #ifndef TOLUA_RELEASE if (!self) tolua_error(tolua_S,"invalid 'self' in function 'AddKeyName'", NULL); #endif { - unsigned tolua_ret = (unsigned) self->AddKeyName(keyname); + int tolua_ret = (int) self->AddKeyName(keyname); tolua_pushnumber(tolua_S,(lua_Number)tolua_ret); tolua_pushcppstring(tolua_S,(const char*)keyname); } @@ -743,40 +649,6 @@ static int tolua_AllToLua_cIniFile_AddKeyName00(lua_State* tolua_S) } #endif //#ifndef TOLUA_DISABLE -/* method: KeyName of class cIniFile */ -#ifndef TOLUA_DISABLE_tolua_AllToLua_cIniFile_KeyName00 -static int tolua_AllToLua_cIniFile_KeyName00(lua_State* tolua_S) -{ -#ifndef TOLUA_RELEASE - tolua_Error tolua_err; - if ( - !tolua_isusertype(tolua_S,1,"const cIniFile",0,&tolua_err) || - !tolua_isnumber(tolua_S,2,0,&tolua_err) || - !tolua_isnoobj(tolua_S,3,&tolua_err) - ) - goto tolua_lerror; - else -#endif - { - const cIniFile* self = (const cIniFile*) tolua_tousertype(tolua_S,1,0); - const unsigned keyID = ((const unsigned) tolua_tonumber(tolua_S,2,0)); -#ifndef TOLUA_RELEASE - if (!self) tolua_error(tolua_S,"invalid 'self' in function 'KeyName'", NULL); -#endif - { - std::string tolua_ret = (std::string) self->KeyName(keyID); - tolua_pushcppstring(tolua_S,(const char*)tolua_ret); - } - } - return 1; -#ifndef TOLUA_RELEASE - tolua_lerror: - tolua_error(tolua_S,"#ferror in function 'KeyName'.",&tolua_err); - return 0; -#endif -} -#endif //#ifndef TOLUA_DISABLE - /* method: GetKeyName of class cIniFile */ #ifndef TOLUA_DISABLE_tolua_AllToLua_cIniFile_GetKeyName00 static int tolua_AllToLua_cIniFile_GetKeyName00(lua_State* tolua_S) @@ -793,12 +665,12 @@ static int tolua_AllToLua_cIniFile_GetKeyName00(lua_State* tolua_S) #endif { const cIniFile* self = (const cIniFile*) tolua_tousertype(tolua_S,1,0); - const unsigned keyID = ((const unsigned) tolua_tonumber(tolua_S,2,0)); + const int keyID = ((const int) tolua_tonumber(tolua_S,2,0)); #ifndef TOLUA_RELEASE if (!self) tolua_error(tolua_S,"invalid 'self' in function 'GetKeyName'", NULL); #endif { - std::string tolua_ret = (std::string) self->GetKeyName(keyID); + AString tolua_ret = (AString) self->GetKeyName(keyID); tolua_pushcppstring(tolua_S,(const char*)tolua_ret); } } @@ -811,41 +683,6 @@ static int tolua_AllToLua_cIniFile_GetKeyName00(lua_State* tolua_S) } #endif //#ifndef TOLUA_DISABLE -/* method: NumValues of class cIniFile */ -#ifndef TOLUA_DISABLE_tolua_AllToLua_cIniFile_NumValues00 -static int tolua_AllToLua_cIniFile_NumValues00(lua_State* tolua_S) -{ -#ifndef TOLUA_RELEASE - tolua_Error tolua_err; - if ( - !tolua_isusertype(tolua_S,1,"cIniFile",0,&tolua_err) || - !tolua_iscppstring(tolua_S,2,0,&tolua_err) || - !tolua_isnoobj(tolua_S,3,&tolua_err) - ) - goto tolua_lerror; - else -#endif - { - cIniFile* self = (cIniFile*) tolua_tousertype(tolua_S,1,0); - const std::string keyname = ((const std::string) tolua_tocppstring(tolua_S,2,0)); -#ifndef TOLUA_RELEASE - if (!self) tolua_error(tolua_S,"invalid 'self' in function 'NumValues'", NULL); -#endif - { - unsigned tolua_ret = (unsigned) self->NumValues(keyname); - tolua_pushnumber(tolua_S,(lua_Number)tolua_ret); - tolua_pushcppstring(tolua_S,(const char*)keyname); - } - } - return 2; -#ifndef TOLUA_RELEASE - tolua_lerror: - tolua_error(tolua_S,"#ferror in function 'NumValues'.",&tolua_err); - return 0; -#endif -} -#endif //#ifndef TOLUA_DISABLE - /* method: GetNumValues of class cIniFile */ #ifndef TOLUA_DISABLE_tolua_AllToLua_cIniFile_GetNumValues00 static int tolua_AllToLua_cIniFile_GetNumValues00(lua_State* tolua_S) @@ -853,7 +690,7 @@ static int tolua_AllToLua_cIniFile_GetNumValues00(lua_State* tolua_S) #ifndef TOLUA_RELEASE tolua_Error tolua_err; if ( - !tolua_isusertype(tolua_S,1,"cIniFile",0,&tolua_err) || + !tolua_isusertype(tolua_S,1,"const cIniFile",0,&tolua_err) || !tolua_iscppstring(tolua_S,2,0,&tolua_err) || !tolua_isnoobj(tolua_S,3,&tolua_err) ) @@ -861,13 +698,13 @@ static int tolua_AllToLua_cIniFile_GetNumValues00(lua_State* tolua_S) else #endif { - cIniFile* self = (cIniFile*) tolua_tousertype(tolua_S,1,0); - const std::string keyname = ((const std::string) tolua_tocppstring(tolua_S,2,0)); + const cIniFile* self = (const cIniFile*) tolua_tousertype(tolua_S,1,0); + const AString keyname = ((const AString) tolua_tocppstring(tolua_S,2,0)); #ifndef TOLUA_RELEASE if (!self) tolua_error(tolua_S,"invalid 'self' in function 'GetNumValues'", NULL); #endif { - unsigned tolua_ret = (unsigned) self->GetNumValues(keyname); + int tolua_ret = (int) self->GetNumValues(keyname); tolua_pushnumber(tolua_S,(lua_Number)tolua_ret); tolua_pushcppstring(tolua_S,(const char*)keyname); } @@ -881,55 +718,26 @@ static int tolua_AllToLua_cIniFile_GetNumValues00(lua_State* tolua_S) } #endif //#ifndef TOLUA_DISABLE -/* method: NumValues of class cIniFile */ -#ifndef TOLUA_DISABLE_tolua_AllToLua_cIniFile_NumValues01 -static int tolua_AllToLua_cIniFile_NumValues01(lua_State* tolua_S) -{ - tolua_Error tolua_err; - if ( - !tolua_isusertype(tolua_S,1,"cIniFile",0,&tolua_err) || - !tolua_isnumber(tolua_S,2,0,&tolua_err) || - !tolua_isnoobj(tolua_S,3,&tolua_err) - ) - goto tolua_lerror; - else - { - cIniFile* self = (cIniFile*) tolua_tousertype(tolua_S,1,0); - const unsigned keyID = ((const unsigned) tolua_tonumber(tolua_S,2,0)); -#ifndef TOLUA_RELEASE - if (!self) tolua_error(tolua_S,"invalid 'self' in function 'NumValues'", NULL); -#endif - { - unsigned tolua_ret = (unsigned) self->NumValues(keyID); - tolua_pushnumber(tolua_S,(lua_Number)tolua_ret); - } - } - return 1; -tolua_lerror: - return tolua_AllToLua_cIniFile_NumValues00(tolua_S); -} -#endif //#ifndef TOLUA_DISABLE - /* method: GetNumValues of class cIniFile */ #ifndef TOLUA_DISABLE_tolua_AllToLua_cIniFile_GetNumValues01 static int tolua_AllToLua_cIniFile_GetNumValues01(lua_State* tolua_S) { tolua_Error tolua_err; if ( - !tolua_isusertype(tolua_S,1,"cIniFile",0,&tolua_err) || + !tolua_isusertype(tolua_S,1,"const cIniFile",0,&tolua_err) || !tolua_isnumber(tolua_S,2,0,&tolua_err) || !tolua_isnoobj(tolua_S,3,&tolua_err) ) goto tolua_lerror; else { - cIniFile* self = (cIniFile*) tolua_tousertype(tolua_S,1,0); - const unsigned keyID = ((const unsigned) tolua_tonumber(tolua_S,2,0)); + const cIniFile* self = (const cIniFile*) tolua_tousertype(tolua_S,1,0); + const int keyID = ((const int) tolua_tonumber(tolua_S,2,0)); #ifndef TOLUA_RELEASE if (!self) tolua_error(tolua_S,"invalid 'self' in function 'GetNumValues'", NULL); #endif { - unsigned tolua_ret = (unsigned) self->GetNumValues(keyID); + int tolua_ret = (int) self->GetNumValues(keyID); tolua_pushnumber(tolua_S,(lua_Number)tolua_ret); } } @@ -939,43 +747,6 @@ tolua_lerror: } #endif //#ifndef TOLUA_DISABLE -/* method: ValueName of class cIniFile */ -#ifndef TOLUA_DISABLE_tolua_AllToLua_cIniFile_ValueName00 -static int tolua_AllToLua_cIniFile_ValueName00(lua_State* tolua_S) -{ -#ifndef TOLUA_RELEASE - tolua_Error tolua_err; - if ( - !tolua_isusertype(tolua_S,1,"const cIniFile",0,&tolua_err) || - !tolua_iscppstring(tolua_S,2,0,&tolua_err) || - !tolua_isnumber(tolua_S,3,0,&tolua_err) || - !tolua_isnoobj(tolua_S,4,&tolua_err) - ) - goto tolua_lerror; - else -#endif - { - const cIniFile* self = (const cIniFile*) tolua_tousertype(tolua_S,1,0); - const std::string keyname = ((const std::string) tolua_tocppstring(tolua_S,2,0)); - const unsigned valueID = ((const unsigned) tolua_tonumber(tolua_S,3,0)); -#ifndef TOLUA_RELEASE - if (!self) tolua_error(tolua_S,"invalid 'self' in function 'ValueName'", NULL); -#endif - { - std::string tolua_ret = (std::string) self->ValueName(keyname,valueID); - tolua_pushcppstring(tolua_S,(const char*)tolua_ret); - tolua_pushcppstring(tolua_S,(const char*)keyname); - } - } - return 2; -#ifndef TOLUA_RELEASE - tolua_lerror: - tolua_error(tolua_S,"#ferror in function 'ValueName'.",&tolua_err); - return 0; -#endif -} -#endif //#ifndef TOLUA_DISABLE - /* method: GetValueName of class cIniFile */ #ifndef TOLUA_DISABLE_tolua_AllToLua_cIniFile_GetValueName00 static int tolua_AllToLua_cIniFile_GetValueName00(lua_State* tolua_S) @@ -993,13 +764,13 @@ static int tolua_AllToLua_cIniFile_GetValueName00(lua_State* tolua_S) #endif { const cIniFile* self = (const cIniFile*) tolua_tousertype(tolua_S,1,0); - const std::string keyname = ((const std::string) tolua_tocppstring(tolua_S,2,0)); - const unsigned valueID = ((const unsigned) tolua_tonumber(tolua_S,3,0)); + const AString keyname = ((const AString) tolua_tocppstring(tolua_S,2,0)); + const int valueID = ((const int) tolua_tonumber(tolua_S,3,0)); #ifndef TOLUA_RELEASE if (!self) tolua_error(tolua_S,"invalid 'self' in function 'GetValueName'", NULL); #endif { - std::string tolua_ret = (std::string) self->GetValueName(keyname,valueID); + AString tolua_ret = (AString) self->GetValueName(keyname,valueID); tolua_pushcppstring(tolua_S,(const char*)tolua_ret); tolua_pushcppstring(tolua_S,(const char*)keyname); } @@ -1013,37 +784,6 @@ static int tolua_AllToLua_cIniFile_GetValueName00(lua_State* tolua_S) } #endif //#ifndef TOLUA_DISABLE -/* method: ValueName of class cIniFile */ -#ifndef TOLUA_DISABLE_tolua_AllToLua_cIniFile_ValueName01 -static int tolua_AllToLua_cIniFile_ValueName01(lua_State* tolua_S) -{ - tolua_Error tolua_err; - if ( - !tolua_isusertype(tolua_S,1,"const cIniFile",0,&tolua_err) || - !tolua_isnumber(tolua_S,2,0,&tolua_err) || - !tolua_isnumber(tolua_S,3,0,&tolua_err) || - !tolua_isnoobj(tolua_S,4,&tolua_err) - ) - goto tolua_lerror; - else - { - const cIniFile* self = (const cIniFile*) tolua_tousertype(tolua_S,1,0); - const unsigned keyID = ((const unsigned) tolua_tonumber(tolua_S,2,0)); - const unsigned valueID = ((const unsigned) tolua_tonumber(tolua_S,3,0)); -#ifndef TOLUA_RELEASE - if (!self) tolua_error(tolua_S,"invalid 'self' in function 'ValueName'", NULL); -#endif - { - std::string tolua_ret = (std::string) self->ValueName(keyID,valueID); - tolua_pushcppstring(tolua_S,(const char*)tolua_ret); - } - } - return 1; -tolua_lerror: - return tolua_AllToLua_cIniFile_ValueName00(tolua_S); -} -#endif //#ifndef TOLUA_DISABLE - /* method: GetValueName of class cIniFile */ #ifndef TOLUA_DISABLE_tolua_AllToLua_cIniFile_GetValueName01 static int tolua_AllToLua_cIniFile_GetValueName01(lua_State* tolua_S) @@ -1059,13 +799,13 @@ static int tolua_AllToLua_cIniFile_GetValueName01(lua_State* tolua_S) else { const cIniFile* self = (const cIniFile*) tolua_tousertype(tolua_S,1,0); - const unsigned keyID = ((const unsigned) tolua_tonumber(tolua_S,2,0)); - const unsigned valueID = ((const unsigned) tolua_tonumber(tolua_S,3,0)); + const int keyID = ((const int) tolua_tonumber(tolua_S,2,0)); + const int valueID = ((const int) tolua_tonumber(tolua_S,3,0)); #ifndef TOLUA_RELEASE if (!self) tolua_error(tolua_S,"invalid 'self' in function 'GetValueName'", NULL); #endif { - std::string tolua_ret = (std::string) self->GetValueName(keyID,valueID); + AString tolua_ret = (AString) self->GetValueName(keyID,valueID); tolua_pushcppstring(tolua_S,(const char*)tolua_ret); } } @@ -1164,8 +904,8 @@ static int tolua_AllToLua_cIniFile_GetValue02(lua_State* tolua_S) else { const cIniFile* self = (const cIniFile*) tolua_tousertype(tolua_S,1,0); - const unsigned keyID = ((const unsigned) tolua_tonumber(tolua_S,2,0)); - const unsigned valueID = ((const unsigned) tolua_tonumber(tolua_S,3,0)); + const int keyID = ((const int) tolua_tonumber(tolua_S,2,0)); + const int valueID = ((const int) tolua_tonumber(tolua_S,3,0)); #ifndef TOLUA_RELEASE if (!self) tolua_error(tolua_S,"invalid 'self' in function 'GetValue'", NULL); #endif @@ -1196,8 +936,8 @@ static int tolua_AllToLua_cIniFile_GetValue03(lua_State* tolua_S) else { const cIniFile* self = (const cIniFile*) tolua_tousertype(tolua_S,1,0); - const unsigned keyID = ((const unsigned) tolua_tonumber(tolua_S,2,0)); - const unsigned valueID = ((const unsigned) tolua_tonumber(tolua_S,3,0)); + const int keyID = ((const int) tolua_tonumber(tolua_S,2,0)); + const int valueID = ((const int) tolua_tonumber(tolua_S,3,0)); const AString defValue = ((const AString) tolua_tocppstring(tolua_S,4,0)); #ifndef TOLUA_RELEASE if (!self) tolua_error(tolua_S,"invalid 'self' in function 'GetValue'", NULL); @@ -1546,9 +1286,9 @@ static int tolua_AllToLua_cIniFile_SetValue00(lua_State* tolua_S) #endif { cIniFile* self = (cIniFile*) tolua_tousertype(tolua_S,1,0); - const unsigned keyID = ((const unsigned) tolua_tonumber(tolua_S,2,0)); - const unsigned valueID = ((const unsigned) tolua_tonumber(tolua_S,3,0)); - const std::string value = ((const std::string) tolua_tocppstring(tolua_S,4,0)); + const int keyID = ((const int) tolua_tonumber(tolua_S,2,0)); + const int valueID = ((const int) tolua_tonumber(tolua_S,3,0)); + const AString value = ((const AString) tolua_tocppstring(tolua_S,4,0)); #ifndef TOLUA_RELEASE if (!self) tolua_error(tolua_S,"invalid 'self' in function 'SetValue'", NULL); #endif @@ -1584,9 +1324,9 @@ static int tolua_AllToLua_cIniFile_SetValue01(lua_State* tolua_S) else { cIniFile* self = (cIniFile*) tolua_tousertype(tolua_S,1,0); - const std::string keyname = ((const std::string) tolua_tocppstring(tolua_S,2,0)); - const std::string valuename = ((const std::string) tolua_tocppstring(tolua_S,3,0)); - const std::string value = ((const std::string) tolua_tocppstring(tolua_S,4,0)); + const AString keyname = ((const AString) tolua_tocppstring(tolua_S,2,0)); + const AString valuename = ((const AString) tolua_tocppstring(tolua_S,3,0)); + const AString value = ((const AString) tolua_tocppstring(tolua_S,4,0)); const bool create = ((const bool) tolua_toboolean(tolua_S,5,true)); #ifndef TOLUA_RELEASE if (!self) tolua_error(tolua_S,"invalid 'self' in function 'SetValue'", NULL); @@ -1624,8 +1364,8 @@ static int tolua_AllToLua_cIniFile_SetValueI00(lua_State* tolua_S) #endif { cIniFile* self = (cIniFile*) tolua_tousertype(tolua_S,1,0); - const std::string keyname = ((const std::string) tolua_tocppstring(tolua_S,2,0)); - const std::string valuename = ((const std::string) tolua_tocppstring(tolua_S,3,0)); + const AString keyname = ((const AString) tolua_tocppstring(tolua_S,2,0)); + const AString valuename = ((const AString) tolua_tocppstring(tolua_S,3,0)); const int value = ((const int) tolua_tonumber(tolua_S,4,0)); const bool create = ((const bool) tolua_toboolean(tolua_S,5,true)); #ifndef TOLUA_RELEASE @@ -1666,8 +1406,8 @@ static int tolua_AllToLua_cIniFile_SetValueB00(lua_State* tolua_S) #endif { cIniFile* self = (cIniFile*) tolua_tousertype(tolua_S,1,0); - const std::string keyname = ((const std::string) tolua_tocppstring(tolua_S,2,0)); - const std::string valuename = ((const std::string) tolua_tocppstring(tolua_S,3,0)); + const AString keyname = ((const AString) tolua_tocppstring(tolua_S,2,0)); + const AString valuename = ((const AString) tolua_tocppstring(tolua_S,3,0)); const bool value = ((const bool) tolua_toboolean(tolua_S,4,0)); const bool create = ((const bool) tolua_toboolean(tolua_S,5,true)); #ifndef TOLUA_RELEASE @@ -1708,8 +1448,8 @@ static int tolua_AllToLua_cIniFile_SetValueF00(lua_State* tolua_S) #endif { cIniFile* self = (cIniFile*) tolua_tousertype(tolua_S,1,0); - const std::string keyname = ((const std::string) tolua_tocppstring(tolua_S,2,0)); - const std::string valuename = ((const std::string) tolua_tocppstring(tolua_S,3,0)); + const AString keyname = ((const AString) tolua_tocppstring(tolua_S,2,0)); + const AString valuename = ((const AString) tolua_tocppstring(tolua_S,3,0)); const double value = ((const double) tolua_tonumber(tolua_S,4,0)); const bool create = ((const bool) tolua_toboolean(tolua_S,5,true)); #ifndef TOLUA_RELEASE @@ -1748,8 +1488,8 @@ static int tolua_AllToLua_cIniFile_DeleteValueByID00(lua_State* tolua_S) #endif { cIniFile* self = (cIniFile*) tolua_tousertype(tolua_S,1,0); - const unsigned keyID = ((const unsigned) tolua_tonumber(tolua_S,2,0)); - const unsigned valueID = ((const unsigned) tolua_tonumber(tolua_S,3,0)); + const int keyID = ((const int) tolua_tonumber(tolua_S,2,0)); + const int valueID = ((const int) tolua_tonumber(tolua_S,3,0)); #ifndef TOLUA_RELEASE if (!self) tolua_error(tolua_S,"invalid 'self' in function 'DeleteValueByID'", NULL); #endif @@ -1784,8 +1524,8 @@ static int tolua_AllToLua_cIniFile_DeleteValue00(lua_State* tolua_S) #endif { cIniFile* self = (cIniFile*) tolua_tousertype(tolua_S,1,0); - const std::string keyname = ((const std::string) tolua_tocppstring(tolua_S,2,0)); - const std::string valuename = ((const std::string) tolua_tocppstring(tolua_S,3,0)); + const AString keyname = ((const AString) tolua_tocppstring(tolua_S,2,0)); + const AString valuename = ((const AString) tolua_tocppstring(tolua_S,3,0)); #ifndef TOLUA_RELEASE if (!self) tolua_error(tolua_S,"invalid 'self' in function 'DeleteValue'", NULL); #endif @@ -1821,7 +1561,7 @@ static int tolua_AllToLua_cIniFile_DeleteKey00(lua_State* tolua_S) #endif { cIniFile* self = (cIniFile*) tolua_tousertype(tolua_S,1,0); - const std::string keyname = ((const std::string) tolua_tocppstring(tolua_S,2,0)); + const AString keyname = ((const AString) tolua_tocppstring(tolua_S,2,0)); #ifndef TOLUA_RELEASE if (!self) tolua_error(tolua_S,"invalid 'self' in function 'DeleteKey'", NULL); #endif @@ -1840,9 +1580,9 @@ static int tolua_AllToLua_cIniFile_DeleteKey00(lua_State* tolua_S) } #endif //#ifndef TOLUA_DISABLE -/* method: NumHeaderComments of class cIniFile */ -#ifndef TOLUA_DISABLE_tolua_AllToLua_cIniFile_NumHeaderComments00 -static int tolua_AllToLua_cIniFile_NumHeaderComments00(lua_State* tolua_S) +/* method: GetNumHeaderComments of class cIniFile */ +#ifndef TOLUA_DISABLE_tolua_AllToLua_cIniFile_GetNumHeaderComments00 +static int tolua_AllToLua_cIniFile_GetNumHeaderComments00(lua_State* tolua_S) { #ifndef TOLUA_RELEASE tolua_Error tolua_err; @@ -1856,25 +1596,25 @@ static int tolua_AllToLua_cIniFile_NumHeaderComments00(lua_State* tolua_S) { cIniFile* self = (cIniFile*) tolua_tousertype(tolua_S,1,0); #ifndef TOLUA_RELEASE - if (!self) tolua_error(tolua_S,"invalid 'self' in function 'NumHeaderComments'", NULL); + if (!self) tolua_error(tolua_S,"invalid 'self' in function 'GetNumHeaderComments'", NULL); #endif { - unsigned tolua_ret = (unsigned) self->NumHeaderComments(); + int tolua_ret = (int) self->GetNumHeaderComments(); tolua_pushnumber(tolua_S,(lua_Number)tolua_ret); } } return 1; #ifndef TOLUA_RELEASE tolua_lerror: - tolua_error(tolua_S,"#ferror in function 'NumHeaderComments'.",&tolua_err); + tolua_error(tolua_S,"#ferror in function 'GetNumHeaderComments'.",&tolua_err); return 0; #endif } #endif //#ifndef TOLUA_DISABLE -/* method: HeaderComment of class cIniFile */ -#ifndef TOLUA_DISABLE_tolua_AllToLua_cIniFile_HeaderComment00 -static int tolua_AllToLua_cIniFile_HeaderComment00(lua_State* tolua_S) +/* method: AddHeaderComment of class cIniFile */ +#ifndef TOLUA_DISABLE_tolua_AllToLua_cIniFile_AddHeaderComment00 +static int tolua_AllToLua_cIniFile_AddHeaderComment00(lua_State* tolua_S) { #ifndef TOLUA_RELEASE tolua_Error tolua_err; @@ -1888,28 +1628,29 @@ static int tolua_AllToLua_cIniFile_HeaderComment00(lua_State* tolua_S) #endif { cIniFile* self = (cIniFile*) tolua_tousertype(tolua_S,1,0); - const std::string comment = ((const std::string) tolua_tocppstring(tolua_S,2,0)); + const AString comment = ((const AString) tolua_tocppstring(tolua_S,2,0)); #ifndef TOLUA_RELEASE - if (!self) tolua_error(tolua_S,"invalid 'self' in function 'HeaderComment'", NULL); + if (!self) tolua_error(tolua_S,"invalid 'self' in function 'AddHeaderComment'", NULL); #endif { - self->HeaderComment(comment); + self->AddHeaderComment(comment); tolua_pushcppstring(tolua_S,(const char*)comment); } } return 1; #ifndef TOLUA_RELEASE tolua_lerror: - tolua_error(tolua_S,"#ferror in function 'HeaderComment'.",&tolua_err); + tolua_error(tolua_S,"#ferror in function 'AddHeaderComment'.",&tolua_err); return 0; #endif } #endif //#ifndef TOLUA_DISABLE -/* method: HeaderComment of class cIniFile */ -#ifndef TOLUA_DISABLE_tolua_AllToLua_cIniFile_HeaderComment01 -static int tolua_AllToLua_cIniFile_HeaderComment01(lua_State* tolua_S) +/* method: GetHeaderComment of class cIniFile */ +#ifndef TOLUA_DISABLE_tolua_AllToLua_cIniFile_GetHeaderComment00 +static int tolua_AllToLua_cIniFile_GetHeaderComment00(lua_State* tolua_S) { +#ifndef TOLUA_RELEASE tolua_Error tolua_err; if ( !tolua_isusertype(tolua_S,1,"const cIniFile",0,&tolua_err) || @@ -1918,20 +1659,24 @@ static int tolua_AllToLua_cIniFile_HeaderComment01(lua_State* tolua_S) ) goto tolua_lerror; else +#endif { const cIniFile* self = (const cIniFile*) tolua_tousertype(tolua_S,1,0); - const unsigned commentID = ((const unsigned) tolua_tonumber(tolua_S,2,0)); + const int commentID = ((const int) tolua_tonumber(tolua_S,2,0)); #ifndef TOLUA_RELEASE - if (!self) tolua_error(tolua_S,"invalid 'self' in function 'HeaderComment'", NULL); + if (!self) tolua_error(tolua_S,"invalid 'self' in function 'GetHeaderComment'", NULL); #endif { - std::string tolua_ret = (std::string) self->HeaderComment(commentID); + AString tolua_ret = (AString) self->GetHeaderComment(commentID); tolua_pushcppstring(tolua_S,(const char*)tolua_ret); } } return 1; -tolua_lerror: - return tolua_AllToLua_cIniFile_HeaderComment00(tolua_S); +#ifndef TOLUA_RELEASE + tolua_lerror: + tolua_error(tolua_S,"#ferror in function 'GetHeaderComment'.",&tolua_err); + return 0; +#endif } #endif //#ifndef TOLUA_DISABLE @@ -1951,7 +1696,7 @@ static int tolua_AllToLua_cIniFile_DeleteHeaderComment00(lua_State* tolua_S) #endif { cIniFile* self = (cIniFile*) tolua_tousertype(tolua_S,1,0); - unsigned commentID = ((unsigned) tolua_tonumber(tolua_S,2,0)); + int commentID = ((int) tolua_tonumber(tolua_S,2,0)); #ifndef TOLUA_RELEASE if (!self) tolua_error(tolua_S,"invalid 'self' in function 'DeleteHeaderComment'", NULL); #endif @@ -2000,9 +1745,9 @@ static int tolua_AllToLua_cIniFile_DeleteHeaderComments00(lua_State* tolua_S) } #endif //#ifndef TOLUA_DISABLE -/* method: NumKeyComments of class cIniFile */ -#ifndef TOLUA_DISABLE_tolua_AllToLua_cIniFile_NumKeyComments00 -static int tolua_AllToLua_cIniFile_NumKeyComments00(lua_State* tolua_S) +/* method: GetNumKeyComments of class cIniFile */ +#ifndef TOLUA_DISABLE_tolua_AllToLua_cIniFile_GetNumKeyComments00 +static int tolua_AllToLua_cIniFile_GetNumKeyComments00(lua_State* tolua_S) { #ifndef TOLUA_RELEASE tolua_Error tolua_err; @@ -2016,27 +1761,27 @@ static int tolua_AllToLua_cIniFile_NumKeyComments00(lua_State* tolua_S) #endif { const cIniFile* self = (const cIniFile*) tolua_tousertype(tolua_S,1,0); - const unsigned keyID = ((const unsigned) tolua_tonumber(tolua_S,2,0)); + const int keyID = ((const int) tolua_tonumber(tolua_S,2,0)); #ifndef TOLUA_RELEASE - if (!self) tolua_error(tolua_S,"invalid 'self' in function 'NumKeyComments'", NULL); + if (!self) tolua_error(tolua_S,"invalid 'self' in function 'GetNumKeyComments'", NULL); #endif { - unsigned tolua_ret = (unsigned) self->NumKeyComments(keyID); + int tolua_ret = (int) self->GetNumKeyComments(keyID); tolua_pushnumber(tolua_S,(lua_Number)tolua_ret); } } return 1; #ifndef TOLUA_RELEASE tolua_lerror: - tolua_error(tolua_S,"#ferror in function 'NumKeyComments'.",&tolua_err); + tolua_error(tolua_S,"#ferror in function 'GetNumKeyComments'.",&tolua_err); return 0; #endif } #endif //#ifndef TOLUA_DISABLE -/* method: NumKeyComments of class cIniFile */ -#ifndef TOLUA_DISABLE_tolua_AllToLua_cIniFile_NumKeyComments01 -static int tolua_AllToLua_cIniFile_NumKeyComments01(lua_State* tolua_S) +/* method: GetNumKeyComments of class cIniFile */ +#ifndef TOLUA_DISABLE_tolua_AllToLua_cIniFile_GetNumKeyComments01 +static int tolua_AllToLua_cIniFile_GetNumKeyComments01(lua_State* tolua_S) { tolua_Error tolua_err; if ( @@ -2048,25 +1793,25 @@ static int tolua_AllToLua_cIniFile_NumKeyComments01(lua_State* tolua_S) else { const cIniFile* self = (const cIniFile*) tolua_tousertype(tolua_S,1,0); - const std::string keyname = ((const std::string) tolua_tocppstring(tolua_S,2,0)); + const AString keyname = ((const AString) tolua_tocppstring(tolua_S,2,0)); #ifndef TOLUA_RELEASE - if (!self) tolua_error(tolua_S,"invalid 'self' in function 'NumKeyComments'", NULL); + if (!self) tolua_error(tolua_S,"invalid 'self' in function 'GetNumKeyComments'", NULL); #endif { - unsigned tolua_ret = (unsigned) self->NumKeyComments(keyname); + int tolua_ret = (int) self->GetNumKeyComments(keyname); tolua_pushnumber(tolua_S,(lua_Number)tolua_ret); tolua_pushcppstring(tolua_S,(const char*)keyname); } } return 2; tolua_lerror: - return tolua_AllToLua_cIniFile_NumKeyComments00(tolua_S); + return tolua_AllToLua_cIniFile_GetNumKeyComments00(tolua_S); } #endif //#ifndef TOLUA_DISABLE -/* method: KeyComment of class cIniFile */ -#ifndef TOLUA_DISABLE_tolua_AllToLua_cIniFile_KeyComment00 -static int tolua_AllToLua_cIniFile_KeyComment00(lua_State* tolua_S) +/* method: AddKeyComment of class cIniFile */ +#ifndef TOLUA_DISABLE_tolua_AllToLua_cIniFile_AddKeyComment00 +static int tolua_AllToLua_cIniFile_AddKeyComment00(lua_State* tolua_S) { #ifndef TOLUA_RELEASE tolua_Error tolua_err; @@ -2081,13 +1826,13 @@ static int tolua_AllToLua_cIniFile_KeyComment00(lua_State* tolua_S) #endif { cIniFile* self = (cIniFile*) tolua_tousertype(tolua_S,1,0); - const unsigned keyID = ((const unsigned) tolua_tonumber(tolua_S,2,0)); - const std::string comment = ((const std::string) tolua_tocppstring(tolua_S,3,0)); + const int keyID = ((const int) tolua_tonumber(tolua_S,2,0)); + const AString comment = ((const AString) tolua_tocppstring(tolua_S,3,0)); #ifndef TOLUA_RELEASE - if (!self) tolua_error(tolua_S,"invalid 'self' in function 'KeyComment'", NULL); + if (!self) tolua_error(tolua_S,"invalid 'self' in function 'AddKeyComment'", NULL); #endif { - bool tolua_ret = (bool) self->KeyComment(keyID,comment); + bool tolua_ret = (bool) self->AddKeyComment(keyID,comment); tolua_pushboolean(tolua_S,(bool)tolua_ret); tolua_pushcppstring(tolua_S,(const char*)comment); } @@ -2095,15 +1840,15 @@ static int tolua_AllToLua_cIniFile_KeyComment00(lua_State* tolua_S) return 2; #ifndef TOLUA_RELEASE tolua_lerror: - tolua_error(tolua_S,"#ferror in function 'KeyComment'.",&tolua_err); + tolua_error(tolua_S,"#ferror in function 'AddKeyComment'.",&tolua_err); return 0; #endif } #endif //#ifndef TOLUA_DISABLE -/* method: KeyComment of class cIniFile */ -#ifndef TOLUA_DISABLE_tolua_AllToLua_cIniFile_KeyComment01 -static int tolua_AllToLua_cIniFile_KeyComment01(lua_State* tolua_S) +/* method: AddKeyComment of class cIniFile */ +#ifndef TOLUA_DISABLE_tolua_AllToLua_cIniFile_AddKeyComment01 +static int tolua_AllToLua_cIniFile_AddKeyComment01(lua_State* tolua_S) { tolua_Error tolua_err; if ( @@ -2116,13 +1861,13 @@ static int tolua_AllToLua_cIniFile_KeyComment01(lua_State* tolua_S) else { cIniFile* self = (cIniFile*) tolua_tousertype(tolua_S,1,0); - const std::string keyname = ((const std::string) tolua_tocppstring(tolua_S,2,0)); - const std::string comment = ((const std::string) tolua_tocppstring(tolua_S,3,0)); + const AString keyname = ((const AString) tolua_tocppstring(tolua_S,2,0)); + const AString comment = ((const AString) tolua_tocppstring(tolua_S,3,0)); #ifndef TOLUA_RELEASE - if (!self) tolua_error(tolua_S,"invalid 'self' in function 'KeyComment'", NULL); + if (!self) tolua_error(tolua_S,"invalid 'self' in function 'AddKeyComment'", NULL); #endif { - bool tolua_ret = (bool) self->KeyComment(keyname,comment); + bool tolua_ret = (bool) self->AddKeyComment(keyname,comment); tolua_pushboolean(tolua_S,(bool)tolua_ret); tolua_pushcppstring(tolua_S,(const char*)keyname); tolua_pushcppstring(tolua_S,(const char*)comment); @@ -2130,14 +1875,15 @@ static int tolua_AllToLua_cIniFile_KeyComment01(lua_State* tolua_S) } return 3; tolua_lerror: - return tolua_AllToLua_cIniFile_KeyComment00(tolua_S); + return tolua_AllToLua_cIniFile_AddKeyComment00(tolua_S); } #endif //#ifndef TOLUA_DISABLE -/* method: KeyComment of class cIniFile */ -#ifndef TOLUA_DISABLE_tolua_AllToLua_cIniFile_KeyComment02 -static int tolua_AllToLua_cIniFile_KeyComment02(lua_State* tolua_S) +/* method: GetKeyComment of class cIniFile */ +#ifndef TOLUA_DISABLE_tolua_AllToLua_cIniFile_GetKeyComment00 +static int tolua_AllToLua_cIniFile_GetKeyComment00(lua_State* tolua_S) { +#ifndef TOLUA_RELEASE tolua_Error tolua_err; if ( !tolua_isusertype(tolua_S,1,"const cIniFile",0,&tolua_err) || @@ -2147,27 +1893,31 @@ static int tolua_AllToLua_cIniFile_KeyComment02(lua_State* tolua_S) ) goto tolua_lerror; else +#endif { const cIniFile* self = (const cIniFile*) tolua_tousertype(tolua_S,1,0); - const unsigned keyID = ((const unsigned) tolua_tonumber(tolua_S,2,0)); - const unsigned commentID = ((const unsigned) tolua_tonumber(tolua_S,3,0)); + const int keyID = ((const int) tolua_tonumber(tolua_S,2,0)); + const int commentID = ((const int) tolua_tonumber(tolua_S,3,0)); #ifndef TOLUA_RELEASE - if (!self) tolua_error(tolua_S,"invalid 'self' in function 'KeyComment'", NULL); + if (!self) tolua_error(tolua_S,"invalid 'self' in function 'GetKeyComment'", NULL); #endif { - std::string tolua_ret = (std::string) self->KeyComment(keyID,commentID); + AString tolua_ret = (AString) self->GetKeyComment(keyID,commentID); tolua_pushcppstring(tolua_S,(const char*)tolua_ret); } } return 1; -tolua_lerror: - return tolua_AllToLua_cIniFile_KeyComment01(tolua_S); +#ifndef TOLUA_RELEASE + tolua_lerror: + tolua_error(tolua_S,"#ferror in function 'GetKeyComment'.",&tolua_err); + return 0; +#endif } #endif //#ifndef TOLUA_DISABLE -/* method: KeyComment of class cIniFile */ -#ifndef TOLUA_DISABLE_tolua_AllToLua_cIniFile_KeyComment03 -static int tolua_AllToLua_cIniFile_KeyComment03(lua_State* tolua_S) +/* method: GetKeyComment of class cIniFile */ +#ifndef TOLUA_DISABLE_tolua_AllToLua_cIniFile_GetKeyComment01 +static int tolua_AllToLua_cIniFile_GetKeyComment01(lua_State* tolua_S) { tolua_Error tolua_err; if ( @@ -2180,20 +1930,20 @@ static int tolua_AllToLua_cIniFile_KeyComment03(lua_State* tolua_S) else { const cIniFile* self = (const cIniFile*) tolua_tousertype(tolua_S,1,0); - const std::string keyname = ((const std::string) tolua_tocppstring(tolua_S,2,0)); - const unsigned commentID = ((const unsigned) tolua_tonumber(tolua_S,3,0)); + const AString keyname = ((const AString) tolua_tocppstring(tolua_S,2,0)); + const int commentID = ((const int) tolua_tonumber(tolua_S,3,0)); #ifndef TOLUA_RELEASE - if (!self) tolua_error(tolua_S,"invalid 'self' in function 'KeyComment'", NULL); + if (!self) tolua_error(tolua_S,"invalid 'self' in function 'GetKeyComment'", NULL); #endif { - std::string tolua_ret = (std::string) self->KeyComment(keyname,commentID); + AString tolua_ret = (AString) self->GetKeyComment(keyname,commentID); tolua_pushcppstring(tolua_S,(const char*)tolua_ret); tolua_pushcppstring(tolua_S,(const char*)keyname); } } return 2; tolua_lerror: - return tolua_AllToLua_cIniFile_KeyComment02(tolua_S); + return tolua_AllToLua_cIniFile_GetKeyComment00(tolua_S); } #endif //#ifndef TOLUA_DISABLE @@ -2214,8 +1964,8 @@ static int tolua_AllToLua_cIniFile_DeleteKeyComment00(lua_State* tolua_S) #endif { cIniFile* self = (cIniFile*) tolua_tousertype(tolua_S,1,0); - const unsigned keyID = ((const unsigned) tolua_tonumber(tolua_S,2,0)); - const unsigned commentID = ((const unsigned) tolua_tonumber(tolua_S,3,0)); + const int keyID = ((const int) tolua_tonumber(tolua_S,2,0)); + const int commentID = ((const int) tolua_tonumber(tolua_S,3,0)); #ifndef TOLUA_RELEASE if (!self) tolua_error(tolua_S,"invalid 'self' in function 'DeleteKeyComment'", NULL); #endif @@ -2248,8 +1998,8 @@ static int tolua_AllToLua_cIniFile_DeleteKeyComment01(lua_State* tolua_S) else { cIniFile* self = (cIniFile*) tolua_tousertype(tolua_S,1,0); - const std::string keyname = ((const std::string) tolua_tocppstring(tolua_S,2,0)); - const unsigned commentID = ((const unsigned) tolua_tonumber(tolua_S,3,0)); + const AString keyname = ((const AString) tolua_tocppstring(tolua_S,2,0)); + const int commentID = ((const int) tolua_tonumber(tolua_S,3,0)); #ifndef TOLUA_RELEASE if (!self) tolua_error(tolua_S,"invalid 'self' in function 'DeleteKeyComment'", NULL); #endif @@ -2281,7 +2031,7 @@ static int tolua_AllToLua_cIniFile_DeleteKeyComments00(lua_State* tolua_S) #endif { cIniFile* self = (cIniFile*) tolua_tousertype(tolua_S,1,0); - const unsigned keyID = ((const unsigned) tolua_tonumber(tolua_S,2,0)); + const int keyID = ((const int) tolua_tonumber(tolua_S,2,0)); #ifndef TOLUA_RELEASE if (!self) tolua_error(tolua_S,"invalid 'self' in function 'DeleteKeyComments'", NULL); #endif @@ -2313,7 +2063,7 @@ static int tolua_AllToLua_cIniFile_DeleteKeyComments01(lua_State* tolua_S) else { cIniFile* self = (cIniFile*) tolua_tousertype(tolua_S,1,0); - const std::string keyname = ((const std::string) tolua_tocppstring(tolua_S,2,0)); + const AString keyname = ((const AString) tolua_tocppstring(tolua_S,2,0)); #ifndef TOLUA_RELEASE if (!self) tolua_error(tolua_S,"invalid 'self' in function 'DeleteKeyComments'", NULL); #endif @@ -29350,22 +29100,14 @@ TOLUA_API int tolua_AllToLua_open (lua_State* tolua_S) tolua_function(tolua_S,"ReadFile",tolua_AllToLua_cIniFile_ReadFile00); tolua_function(tolua_S,"WriteFile",tolua_AllToLua_cIniFile_WriteFile00); tolua_function(tolua_S,"Clear",tolua_AllToLua_cIniFile_Clear00); - tolua_function(tolua_S,"Reset",tolua_AllToLua_cIniFile_Reset00); - tolua_function(tolua_S,"Erase",tolua_AllToLua_cIniFile_Erase00); tolua_function(tolua_S,"FindKey",tolua_AllToLua_cIniFile_FindKey00); tolua_function(tolua_S,"FindValue",tolua_AllToLua_cIniFile_FindValue00); - tolua_function(tolua_S,"NumKeys",tolua_AllToLua_cIniFile_NumKeys00); tolua_function(tolua_S,"GetNumKeys",tolua_AllToLua_cIniFile_GetNumKeys00); tolua_function(tolua_S,"AddKeyName",tolua_AllToLua_cIniFile_AddKeyName00); - tolua_function(tolua_S,"KeyName",tolua_AllToLua_cIniFile_KeyName00); tolua_function(tolua_S,"GetKeyName",tolua_AllToLua_cIniFile_GetKeyName00); - tolua_function(tolua_S,"NumValues",tolua_AllToLua_cIniFile_NumValues00); tolua_function(tolua_S,"GetNumValues",tolua_AllToLua_cIniFile_GetNumValues00); - tolua_function(tolua_S,"NumValues",tolua_AllToLua_cIniFile_NumValues01); tolua_function(tolua_S,"GetNumValues",tolua_AllToLua_cIniFile_GetNumValues01); - tolua_function(tolua_S,"ValueName",tolua_AllToLua_cIniFile_ValueName00); tolua_function(tolua_S,"GetValueName",tolua_AllToLua_cIniFile_GetValueName00); - tolua_function(tolua_S,"ValueName",tolua_AllToLua_cIniFile_ValueName01); tolua_function(tolua_S,"GetValueName",tolua_AllToLua_cIniFile_GetValueName01); tolua_function(tolua_S,"GetValue",tolua_AllToLua_cIniFile_GetValue00); tolua_function(tolua_S,"GetValue",tolua_AllToLua_cIniFile_GetValue01); @@ -29387,17 +29129,17 @@ TOLUA_API int tolua_AllToLua_open (lua_State* tolua_S) tolua_function(tolua_S,"DeleteValueByID",tolua_AllToLua_cIniFile_DeleteValueByID00); tolua_function(tolua_S,"DeleteValue",tolua_AllToLua_cIniFile_DeleteValue00); tolua_function(tolua_S,"DeleteKey",tolua_AllToLua_cIniFile_DeleteKey00); - tolua_function(tolua_S,"NumHeaderComments",tolua_AllToLua_cIniFile_NumHeaderComments00); - tolua_function(tolua_S,"HeaderComment",tolua_AllToLua_cIniFile_HeaderComment00); - tolua_function(tolua_S,"HeaderComment",tolua_AllToLua_cIniFile_HeaderComment01); + tolua_function(tolua_S,"GetNumHeaderComments",tolua_AllToLua_cIniFile_GetNumHeaderComments00); + tolua_function(tolua_S,"AddHeaderComment",tolua_AllToLua_cIniFile_AddHeaderComment00); + tolua_function(tolua_S,"GetHeaderComment",tolua_AllToLua_cIniFile_GetHeaderComment00); tolua_function(tolua_S,"DeleteHeaderComment",tolua_AllToLua_cIniFile_DeleteHeaderComment00); tolua_function(tolua_S,"DeleteHeaderComments",tolua_AllToLua_cIniFile_DeleteHeaderComments00); - tolua_function(tolua_S,"NumKeyComments",tolua_AllToLua_cIniFile_NumKeyComments00); - tolua_function(tolua_S,"NumKeyComments",tolua_AllToLua_cIniFile_NumKeyComments01); - tolua_function(tolua_S,"KeyComment",tolua_AllToLua_cIniFile_KeyComment00); - tolua_function(tolua_S,"KeyComment",tolua_AllToLua_cIniFile_KeyComment01); - tolua_function(tolua_S,"KeyComment",tolua_AllToLua_cIniFile_KeyComment02); - tolua_function(tolua_S,"KeyComment",tolua_AllToLua_cIniFile_KeyComment03); + tolua_function(tolua_S,"GetNumKeyComments",tolua_AllToLua_cIniFile_GetNumKeyComments00); + tolua_function(tolua_S,"GetNumKeyComments",tolua_AllToLua_cIniFile_GetNumKeyComments01); + tolua_function(tolua_S,"AddKeyComment",tolua_AllToLua_cIniFile_AddKeyComment00); + tolua_function(tolua_S,"AddKeyComment",tolua_AllToLua_cIniFile_AddKeyComment01); + tolua_function(tolua_S,"GetKeyComment",tolua_AllToLua_cIniFile_GetKeyComment00); + tolua_function(tolua_S,"GetKeyComment",tolua_AllToLua_cIniFile_GetKeyComment01); tolua_function(tolua_S,"DeleteKeyComment",tolua_AllToLua_cIniFile_DeleteKeyComment00); tolua_function(tolua_S,"DeleteKeyComment",tolua_AllToLua_cIniFile_DeleteKeyComment01); tolua_function(tolua_S,"DeleteKeyComments",tolua_AllToLua_cIniFile_DeleteKeyComments00); diff --git a/source/Bindings.h b/source/Bindings.h index 58f6023c1..edcdfd12f 100644 --- a/source/Bindings.h +++ b/source/Bindings.h @@ -1,6 +1,6 @@ /*
** Lua binding: AllToLua
-** Generated automatically by tolua++-1.0.92 on 10/25/13 10:38:51.
+** Generated automatically by tolua++-1.0.92 on 10/25/13 11:34:58.
*/
/* Exported function */
diff --git a/source/BlockID.cpp b/source/BlockID.cpp index 2e957593b..7193094d8 100644 --- a/source/BlockID.cpp +++ b/source/BlockID.cpp @@ -47,15 +47,15 @@ public: { return; } - long KeyID = Ini.FindKey("Items"); + int KeyID = Ini.FindKey("Items"); if (KeyID == cIniFile::noID) { return; } - unsigned NumValues = Ini.GetNumValues(KeyID); - for (unsigned i = 0; i < NumValues; i++) + int NumValues = Ini.GetNumValues(KeyID); + for (int i = 0; i < NumValues; i++) { - AString Name = Ini.ValueName(KeyID, i); + AString Name = Ini.GetValueName(KeyID, i); if (Name.empty()) { continue; diff --git a/source/MonsterConfig.cpp b/source/MonsterConfig.cpp index 69d639bdb..a5a1ebd49 100644 --- a/source/MonsterConfig.cpp +++ b/source/MonsterConfig.cpp @@ -63,10 +63,10 @@ void cMonsterConfig::Initialize() return; } - for (int i = (int)MonstersIniFile.NumKeys(); i >= 0; i--) + for (int i = (int)MonstersIniFile.GetNumKeys(); i >= 0; i--) { sAttributesStruct Attributes; - AString Name = MonstersIniFile.KeyName(i); + AString Name = MonstersIniFile.GetKeyName(i); Attributes.m_Name = Name; Attributes.m_AttackDamage = MonstersIniFile.GetValueF(Name, "AttackDamage", 0); Attributes.m_AttackRange = MonstersIniFile.GetValueF(Name, "AttackRange", 0); |