casacore
|
Class to hold a collection of JSON key:value pairs. More...
#include <JsonKVMap.h>
Public Types | |
typedef std::map< String, JsonValue >::const_iterator | const_iterator |
Define the iterator types. More... | |
typedef std::map< String, JsonValue >::iterator | iterator |
Public Member Functions | |
JsonKVMap () | |
Construct an empty map. More... | |
JsonKVMap (const JsonKVMap &that) | |
Copy constructor (copy semantics) More... | |
~JsonKVMap () | |
JsonKVMap & | operator= (const JsonKVMap &that) |
Assignment (copy semantics) More... | |
Bool | isDefined (const String &name) const |
Is a key defined? More... | |
const JsonValue & | get (const String &name) const |
Get the value of a key. More... | |
Get the typed value of a key | |
Use the default if not existing. | |
Bool | getBool (const String &name, Bool defVal) const |
Int64 | getInt (const String &name, Int64 defVal) const |
double | getDouble (const String &name, double defVal) const |
DComplex | getDComplex (const String &name, const DComplex &defVal) const |
const String & | getString (const String &name, const String &defVal) const |
Record | toRecord () const |
Convert the map to a Record. More... | |
Show the contents of the object | |
void | show (ostream &) const |
ostream & | operator<< (ostream &, const JsonKVMap &) |
Class to hold a collection of JSON key:value pairs.
Public interface
A JsonKVMap object is the result of a JSON file parsed by JsonParser. It is a map of name to a JsonValue object holding an arbitrary value (including a JsonKVMap for nested structs).
JsonKVMap has functions to test if a given field is present and to get its JsonValue. It also has functions to get a scalar value where a default value is used if the key is undefined.
JsonKVMap is derived from std::map, so all its functions are available. Iterators make standard iteration possible.
JSON is a commonly used interchange format.
Definition at line 72 of file JsonKVMap.h.
typedef std::map<String,JsonValue>::const_iterator casacore::JsonKVMap::const_iterator |
Define the iterator types.
Definition at line 76 of file JsonKVMap.h.
typedef std::map<String,JsonValue>::iterator casacore::JsonKVMap::iterator |
Definition at line 77 of file JsonKVMap.h.
casacore::JsonKVMap::JsonKVMap | ( | ) |
Construct an empty map.
casacore::JsonKVMap::JsonKVMap | ( | const JsonKVMap & | that | ) |
Copy constructor (copy semantics)
casacore::JsonKVMap::~JsonKVMap | ( | ) |
Get the value of a key.
An exception is thrown if undefined.
DComplex casacore::JsonKVMap::getDComplex | ( | const String & | name, |
const DComplex & | defVal | ||
) | const |
double casacore::JsonKVMap::getDouble | ( | const String & | name, |
double | defVal | ||
) | const |
Is a key defined?
Definition at line 91 of file JsonKVMap.h.
void casacore::JsonKVMap::show | ( | ostream & | ) | const |
|
friend |