1 #ifndef QPID_TYPES_VARIANT_H 2 #define QPID_TYPES_VARIANT_H 29 #include "qpid/types/Exception.h" 30 #include "qpid/sys/IntegerTypes.h" 31 #include "qpid/types/ImportExport.h" 42 QPID_TYPES_EXTERN ~InvalidConversion()
throw();
64 QPID_TYPES_EXTERN std::string getTypeName(VariantType type);
66 QPID_TYPES_EXTERN
bool isIntegerType(VariantType type);
76 typedef std::map<std::string, Variant> Map;
77 typedef std::list<Variant> List;
80 QPID_TYPES_EXTERN Variant(
bool);
81 QPID_TYPES_EXTERN Variant(uint8_t);
82 QPID_TYPES_EXTERN Variant(uint16_t);
83 QPID_TYPES_EXTERN Variant(uint32_t);
84 QPID_TYPES_EXTERN Variant(uint64_t);
85 QPID_TYPES_EXTERN Variant(int8_t);
86 QPID_TYPES_EXTERN Variant(int16_t);
87 QPID_TYPES_EXTERN Variant(int32_t);
88 QPID_TYPES_EXTERN Variant(int64_t);
89 QPID_TYPES_EXTERN Variant(
float);
90 QPID_TYPES_EXTERN Variant(
double);
91 QPID_TYPES_EXTERN Variant(
const std::string&);
92 QPID_TYPES_EXTERN Variant(
const std::string& value,
const std::string& encoding);
93 QPID_TYPES_EXTERN Variant(
const char*);
94 QPID_TYPES_EXTERN Variant(
const char* value,
const char* encoding);
95 QPID_TYPES_EXTERN Variant(
const Map&);
96 QPID_TYPES_EXTERN Variant(
const List&);
97 QPID_TYPES_EXTERN Variant(
const Variant&);
98 QPID_TYPES_EXTERN Variant(
const Uuid&);
100 QPID_TYPES_EXTERN ~Variant();
102 QPID_TYPES_EXTERN VariantType getType()
const;
103 QPID_TYPES_EXTERN
bool isVoid()
const;
105 QPID_TYPES_EXTERN Variant& operator=(
bool);
106 QPID_TYPES_EXTERN Variant& operator=(uint8_t);
107 QPID_TYPES_EXTERN Variant& operator=(uint16_t);
108 QPID_TYPES_EXTERN Variant& operator=(uint32_t);
109 QPID_TYPES_EXTERN Variant& operator=(uint64_t);
110 QPID_TYPES_EXTERN Variant& operator=(int8_t);
111 QPID_TYPES_EXTERN Variant& operator=(int16_t);
112 QPID_TYPES_EXTERN Variant& operator=(int32_t);
113 QPID_TYPES_EXTERN Variant& operator=(int64_t);
114 QPID_TYPES_EXTERN Variant& operator=(
float);
115 QPID_TYPES_EXTERN Variant& operator=(
double);
116 QPID_TYPES_EXTERN Variant& operator=(
const std::string&);
117 QPID_TYPES_EXTERN Variant& operator=(
const char*);
118 QPID_TYPES_EXTERN Variant& operator=(
const Map&);
119 QPID_TYPES_EXTERN Variant& operator=(
const List&);
120 QPID_TYPES_EXTERN Variant& operator=(
const Variant&);
121 QPID_TYPES_EXTERN Variant& operator=(
const Uuid&);
127 QPID_TYPES_EXTERN Variant& parse(
const std::string&);
129 QPID_TYPES_EXTERN
bool asBool()
const;
130 QPID_TYPES_EXTERN uint8_t asUint8()
const;
131 QPID_TYPES_EXTERN uint16_t asUint16()
const;
132 QPID_TYPES_EXTERN uint32_t asUint32()
const;
133 QPID_TYPES_EXTERN uint64_t asUint64()
const;
134 QPID_TYPES_EXTERN int8_t asInt8()
const;
135 QPID_TYPES_EXTERN int16_t asInt16()
const;
136 QPID_TYPES_EXTERN int32_t asInt32()
const;
137 QPID_TYPES_EXTERN int64_t asInt64()
const;
138 QPID_TYPES_EXTERN
float asFloat()
const;
139 QPID_TYPES_EXTERN
double asDouble()
const;
140 QPID_TYPES_EXTERN std::string asString()
const;
141 QPID_TYPES_EXTERN
Uuid asUuid()
const;
143 QPID_TYPES_EXTERN
operator bool()
const;
144 QPID_TYPES_EXTERN
operator uint8_t()
const;
145 QPID_TYPES_EXTERN
operator uint16_t()
const;
146 QPID_TYPES_EXTERN
operator uint32_t()
const;
147 QPID_TYPES_EXTERN
operator uint64_t()
const;
148 QPID_TYPES_EXTERN
operator int8_t()
const;
149 QPID_TYPES_EXTERN
operator int16_t()
const;
150 QPID_TYPES_EXTERN
operator int32_t()
const;
151 QPID_TYPES_EXTERN
operator int64_t()
const;
152 QPID_TYPES_EXTERN
operator float()
const;
153 QPID_TYPES_EXTERN
operator double()
const;
154 QPID_TYPES_EXTERN
operator std::string()
const;
155 QPID_TYPES_EXTERN
operator Uuid()
const;
157 QPID_TYPES_EXTERN
const Map& asMap()
const;
158 QPID_TYPES_EXTERN Map& asMap();
159 QPID_TYPES_EXTERN
const List& asList()
const;
160 QPID_TYPES_EXTERN List& asList();
166 QPID_TYPES_EXTERN
const std::string& getString()
const;
167 QPID_TYPES_EXTERN std::string& getString();
169 QPID_TYPES_EXTERN
void setEncoding(
const std::string&);
170 QPID_TYPES_EXTERN
const std::string& getEncoding()
const;
172 QPID_TYPES_EXTERN
bool isEqualTo(
const Variant& a)
const;
175 QPID_TYPES_EXTERN
void reset();
178 QPID_TYPES_EXTERN
bool isDescribed()
const;
188 QPID_TYPES_EXTERN Variant getDescriptor()
const;
191 QPID_TYPES_EXTERN
void setDescriptor(
const Variant& descriptor);
197 QPID_TYPES_EXTERN List& getDescriptors();
203 QPID_TYPES_EXTERN
const List& getDescriptors()
const;
206 QPID_TYPES_EXTERN
static Variant described(
const Variant& descriptor,
const Variant& value);
209 QPID_TYPES_EXTERN
static Variant described(
const Variant& descriptor,
const List& value);
212 mutable VariantImpl* impl;
216 QPID_TYPES_EXTERN std::ostream& operator<<(std::ostream& out,
const Variant& value);
217 QPID_TYPES_EXTERN std::ostream& operator<<(std::ostream& out,
const Variant::Map& map);
218 QPID_TYPES_EXTERN std::ostream& operator<<(std::ostream& out,
const Variant::List& list);
219 QPID_TYPES_EXTERN
bool operator==(
const Variant& a,
const Variant& b);
220 QPID_TYPES_EXTERN
bool operator!=(
const Variant& a,
const Variant& b);
Definition: Exception.h:31