Qpid C++ Messaging API  1.37.0
qpid::types::Variant Class Reference

#include <Variant.h>

Public Types

typedef std::map< std::string, VariantMap
 
typedef std::list< VariantList
 

Public Member Functions

QPID_TYPES_EXTERN Variant (bool)
 
QPID_TYPES_EXTERN Variant (uint8_t)
 
QPID_TYPES_EXTERN Variant (uint16_t)
 
QPID_TYPES_EXTERN Variant (uint32_t)
 
QPID_TYPES_EXTERN Variant (uint64_t)
 
QPID_TYPES_EXTERN Variant (int8_t)
 
QPID_TYPES_EXTERN Variant (int16_t)
 
QPID_TYPES_EXTERN Variant (int32_t)
 
QPID_TYPES_EXTERN Variant (int64_t)
 
QPID_TYPES_EXTERN Variant (float)
 
QPID_TYPES_EXTERN Variant (double)
 
QPID_TYPES_EXTERN Variant (const std::string &)
 
QPID_TYPES_EXTERN Variant (const std::string &value, const std::string &encoding)
 
QPID_TYPES_EXTERN Variant (const char *)
 
QPID_TYPES_EXTERN Variant (const char *value, const char *encoding)
 
QPID_TYPES_EXTERN Variant (const Map &)
 
QPID_TYPES_EXTERN Variant (const List &)
 
QPID_TYPES_EXTERN Variant (const Variant &)
 
QPID_TYPES_EXTERN Variant (const Uuid &)
 
QPID_TYPES_EXTERN VariantType getType () const
 
QPID_TYPES_EXTERN bool isVoid () const
 
QPID_TYPES_EXTERN Variantoperator= (bool)
 
QPID_TYPES_EXTERN Variantoperator= (uint8_t)
 
QPID_TYPES_EXTERN Variantoperator= (uint16_t)
 
QPID_TYPES_EXTERN Variantoperator= (uint32_t)
 
QPID_TYPES_EXTERN Variantoperator= (uint64_t)
 
QPID_TYPES_EXTERN Variantoperator= (int8_t)
 
QPID_TYPES_EXTERN Variantoperator= (int16_t)
 
QPID_TYPES_EXTERN Variantoperator= (int32_t)
 
QPID_TYPES_EXTERN Variantoperator= (int64_t)
 
QPID_TYPES_EXTERN Variantoperator= (float)
 
QPID_TYPES_EXTERN Variantoperator= (double)
 
QPID_TYPES_EXTERN Variantoperator= (const std::string &)
 
QPID_TYPES_EXTERN Variantoperator= (const char *)
 
QPID_TYPES_EXTERN Variantoperator= (const Map &)
 
QPID_TYPES_EXTERN Variantoperator= (const List &)
 
QPID_TYPES_EXTERN Variantoperator= (const Variant &)
 
QPID_TYPES_EXTERN Variantoperator= (const Uuid &)
 
QPID_TYPES_EXTERN Variantparse (const std::string &)
 
QPID_TYPES_EXTERN bool asBool () const
 
QPID_TYPES_EXTERN uint8_t asUint8 () const
 
QPID_TYPES_EXTERN uint16_t asUint16 () const
 
QPID_TYPES_EXTERN uint32_t asUint32 () const
 
QPID_TYPES_EXTERN uint64_t asUint64 () const
 
QPID_TYPES_EXTERN int8_t asInt8 () const
 
QPID_TYPES_EXTERN int16_t asInt16 () const
 
QPID_TYPES_EXTERN int32_t asInt32 () const
 
QPID_TYPES_EXTERN int64_t asInt64 () const
 
QPID_TYPES_EXTERN float asFloat () const
 
QPID_TYPES_EXTERN double asDouble () const
 
QPID_TYPES_EXTERN std::string asString () const
 
QPID_TYPES_EXTERN Uuid asUuid () const
 
QPID_TYPES_EXTERN operator bool () const
 
QPID_TYPES_EXTERN operator uint8_t () const
 
QPID_TYPES_EXTERN operator uint16_t () const
 
QPID_TYPES_EXTERN operator uint32_t () const
 
QPID_TYPES_EXTERN operator uint64_t () const
 
QPID_TYPES_EXTERN operator int8_t () const
 
QPID_TYPES_EXTERN operator int16_t () const
 
QPID_TYPES_EXTERN operator int32_t () const
 
QPID_TYPES_EXTERN operator int64_t () const
 
QPID_TYPES_EXTERN operator float () const
 
QPID_TYPES_EXTERN operator double () const
 
QPID_TYPES_EXTERN operator std::string () const
 
QPID_TYPES_EXTERN operator Uuid () const
 
QPID_TYPES_EXTERN const Map & asMap () const
 
QPID_TYPES_EXTERN Map & asMap ()
 
QPID_TYPES_EXTERN const List & asList () const
 
QPID_TYPES_EXTERN List & asList ()
 
QPID_TYPES_EXTERN const std::string & getString () const
 
QPID_TYPES_EXTERN std::string & getString ()
 
QPID_TYPES_EXTERN void setEncoding (const std::string &)
 
QPID_TYPES_EXTERN const std::string & getEncoding () const
 
QPID_TYPES_EXTERN bool isEqualTo (const Variant &a) const
 
QPID_TYPES_EXTERN void reset ()
 
QPID_TYPES_EXTERN bool isDescribed () const
 
QPID_TYPES_EXTERN Variant getDescriptor () const
 
QPID_TYPES_EXTERN void setDescriptor (const Variant &descriptor)
 
QPID_TYPES_EXTERN List & getDescriptors ()
 
QPID_TYPES_EXTERN const List & getDescriptors () const
 

Static Public Member Functions

static QPID_TYPES_EXTERN Variant described (const Variant &descriptor, const Variant &value)
 
static QPID_TYPES_EXTERN Variant described (const Variant &descriptor, const List &value)
 

Detailed Description

Represents a value of variable type.

Member Function Documentation

◆ described() [1/2]

static QPID_TYPES_EXTERN Variant qpid::types::Variant::described ( const Variant descriptor,
const Variant value 
)
static

Create a described value

◆ described() [2/2]

static QPID_TYPES_EXTERN Variant qpid::types::Variant::described ( const Variant descriptor,
const List &  value 
)
static

Create a described list, a common special case

◆ getDescriptor()

QPID_TYPES_EXTERN Variant qpid::types::Variant::getDescriptor ( ) const

Get the first descriptor associated with this variant.

Normally there is at most one descriptor, when there are multiple descriptors use getDescriptors()

Returns
The first descriptor or VOID if there is no descriptor.
See also
isDescribed, getDescriptors

◆ getDescriptors() [1/2]

QPID_TYPES_EXTERN List& qpid::types::Variant::getDescriptors ( )

Return a modifiable list of descriptors for this Variant. Used in case where there are multiple descriptors, for a single descriptor use getDescriptor and setDescriptor.

◆ getDescriptors() [2/2]

QPID_TYPES_EXTERN const List& qpid::types::Variant::getDescriptors ( ) const

Return the list of descriptors for this Variant. Used in case where there are multiple descriptors, for a single descriptor use getDescriptor and setDescriptor.

◆ getString()

QPID_TYPES_EXTERN const std::string& qpid::types::Variant::getString ( ) const

Unlike asString(), getString() will not do any conversions.

Exceptions
InvalidConversionif the type is not STRING.

◆ isDescribed()

QPID_TYPES_EXTERN bool qpid::types::Variant::isDescribed ( ) const

True if there is at least one descriptor associated with this variant.

◆ parse()

QPID_TYPES_EXTERN Variant& qpid::types::Variant::parse ( const std::string &  )

Parses the argument and assigns itself the appropriate value. Recognises integers, doubles and booleans.

◆ reset()

QPID_TYPES_EXTERN void qpid::types::Variant::reset ( )

Reset value to VOID, does not reset the descriptors.

◆ setDescriptor()

QPID_TYPES_EXTERN void qpid::types::Variant::setDescriptor ( const Variant descriptor)

Set a single descriptor for this Variant. The descriptor must be a string or integer.


The documentation for this class was generated from the following file: