Trying to make gameini support some gl options

git-svn-id: https://dolphin-emu.googlecode.com/svn/trunk@2687 8ced0084-cf51-0410-be5f-012b33b47a6e
This commit is contained in:
nakeee
2009-03-20 11:51:22 +00:00
parent eff7b1aa14
commit f22af37320
13 changed files with 85 additions and 26 deletions

View File

@ -171,6 +171,27 @@ std::string* IniFile::GetLine(Section* section, const char* key, std::string* va
return 0;
}
bool IniFile::Exists(const char* sectionName, const char* key)
{
const Section* section = GetSection(sectionName);
if (!section)
return false;
for (std::vector<std::string>::const_iterator iter = section->lines.begin(); iter != section->lines.end(); ++iter)
{
std::string lineKey;
ParseLine(*iter, &lineKey, NULL, NULL);
if (!strcasecmp(lineKey.c_str(), key))
{
return true;
}
}
return false;
}
void IniFile::SetLines(const char* sectionName, const std::vector<std::string> &lines)
{
Section* section = GetOrCreateSection(sectionName);

View File

@ -57,6 +57,9 @@ public:
void SetLines(const char* sectionName, const std::vector<std::string> &lines);
// Returns true if exists key in section
bool Exists(const char* sectionName, const char* key);
// getter should be const
bool Get(const char* sectionName, const char* key, std::string* value, const char* defaultValue = "");
bool Get(const char* sectionName, const char* key, int* value, int defaultValue = 0);