61 |
name = trim(line.substr(0,posEqual)); |
name = trim(line.substr(0,posEqual)); |
62 |
value = trim(line.substr(posEqual+1)); |
value = trim(line.substr(posEqual+1)); |
63 |
|
|
64 |
|
content_.insert(std::make_pair(inSection+SEPERATOR+name,Value(value))); |
|
content_[inSection+SEPERATOR+name]=Value(value); |
|
65 |
} |
} |
66 |
return true; |
return true; |
67 |
} |
} |
69 |
Value const& ConfigFile::GetValue(std::string const& section, std::string const& entry) const |
Value const& ConfigFile::GetValue(std::string const& section, std::string const& entry) const |
70 |
{ |
{ |
71 |
|
|
72 |
std::map<std::string,Value>::const_iterator ci = content_.find(section + SEPERATOR + entry); |
content_iterator ci = content_.find(section + SEPERATOR + entry); |
73 |
|
|
74 |
if (ci == content_.end()) throw "does not exist"; |
if (ci == content_.end()) throw "does not exist"; |
75 |
|
|
76 |
return ci->second; |
return ci->second; |
77 |
} |
} |
78 |
|
|
79 |
|
std::vector<Value> ConfigFile::GetValues(std::string const& section, std::string const& entry) const |
80 |
|
{ |
81 |
|
std::vector<Value> values; |
82 |
|
std::string search = section + SEPERATOR + entry; |
83 |
|
std::pair<content_iterator, content_iterator> range = content_.equal_range(search); |
84 |
|
|
85 |
|
for (content_iterator it=range.first; it != range.second; ++it) |
86 |
|
{ |
87 |
|
values.push_back( it->second ); |
88 |
|
} |
89 |
|
return values; |
90 |
|
} |
91 |
|
|
92 |
Value const& ConfigFile::GetValue(std::string const& section, std::string const& entry, double value) |
Value const& ConfigFile::GetValue(std::string const& section, std::string const& entry, double value) |
93 |
{ |
{ |
94 |
try |
try |
97 |
} |
} |
98 |
catch (const char *) |
catch (const char *) |
99 |
{ |
{ |
100 |
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; |
101 |
} |
} |
102 |
} |
} |
103 |
|
|
109 |
} |
} |
110 |
catch (const char *) |
catch (const char *) |
111 |
{ |
{ |
112 |
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; |
113 |
} |
} |
114 |
} |
} |
115 |
|
|