00001
00002
00003
00004
00005
00006
00007
00008
00009 #ifndef __libutilxx__sella__variant__Object_H__
00010 #define __libutilxx__sella__variant__Object_H__
00011
00012 #include "../../common.h"
00013 #include "TypeCastException.h"
00014 #include "Nullable.h"
00015
00016 #include <memory>
00017
00018 #include <boost/regex.hpp>
00019
00020 namespace sella {
00021 namespace variant {
00022 class Object;
00023 class Variant;
00024 }
00025 }
00026
00027 class sella::variant::Object : public Nullable {
00028 public:
00029 typedef std::map<std::string, Variant>::iterator iterator;
00030 typedef std::map<std::string, Variant>::const_iterator const_iterator;
00031 static const boost::regex Pattern;
00032 static const boost::regex NodePattern;
00033 static const int Type = 0x51;
00034
00035 public:
00036
00037 Object() throw ();
00038 Object(const std::string &value) throw (TypeCastException);
00039 Object(const std::vector<std::string> &token) throw (TypeCastException);
00040 Object(const std::map<std::string, Variant> &value) throw ();
00041
00042 Object(const Object &other) throw ();
00043 virtual ~Object() throw ();
00044
00045
00046 bool operator==(const Object &other) const throw ();
00047 bool operator!=(const Object &other) const throw ();
00048 Object& operator=(const Object &other) throw ();
00049 Object& operator+=(const Variant &other) throw ();
00050 const Variant& operator[](const std::string &key) const throw ();
00051 Variant& operator[](const std::string &key) throw ();
00052
00053
00054 iterator begin() throw ();
00055 iterator end() throw ();
00056 const_iterator cbegin() const throw ();
00057 const_iterator cend() const throw ();
00058
00059 const std::map<std::string, Variant>* getObject() const throw (UnsupportedOperatorException);
00060 size_t size() const throw ();
00061 bool empty() const throw ();
00062 bool erase(const Variant &key) throw ();
00063
00064 virtual const std::string& str() const throw ();
00065
00066 private:
00067 std::map<std::string, Variant>& getRef() throw ();
00068 const std::map<std::string, Variant>& getRef() const throw ();
00069 void parse(const std::vector<std::string> &token) throw (TypeCastException);
00070
00071 std::map<std::string, Variant>::iterator it;
00072 };
00073
00074 #endif
00075
00076
00077
00078