#include <extensible.h>
Inherited by dmlite::Chunk, dmlite::ExtendedStat, dmlite::GroupInfo, dmlite::Pool, dmlite::Replica, dmlite::SecurityCredentials, dmlite::SymLink, and dmlite::UserInfo.
Inheritance diagram for dmlite::Extensible:
Public Member Functions | |
bool | hasField (const std::string &key) const |
Returns true if there is a field name "key". | |
const boost::any & | operator[] (const std::string &key) const throw (DmException) |
boost::any & | operator[] (const std::string &key) |
bool | operator== (const Extensible &) const |
bool | operator!= (const Extensible &) const |
bool | operator> (const Extensible &) const |
bool | operator< (const Extensible &) const |
unsigned long | size () const |
Number of elements inside this Extensible. | |
void | clear () |
Removes all the content. | |
void | copy (const Extensible &s) |
Copies the content from another Extensible. | |
void | erase (const std::string &) |
Removes an entry. | |
std::string | serialize (void) const |
Serializes to JSON. In principle, it only supports POD. | |
void | deserialize (const std::string &serial) throw (DmException) |
Deserializes from a JSON string. | |
std::vector< std::string > | getKeys (void) const throw (DmException) |
Get all the keys available. | |
bool | getBool (const std::string &key) const throw (DmException) |
Gets a boolean. May be able to perform some conversions. | |
long | getLong (const std::string &key) const throw (DmException) |
Gets an integer. May be able to perform some conversions. | |
unsigned long | getUnsigned (const std::string &key) const throw (DmException) |
Gets an unsigned integer. May be able to perform some conversions. | |
double | getDouble (const std::string &key) const throw (DmException) |
Gets a float. May be able to perform some conversions. | |
std::string | getString (const std::string &key) const throw (DmException) |
Gets a string. May perform some conversions. | |
Extensible | getExtensible (const std::string &key) const throw (DmException) |
Gets a nested dictionary. | |
std::vector< boost::any > | getVector (const std::string &key) const throw (DmException) |
Gets an array. | |
Static Public Member Functions | |
static bool | anyToBoolean (const boost::any &any) |
Converts an any to a boolean, casting if needed. | |
static unsigned | anyToUnsigned (const boost::any &any) |
Converts an any to an unsigned, casting if needed. | |
static long | anyToLong (const boost::any &any) |
Converts an any to a long, casting if needed. | |
static double | anyToDouble (const boost::any &any) |
Converts an any to a double, casting if needed. | |
static std::string | anyToString (const boost::any &any) |
Converts an any to a string, casting if needed. | |
Private Types | |
typedef std::map< std::string, boost::any > | DictType_ |
Private Member Functions | |
void | populate (const boost::property_tree::ptree &root) |
Private Attributes | |
DictType_ | dictionary_ |
typedef std::map<std::string, boost::any> dmlite::Extensible::DictType_ [private] |
bool Extensible::anyToBoolean | ( | const boost::any & | any | ) | [static] |
Converts an any to a boolean, casting if needed.
double Extensible::anyToDouble | ( | const boost::any & | any | ) | [static] |
Converts an any to a double, casting if needed.
long Extensible::anyToLong | ( | const boost::any & | any | ) | [static] |
Converts an any to a long, casting if needed.
std::string Extensible::anyToString | ( | const boost::any & | any | ) | [static] |
Converts an any to a string, casting if needed.
unsigned Extensible::anyToUnsigned | ( | const boost::any & | any | ) | [static] |
Converts an any to an unsigned, casting if needed.
void Extensible::clear | ( | ) |
Removes all the content.
void Extensible::copy | ( | const Extensible & | s | ) |
Copies the content from another Extensible.
void Extensible::deserialize | ( | const std::string & | serial | ) | throw (DmException) |
Deserializes from a JSON string.
void Extensible::erase | ( | const std::string & | ) |
Removes an entry.
bool Extensible::getBool | ( | const std::string & | key | ) | const throw (DmException) |
Gets a boolean. May be able to perform some conversions.
double Extensible::getDouble | ( | const std::string & | key | ) | const throw (DmException) |
Gets a float. May be able to perform some conversions.
Extensible Extensible::getExtensible | ( | const std::string & | key | ) | const throw (DmException) |
Gets a nested dictionary.
std::vector< std::string > Extensible::getKeys | ( | void | ) | const throw (DmException) |
Get all the keys available.
long Extensible::getLong | ( | const std::string & | key | ) | const throw (DmException) |
Gets an integer. May be able to perform some conversions.
std::string Extensible::getString | ( | const std::string & | key | ) | const throw (DmException) |
Gets a string. May perform some conversions.
unsigned long Extensible::getUnsigned | ( | const std::string & | key | ) | const throw (DmException) |
Gets an unsigned integer. May be able to perform some conversions.
std::vector< boost::any > Extensible::getVector | ( | const std::string & | key | ) | const throw (DmException) |
Gets an array.
bool Extensible::hasField | ( | const std::string & | key | ) | const |
Returns true if there is a field name "key".
bool Extensible::operator!= | ( | const Extensible & | ) | const |
bool Extensible::operator< | ( | const Extensible & | ) | const |
bool Extensible::operator== | ( | const Extensible & | ) | const |
bool Extensible::operator> | ( | const Extensible & | ) | const |
boost::any & Extensible::operator[] | ( | const std::string & | key | ) |
Returns a modifiable reference to the value associated with "key". Will create the entry if it does not exist.
const boost::any & Extensible::operator[] | ( | const std::string & | key | ) | const throw (DmException) |
Returns a reference to the value associated with "key". Will throw DmException(DM_INVALID_VALUE,...) when not found.
void Extensible::populate | ( | const boost::property_tree::ptree & | root | ) | [private] |
std::string Extensible::serialize | ( | void | ) | const |
Serializes to JSON. In principle, it only supports POD.
unsigned long Extensible::size | ( | ) | const |
Number of elements inside this Extensible.
DictType_ dmlite::Extensible::dictionary_ [private] |