nsnake
Classic snake game for the terminal
|
Contains a "scope" of the INI file. More...
#include <INI.hpp>
Public Types | |
typedef std::map< std::string, std::string > | ValueMap |
typedef std::map< std::string, Level > | SectionMap |
typedef std::list< ValueMap::const_iterator > | Values |
typedef std::list< SectionMap::const_iterator > | Sections |
Public Member Functions | |
Level () | |
Create the topmost Level. | |
Level (Level *p) | |
Create a level with parent #p. | |
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. | |
void | addGroup (std::string name) |
Creates a new child group with #name. More... | |
void | addKey (std::string name, std::string value) |
Creates a new key #name with #value. More... | |
Public Attributes | |
Level * | parent |
The parent Level of this one. More... | |
size_t | depth |
Counter of how many nested levels this one is. | |
ValueMap | values |
All the key values inside this Level. More... | |
SectionMap | sections |
All the Levels inside this Level. More... | |
Values | ordered_values |
All values in the original order of the INI file. | |
Sections | ordered_sections |
All Sections in the original order of the INI file. | |
Contains a "scope" of the INI file.
Suppose an INI file like this:
key=value [group] key=value [[group2]] key=value [[[group3]] key=value
We have four Levels, group
, group2
and group3
and the top level, which contains all other levels.
You access keys with the []
operator and child groups with the ()
operator. So, for the example above:
parser.top()("group")("group2")("group3")["key"] == "value"
void INI::Level::addGroup | ( | std::string | name | ) |
void INI::Level::addKey | ( | std::string | name, |
std::string | value | ||
) |
Level* INI::Level::parent |
SectionMap INI::Level::sections |
ValueMap INI::Level::values |