9 #ifndef __libutilxx__sella__variant__Vector_H__
10 #define __libutilxx__sella__variant__Vector_H__
12 #include "../../common.h"
13 #include "TypeCastException.h"
14 #include "UnsupportedOperatorException.h"
15 #include "RangeException.h"
21 #include <boost/regex.hpp>
32 typedef std::vector<Variant>::iterator iterator;
33 typedef std::vector<Variant>::const_iterator const_iterator;
35 static const boost::regex & Pattern(
void) {
static boost::regex regex(
"^\\[(.*)\\]$");
return regex; }
36 static const int Type = 0x50;
41 Vector(
const std::string &value)
throw (TypeCastException);
42 Vector(
const std::vector<std::string> &token)
throw (TypeCastException);
44 Vector(
const std::vector<Variant> &value)
throw ();
45 Vector(std::vector<Variant> &&value)
throw ();
49 virtual ~
Vector()
throw ();
52 bool operator==(
const Vector &other)
const throw ();
53 bool operator!=(
const Vector &other)
const throw ();
58 const Variant& operator[](
size_t index)
const throw (RangeException);
59 Variant& operator[](
size_t index)
throw ();
62 iterator begin()
throw ();
63 iterator end()
throw ();
64 const_iterator cbegin()
const throw ();
65 const_iterator cend()
const throw ();
67 const std::vector<Variant>&
get()
const throw (UnsupportedOperatorException);
68 std::vector<Variant>&
get()
throw (UnsupportedOperatorException);
70 size_t size()
const throw ();
71 bool empty()
const throw ();
73 bool erase(
const std::string &key,
int type = 0)
throw ();
74 bool erase(
const Variant &value)
throw ();
75 bool erase(
size_t index)
throw ();
77 virtual void shrink_to_fit()
throw ();
83 virtual void msgpackBufferSize(
size_t &size)
const throw ();
84 virtual std::string str(
int type)
const throw ();
85 virtual int getType(
void)
throw () {
return Type; }
87 static bool isType(
const std::string &value)
throw () {
return isType(value.c_str(), value.size()); }
88 static bool isType(
const char *value,
size_t size)
throw ();
91 std::string json()
const throw ();
92 std::string cjson()
const throw ();
93 std::string xml()
const throw ();
94 std::string csv()
const throw ();
96 void parse(
const std::vector<std::string> &token)
throw (TypeCastException);
99 std::vector<Variant>::iterator it;