A holder for any AMQP value, simple or complex. More...
#include <value.hpp>
Inherits proton::internal::value_base.
Public Member Functions | |
value () | |
Create a null value. | |
template<class T > | |
value (const T &x, typename assignable< T >::type *=0) | |
Copy from any allowed type T. | |
template<class T > | |
assignable< T, value & >::type | operator= (const T &x) |
Assign from any allowed type T. | |
type_id | type () const |
Get the type ID for the current value. | |
bool | empty () const |
True if the value is null. | |
void | clear () |
Reset the value to null/empty. | |
value (pn_data_t *d) | |
INTERNAL Used to refer to existing pn_data_t* values as proton::value | |
void | reset (pn_data_t *d=0) |
Copy a value | |
value (const value &) | |
value & | operator= (const value &) |
value (value &&) | |
value & | operator= (value &&) |
Friends | |
void | swap (value &, value &) |
std::ostream & | operator<< (std::ostream &, const value &) |
If contained value is a scalar type T, print using operator<<(T). | |
Comparison operators | |
bool | operator== (const value &x, const value &y) |
bool | operator< (const value &x, const value &y) |
Related Functions | |
(Note that these are not member functions.) | |
template<class T > | |
T | get (const value &v) |
template<class T > | |
void | get (const value &v, T &x) |
Like get(const value&) but extracts the value to a reference x instead of returning it. | |
template<class T , class U > | |
void | get (const U &u, T &x) |
template<class T > | |
T | coerce (const value &v) |
template<class T > | |
void | coerce (const value &v, T &x) |
Like coerce(const value&) but assigns the value to a reference instead of returning it. |
A holder for any AMQP value, simple or complex.
std::ostream& operator<< | ( | std::ostream & | , | |
const value & | ||||
) | [friend] |
T get | ( | const value & | v | ) | [related] |
Get a contained value of type T. For example:uint64_t i = get<uint64_t>(x)This will succeed if and only if x contains a uint64_t value.
conversion_error | if contained value is not of type T. |
void get | ( | const value & | v, | |
T & | x | |||
) | [related] |
Like get(const value&) but extracts the value to a reference x
instead of returning it.
May be more efficient for complex values (arrays, maps, etc.)
void get | ( | const U & | u, | |
T & | x | |||
) | [related] |
T coerce | ( | const value & | v | ) | [related] |
Coerce the contained value to type T. For example:uint64_t i = coerce<uint64_t>(x)This will succeed if x contains any numeric value, but may lose precision if it contains a float or double value.
conversion_error | if the value cannot be converted to T according to `stdis_convertible` |
void coerce | ( | const value & | v, | |
T & | x | |||
) | [related] |
Like coerce(const value&) but assigns the value to a reference instead of returning it.
May be more efficient for complex values (arrays, maps, etc.)