92 typedef std::map<std::string, std::string> ValueMap;
93 typedef std::map<std::string, Level> SectionMap;
94 typedef std::list<ValueMap::const_iterator> Values;
95 typedef std::list<SectionMap::const_iterator> Sections;
131 return this->values[name];
137 return this->sections[name];
151 void addKey(std::string name, std::string value);
166 Parser(std::string filename);
170 Parser(std::istream& stream);
177 void dump(std::ostream& stream);
189 return this->
top()[name];
195 return this->
top()(name);
211 void saveAs(std::string filename);
214 void dump(std::ostream& s,
const Level& l,
const std::string& sname);
216 void parse(
Level& l);
227 void parseLevelLine(std::string& sname,
size_t& depth);
231 void raise_error(std::string msg);
235 std::ifstream input_file;
Loads, reads and parses the contents of an INI file (or string).
void dump(std::ostream &stream)
Outputs the contents of the INI file to #stream.
void saveAs(std::string filename)
Save all the internal INI contents on a file with #filename.
Parser()
Creates a blank new INI file.
const std::string & operator[](const std::string &name)
Shortcut to access a key within the top level.
Level & top()
Returns the top level of this INI file.
Level & operator()(const std::string &name)
Shortcut to access a Level within the top level.
void create()
Creates a blank INI registry.
Simple module that contains everything needed to load and parse a file with the INI configuration for...
Contains a "scope" of the INI file.
const std::string & operator[](const std::string &name)
Access a key within this Level.
Level & operator()(const std::string &name)
Access another Level within this Level.
ValueMap values
All the key values inside this Level.
Level(Level *p)
Create a level with parent #p.
Sections ordered_sections
All Sections in the original order of the INI file.
SectionMap sections
All the Levels inside this Level.
void addKey(std::string name, std::string value)
Creates a new key #name with #value.
Level * parent
The parent Level of this one.
void addGroup(std::string name)
Creates a new child group with #name.
size_t depth
Counter of how many nested levels this one is.
Level()
Create the topmost Level.
Values ordered_values
All values in the original order of the INI file.