--- smsdaemon/ConfigFile.cpp 2008/12/07 20:06:12 146 +++ smsdaemon/ConfigFile.cpp 2008/12/18 23:19:08 201 @@ -61,8 +61,7 @@ name = trim(line.substr(0,posEqual)); value = trim(line.substr(posEqual+1)); - - content_[inSection+SEPERATOR+name]=Value(value); + content_.insert(std::make_pair(inSection+SEPERATOR+name,Value(value))); } return true; } @@ -70,13 +69,26 @@ Value const& ConfigFile::GetValue(std::string const& section, std::string const& entry) const { - std::map::const_iterator ci = content_.find(section + SEPERATOR + entry); + content_iterator ci = content_.find(section + SEPERATOR + entry); if (ci == content_.end()) throw "does not exist"; return ci->second; } +std::vector ConfigFile::GetValues(std::string const& section, std::string const& entry) const +{ + std::vector values; + std::string search = section + SEPERATOR + entry; + std::pair range = content_.equal_range(search); + + for (content_iterator it=range.first; it != range.second; ++it) + { + values.push_back( it->second ); + } + return values; +} + Value const& ConfigFile::GetValue(std::string const& section, std::string const& entry, double value) { try @@ -85,7 +97,7 @@ } catch (const char *) { - return content_.insert(std::make_pair(section+SEPERATOR+entry, Value(value))).first->second; + return content_.insert(std::make_pair(section+SEPERATOR+entry, Value(value)))->second; } } @@ -97,7 +109,7 @@ } catch (const char *) { - return content_.insert(std::make_pair(section+SEPERATOR+entry, Value(value))).first->second; + return content_.insert(std::make_pair(section+SEPERATOR+entry, Value(value)))->second; } }