fixed getStringValue failure case and compiler warnings
This commit is contained in:
parent
4d0f46e554
commit
aa827d0c91
2 changed files with 7 additions and 5 deletions
|
@ -35,13 +35,16 @@ Config::~Config()
|
|||
}
|
||||
|
||||
|
||||
const string &Config::getStringValue(Config::ItemType type) const
|
||||
bool Config::getStringValue(Config::ItemType type, string &ret) const
|
||||
{
|
||||
ItemList::const_iterator it = items.begin(), end = items.end();
|
||||
for (; it != end; ++it) {
|
||||
if ((*it)->getType() == type)
|
||||
return (*it)->getStringValue();
|
||||
if ((*it)->getType() == type) {
|
||||
ret = (*it)->getStringValue();
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
|
@ -52,7 +55,6 @@ int Config::getNumberValue(Config::ItemType type) const
|
|||
if ((*it)->getType() == type)
|
||||
return (*it)->getNumberValue();
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
|
|
@ -45,7 +45,7 @@ public:
|
|||
Config();
|
||||
~Config();
|
||||
|
||||
const std::string &getStringValue(Config::ItemType) const;
|
||||
bool getStringValue(Config::ItemType, std::string &) const;
|
||||
int getNumberValue(Config::ItemType) const;
|
||||
void addOption(ConfigItem *);
|
||||
void addOption(const std::string &, const std::string &);
|
||||
|
|
Loading…
Reference in a new issue