@@ -56,7 +56,7 @@ long INIReader::GetInteger(const string& section, const string& name, long defau
56
56
return end > value ? n : default_value;
57
57
}
58
58
59
- INI_API int64_t INIReader::GetInteger64 (const std:: string& section, const std:: string& name, int64_t default_value) const
59
+ INI_API int64_t INIReader::GetInteger64 (const string& section, const string& name, int64_t default_value) const
60
60
{
61
61
string valstr = Get (section, name, " " );
62
62
const char * value = valstr.c_str ();
@@ -76,7 +76,7 @@ unsigned long INIReader::GetUnsigned(const string& section, const string& name,
76
76
return end > value ? n : default_value;
77
77
}
78
78
79
- INI_API uint64_t INIReader::GetUnsigned64 (const std:: string& section, const std:: string& name, uint64_t default_value) const
79
+ INI_API uint64_t INIReader::GetUnsigned64 (const string& section, const string& name, uint64_t default_value) const
80
80
{
81
81
string valstr = Get (section, name, " " );
82
82
const char * value = valstr.c_str ();
@@ -109,6 +109,30 @@ bool INIReader::GetBoolean(const string& section, const string& name, bool defau
109
109
return default_value;
110
110
}
111
111
112
+ std::vector<string> INIReader::Sections () const
113
+ {
114
+ std::set<string> sectionSet;
115
+ for (std::map<string, string>::const_iterator it = _values.begin (); it != _values.end (); ++it) {
116
+ size_t pos = it->first .find (' =' );
117
+ if (pos != string::npos) {
118
+ sectionSet.insert (it->first .substr (0 , pos));
119
+ }
120
+ }
121
+ return std::vector<string>(sectionSet.begin (), sectionSet.end ());
122
+ }
123
+
124
+ std::vector<string> INIReader::Keys (const string& section) const
125
+ {
126
+ std::vector<string> keys;
127
+ string keyPrefix = MakeKey (section, " " );
128
+ for (std::map<string, string>::const_iterator it = _values.begin (); it != _values.end (); ++it) {
129
+ if (it->first .compare (0 , keyPrefix.length (), keyPrefix) == 0 ) {
130
+ keys.push_back (it->first .substr (keyPrefix.length ()));
131
+ }
132
+ }
133
+ return keys;
134
+ }
135
+
112
136
bool INIReader::HasSection (const string& section) const
113
137
{
114
138
const string key = MakeKey (section, " " );
0 commit comments