![]() |
Kea 3.0.0
|
#include <data.h>
Public Member Functions | |
| MapElement (const Position &pos=ZERO_POSITION()) | |
| bool | contains (const std::string &s) const override |
| Checks if there is data at the given key. | |
| bool | empty () const override |
| Return true if there are no elements in the list. | |
| bool | equals (const Element &other) const override |
| ConstElementPtr | find (const std::string &id) const override |
| Recursively finds any data at the given identifier. | |
| bool | find (const std::string &id, ConstElementPtr &t) const override |
See Element::find() | |
| ConstElementPtr | get (const std::string &s) const override |
| Returns the ElementPtr at the given key. | |
| ConstElementPtr | get (int const i) const override |
| Get the i-th element in the map. | |
| virtual bool | getValue (bool &t) const |
| virtual bool | getValue (double &t) const |
| virtual bool | getValue (int64_t &t) const |
| bool | getValue (std::map< std::string, ConstElementPtr > &t) const override |
| virtual bool | getValue (std::string &t) const |
| virtual bool | getValue (std::vector< ElementPtr > &t) const |
| const std::map< std::string, ConstElementPtr > & | mapValue () const override |
| void | remove (const std::string &s) override |
| Remove the ElementPtr at the given key. | |
| void | remove (int const i) override |
| Remove the i-th element from the map. | |
| virtual void | set (const size_t i, ElementPtr element) |
| Sets the ElementPtr at the given index. | |
| void | set (const std::string &key, ConstElementPtr value) override |
| Sets the ElementPtr at the given key. | |
| virtual bool | setValue (const bool t) |
| virtual bool | setValue (const double v) |
| bool | setValue (const int i) |
| virtual bool | setValue (const isc::util::int128_t &v) |
| bool | setValue (const long int i) |
| virtual bool | setValue (const long long int v) |
| bool | setValue (const std::map< std::string, ConstElementPtr > &v) override |
| virtual bool | setValue (const std::string &v) |
| virtual bool | setValue (const std::vector< ElementPtr > &v) |
| size_t | size () const override |
| Returns number of stored elements. | |
| void | toJSON (std::ostream &ss) const override |
| Converts the Element to JSON format and appends it to the given stringstream. | |
| Public Member Functions inherited from isc::data::Element | |
| virtual | ~Element () |
| const Position & | getPosition () const |
| Returns position where the data element's value starts in a configuration string. | |
| types | getType () const |
| std::string | str () const |
| Returns a string representing the Element and all its child elements; note that this is different from stringValue(), which only returns the single value of a StringElement. | |
| std::string | toWire () const |
| Returns the wireformat for the Element and all its child elements. | |
| void | toWire (std::ostream &out) const |
| virtual int64_t | intValue () const |
| virtual isc::util::int128_t | bigIntValue () const |
| virtual double | doubleValue () const |
| virtual bool | boolValue () const |
| virtual std::string | stringValue () const |
| virtual const std::vector< ElementPtr > & | listValue () const |
| bool | setValue (const long int i) |
| bool | setValue (const int i) |
| virtual ElementPtr | getNonConst (const int i) const |
| returns element as non-const pointer | |
| virtual void | add (ElementPtr element) |
| Adds an ElementPtr to the list. | |
| void | removeEmptyContainersRecursively () |
| Remove all empty maps and lists from this Element and its descendants. | |
Additional Inherited Members | |
| Public Types inherited from isc::data::Element | |
| enum | types : int { integer = 0 , real = 1 , boolean = 2 , null = 3 , string = 4 , bigint = 5 , list = 6 , map = 7 , any = 8 } |
| The types that an Element can hold. More... | |
| Static Public Member Functions inherited from isc::data::Element | |
| static const Position & | ZERO_POSITION () |
Returns Position object with line_ and pos_ set to 0, and with an empty file name. | |
| static ElementPtr | create (const Position &pos=ZERO_POSITION()) |
| static ElementPtr | create (const long long int i, const Position &pos=ZERO_POSITION()) |
| static ElementPtr | create (const isc::util::int128_t &i, const Position &pos=ZERO_POSITION()) |
| static ElementPtr | create (const int i, const Position &pos=ZERO_POSITION()) |
| static ElementPtr | create (const long int i, const Position &pos=ZERO_POSITION()) |
| static ElementPtr | create (const uint32_t i, const Position &pos=ZERO_POSITION()) |
| static ElementPtr | create (const double d, const Position &pos=ZERO_POSITION()) |
| static ElementPtr | create (const bool b, const Position &pos=ZERO_POSITION()) |
| static ElementPtr | create (const std::string &s, const Position &pos=ZERO_POSITION()) |
| static ElementPtr | create (const char *s, const Position &pos=ZERO_POSITION()) |
| static ElementPtr | createList (const Position &pos=ZERO_POSITION()) |
| Creates an empty ListElement type ElementPtr. | |
| static ElementPtr | createMap (const Position &pos=ZERO_POSITION()) |
| Creates an empty MapElement type ElementPtr. | |
| static ElementPtr | fromJSON (const std::string &in, bool preproc=false) |
| These functions will parse the given string (JSON) representation of a compound element. | |
| static ElementPtr | fromJSON (std::istream &in, bool preproc=false) |
| Creates an Element from the given input stream containing JSON formatted data. | |
| static ElementPtr | fromJSON (std::istream &in, const std::string &file_name, bool preproc=false) |
| Creates an Element from the given input stream containing JSON formatted data. | |
| static ElementPtr | fromJSON (std::istream &in, const std::string &file, int &line, int &pos) |
| Creates an Element from the given input stream, where we keep track of the location in the stream for error reporting. | |
| static ElementPtr | fromJSONFile (const std::string &file_name, bool preproc=false) |
| Reads contents of specified file and interprets it as JSON. | |
| static std::string | typeToName (Element::types type) |
| Returns the name of the given type as a string. | |
| static Element::types | nameToType (const std::string &type_name) |
| Converts the string to the corresponding type Throws a TypeError if the name is unknown. | |
| static void | preprocess (std::istream &in, std::stringstream &out) |
| input text preprocessor | |
| static ElementPtr | fromWire (std::stringstream &in, int length) |
| These function pparse the wireformat at the given stringstream (of the given length). | |
| static ElementPtr | fromWire (const std::string &s) |
| Creates an Element from the wire format in the given string Since the wire format is JSON, this is the same as fromJSON, and could be removed. | |
| Protected Member Functions inherited from isc::data::Element | |
| Element (types t, const Position &pos=ZERO_POSITION()) | |
| Constructor. | |
|
inline |
Definition at line 772 of file data.h.
References isc::data::Element::Element(), and isc::data::Element::map.
|
inlineoverridevirtual |
Checks if there is data at the given key.
| name | The key of the Element checked for existence |
Reimplemented from isc::data::Element.
|
inlineoverridevirtual |
Return true if there are no elements in the list.
Reimplemented from isc::data::Element.
|
overridevirtual |
Implements isc::data::Element.
Definition at line 1126 of file data.cc.
References isc::data::Element::Element(), isc::data::Element::contains(), isc::data::Element::equals(), isc::data::Element::get(), isc::data::Element::getType(), isc::data::Element::map, isc::data::Element::mapValue(), and isc::data::Element::size().
|
overridevirtual |
Recursively finds any data at the given identifier.
The identifier is a /-separated list of names of nested maps, with the last name being the leaf that is returned.
For instance, if you have a MapElement that contains another MapElement at the key "foo", and that second MapElement contains Another Element at key "bar", the identifier for that last element from the first is "foo/bar".
| identifier | The identifier of the element to find |
Reimplemented from isc::data::Element.
Definition at line 964 of file data.cc.
References isc::data::Element::get(), and isc::data::Element::size().
|
overridevirtual |
See Element::find()
| identifier | The identifier of the element to find |
| t | Reference to store the resulting ElementPtr, if found. |
Reimplemented from isc::data::Element.
Definition at line 1013 of file data.cc.
References isc::data::Element::find().
|
inlineoverridevirtual |
Returns the ElementPtr at the given key.
| name | The key of the Element to return |
Reimplemented from isc::data::Element.
|
inlineoverridevirtual |
Get the i-th element in the map.
Useful when required to iterate with an index.
| i | the position of the element you want to return |
Reimplemented from isc::data::Element.
Definition at line 800 of file data.h.
References isc::data::Element::create().
|
virtual |
Reimplemented from isc::data::Element.
|
virtual |
Reimplemented from isc::data::Element.
|
virtual |
Reimplemented from isc::data::Element.
|
inlineoverridevirtual |
Reimplemented from isc::data::Element.
|
virtual |
Reimplemented from isc::data::Element.
|
virtual |
Reimplemented from isc::data::Element.
|
inlineoverridevirtual |
Reimplemented from isc::data::Element.
|
inlineoverridevirtual |
Remove the ElementPtr at the given key.
| name | The key of the Element to remove |
Reimplemented from isc::data::Element.
|
inlineoverridevirtual |
Remove the i-th element from the map.
| i | the position of the element you want to remove |
Reimplemented from isc::data::Element.
|
virtual |
Sets the ElementPtr at the given index.
If the index is out of bounds, this function throws an std::out_of_range exception.
| i | The position of the ElementPtr to set |
| element | The ElementPtr to set at the position |
Reimplemented from isc::data::Element.
|
overridevirtual |
Sets the ElementPtr at the given key.
| name | The key of the Element to set |
| element | The ElementPtr to set at the given key. |
Reimplemented from isc::data::Element.
|
virtual |
Reimplemented from isc::data::Element.
|
virtual |
Reimplemented from isc::data::Element.
|
virtual |
Reimplemented from isc::data::Element.
|
virtual |
Reimplemented from isc::data::Element.
|
inlineoverridevirtual |
Reimplemented from isc::data::Element.
|
virtual |
Reimplemented from isc::data::Element.
|
virtual |
Reimplemented from isc::data::Element.
|
inlineoverridevirtual |
Returns number of stored elements.
Reimplemented from isc::data::Element.
|
overridevirtual |
Converts the Element to JSON format and appends it to the given stringstream.
Implements isc::data::Element.