A variant class holding a string, an item map keyed by name, or an ordered list of items.
More...
|
| Item (Type type=t_string) |
| Constructor.
|
|
| Item (const std::string &s) |
| Constructor for a string item.
|
|
Type | type () const |
| Returns the item type (string, list or map).
|
|
const Item & | operator[] (const std::string &k) const |
| Indexing operator for a map item. Throws if no such item.
|
|
Item & | operator[] (const std::string &k) |
| Indexing operator for a map item. More...
|
|
Item & | operator[] (size_t i) |
| Indexing operator for a list item. Throws if out of range.
|
|
const Item & | operator[] (size_t i) const |
| Indexing operator for a list item. Throws if out of range.
|
|
void | add (const std::string &s) |
| Adds a string item to this list item.
|
|
void | add (Item i) |
| Adds an item to this list item.
|
|
void | add (const std::string &k, const std::string &s) |
| Adds a string item to this map item. Replaces any pre-existing item with that key.
|
|
void | add (const std::string &k, const Item &i) |
| Adds an item to this map item. Replaces any pre-existing item with that key.
|
|
bool | has (const std::string &k) const |
| Returns true if this map item has the named key.
|
|
void | remove (const std::string &k) |
| Removes an item from this map item.
|
|
Item | keys () const |
| Returns the keys of this map item as a list of string items.
|
|
size_t | size () const |
| Returns the size of this map-or-list item.
|
|
bool | empty () const |
| Returns true if an empty item.
|
|
std::string | operator() () const |
| Returns the value of this string item.
|
|
void | out (std::ostream &s, int indent=-1) const |
| Does output streaming, using a json-like format.
|
|
void | in (std::istream &s) |
| Does input parsing. Throws on error.
|
|
std::string | str (int indent=-1) const |
| Returns a string representation, using a json-like format.
|
|
A variant class holding a string, an item map keyed by name, or an ordered list of items.
The definition is recursive, so items can be nested. The string representation is curiously json-like.
Definition at line 41 of file gitem.h.