9 #ifndef __libutilxx__sella__variant__Object_H__
10 #define __libutilxx__sella__variant__Object_H__
12 #include "../../common.h"
13 #include "TypeCastException.h"
18 #include <boost/regex.hpp>
29 typedef std::map<std::string, Variant>::iterator iterator;
30 typedef std::map<std::string, Variant>::const_iterator const_iterator;
32 static const boost::regex & Pattern(
void) {
static boost::regex regex(
"^\\{(.*)\\}$");
return regex; }
33 static const boost::regex NodePattern;
34 static const int Type = 0x51;
39 Object(
const std::string &value)
throw (TypeCastException);
40 Object(
const std::vector<std::string> &token)
throw (TypeCastException);
42 Object(
const std::map<std::string, Variant> &value)
throw ();
43 Object(std::map<std::string, Variant> &&value)
throw ();
47 virtual ~
Object()
throw ();
50 bool operator==(
const Object &other)
const throw ();
51 bool operator!=(
const Object &other)
const throw ();
56 Variant& operator[](
const std::string &key)
throw ();
57 Variant& operator[](std::string &&key)
throw ();
60 iterator begin()
throw (UnsupportedOperatorException);
61 iterator end()
throw (UnsupportedOperatorException);
62 const_iterator cbegin()
const throw (UnsupportedOperatorException);
63 const_iterator cend()
const throw (UnsupportedOperatorException);
65 const std::map<std::string, Variant>&
get()
const throw (UnsupportedOperatorException);
66 std::map<std::string, Variant>&
get()
throw (UnsupportedOperatorException);
68 size_t size()
const throw ();
69 bool empty()
const throw ();
71 bool erase(
const std::string &key)
throw ();
78 virtual void msgpackBufferSize(
size_t &size)
const throw ();
79 virtual std::string str(
int type)
const throw ();
80 virtual int getType(
void)
throw () {
return Type; }
82 static bool isType(
const std::string &value)
throw () {
return isType(value.c_str(), value.size()); }
83 static bool isType(
const char *value,
size_t size)
throw ();
86 std::string json()
const throw ();
87 std::string cjson()
const throw ();
88 std::string xml()
const throw ();
89 std::string csv()
const throw ();
91 void parse(
const std::vector<std::string> &token)
throw (TypeCastException);
94 std::map<std::string, Variant>::iterator it;