From aa827d0c91dcb808469af768cc9bed0ef8980abd Mon Sep 17 00:00:00 2001 From: Marius Nita Date: Thu, 22 Aug 2002 01:03:33 +0000 Subject: [PATCH] fixed getStringValue failure case and compiler warnings --- util/epist/config.cc | 10 ++++++---- util/epist/config.hh | 2 +- 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/util/epist/config.cc b/util/epist/config.cc index 0df15e9c..506aab76 100644 --- a/util/epist/config.cc +++ b/util/epist/config.cc @@ -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; } diff --git a/util/epist/config.hh b/util/epist/config.hh index 17320125..443834ed 100644 --- a/util/epist/config.hh +++ b/util/epist/config.hh @@ -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 &); -- 2.39.2