DBus::priv::VariantIterator Class Reference

#include <variantiterator.h>

Public Member Functions

 VariantIterator ()
 
 VariantIterator (const Variant *variant)
 
VariantIteratoroperator>> (Variant &v)
 
template<typename T >
VariantIteratoroperator>> (T &v)
 
 operator bool ()
 
 operator uint8_t ()
 
 operator uint16_t ()
 
 operator int16_t ()
 
 operator uint32_t ()
 
 operator int32_t ()
 
 operator uint64_t ()
 
 operator int64_t ()
 
 operator double ()
 
 operator std::string ()
 
 operator DBus::Variant ()
 
template<typename T >
 operator std::vector< T > ()
 
template<typename Key , typename Data >
 operator std::map< Key, Data > ()
 
template<typename ... T>
 operator std::tuple< T... > ()
 
bool get_bool ()
 
uint8_t get_uint8 ()
 
uint16_t get_uint16 ()
 
int16_t get_int16 ()
 
uint32_t get_uint32 ()
 
int32_t get_int32 ()
 
uint64_t get_uint64 ()
 
int64_t get_int64 ()
 
double get_double ()
 
std::string get_string ()
 
Variant get_variant ()
 
Signature get_signature ()
 
void invalidate ()
 
bool is_valid () const
 True if this is a valid iterator. More...
 
bool has_next () const
 True if there are any more fields left to iterate over. More...
 
bool next ()
 Moves the iterator to the next field and invalidates it if it moves beyond the last field. More...
 
DataType arg_type () const
 Returns the argument type that the iterator points to. More...
 
DataType element_type () const
 Returns the element type of the array that the iterator points to. More...
 
VariantIteratoroperator++ ()
 
VariantIterator operator++ (int)
 
VariantIterator recurse ()
 
bool is_fixed () const
 True if the element type is a fixed type. More...
 
bool is_container () const
 True if the iterator points to a container. More...
 
bool is_array () const
 True if the iterator points to an array. More...
 
bool is_dict () const
 True if the iterator points to a dictionary. More...
 

Private Member Functions

 VariantIterator (DataType d, SignatureIterator sig, const Variant *variant, std::shared_ptr< Demarshaling > demarshal)
 Create a new sub-iterator. More...
 

Private Attributes

std::shared_ptr< priv_data > m_priv
 

Constructor & Destructor Documentation

◆ VariantIterator() [1/3]

VariantIterator::VariantIterator ( DataType  d,
SignatureIterator  sig,
const Variant variant,
std::shared_ptr< Demarshaling demarshal 
)
private

Create a new sub-iterator.

Parameters
dThe data type we are iterating over
sigThe signature within the data type
variantOur parent variant
demarshalThe demarshaller

References DBus::ARRAY, DBus::Signature::begin(), DBus::DICT_ENTRY, m_priv, DBus::STRUCT, and DBus::VARIANT.

◆ VariantIterator() [2/3]

VariantIterator::VariantIterator ( )

References m_priv.

Referenced by recurse().

◆ VariantIterator() [3/3]

VariantIterator::VariantIterator ( const Variant variant)

Member Function Documentation

◆ arg_type()

DBus::DataType VariantIterator::arg_type ( ) const

◆ element_type()

DBus::DataType VariantIterator::element_type ( ) const

Returns the element type of the array that the iterator points to.

If the iterator does not point to an array TYPE_INVALID is returned.

References arg_type(), DBus::ARRAY, DBus::INVALID, and m_priv.

Referenced by is_dict().

◆ get_bool()

bool VariantIterator::get_bool ( )

References arg_type(), DBus::BOOLEAN, and m_priv.

Referenced by DBus::Variant::to_bool().

◆ get_double()

double VariantIterator::get_double ( )

References arg_type(), DBus::DOUBLE, and m_priv.

Referenced by DBus::Variant::to_double().

◆ get_int16()

int16_t VariantIterator::get_int16 ( )

References arg_type(), DBus::INT16, and m_priv.

Referenced by DBus::Variant::to_int16().

◆ get_int32()

int32_t VariantIterator::get_int32 ( )

References arg_type(), DBus::INT32, and m_priv.

Referenced by DBus::Variant::to_int32().

◆ get_int64()

int64_t VariantIterator::get_int64 ( )

References arg_type(), DBus::INT64, and m_priv.

Referenced by DBus::Variant::to_int64().

◆ get_signature()

DBus::Signature VariantIterator::get_signature ( )

References m_priv.

Referenced by DBus::Variant::to_signature().

◆ get_string()

std::string VariantIterator::get_string ( )

◆ get_uint16()

uint16_t VariantIterator::get_uint16 ( )

References arg_type(), m_priv, and DBus::UINT16.

Referenced by DBus::Variant::to_uint16().

◆ get_uint32()

uint32_t VariantIterator::get_uint32 ( )

References arg_type(), m_priv, and DBus::UINT32.

Referenced by DBus::Variant::to_uint32().

◆ get_uint64()

uint64_t VariantIterator::get_uint64 ( )

References arg_type(), m_priv, and DBus::UINT64.

Referenced by DBus::Variant::to_uint64().

◆ get_uint8()

uint8_t VariantIterator::get_uint8 ( )

References arg_type(), DBus::BYTE, and m_priv.

Referenced by DBus::Variant::to_uint8().

◆ get_variant()

DBus::Variant VariantIterator::get_variant ( )

◆ has_next()

bool VariantIterator::has_next ( ) const

True if there are any more fields left to iterate over.

References is_valid(), and m_priv.

◆ invalidate()

void VariantIterator::invalidate ( )

References m_priv.

Referenced by next().

◆ is_array()

bool VariantIterator::is_array ( ) const

True if the iterator points to an array.

References arg_type(), and DBus::ARRAY.

Referenced by is_dict(), and operator std::vector< T >().

◆ is_container()

bool VariantIterator::is_container ( ) const

True if the iterator points to a container.

References arg_type(), and DBus::TypeInfo::is_container().

Referenced by recurse().

◆ is_dict()

bool VariantIterator::is_dict ( ) const

True if the iterator points to a dictionary.

References DBus::DICT_ENTRY, element_type(), and is_array().

Referenced by operator std::map< Key, Data >().

◆ is_fixed()

bool VariantIterator::is_fixed ( ) const

True if the element type is a fixed type.

References arg_type(), and DBus::TypeInfo::is_fixed().

◆ is_valid()

bool VariantIterator::is_valid ( ) const

True if this is a valid iterator.

References arg_type(), DBus::ARRAY, DBus::INVALID, and m_priv.

Referenced by has_next(), next(), operator std::map< Key, Data >(), and operator std::vector< T >().

◆ next()

bool VariantIterator::next ( )

Moves the iterator to the next field and invalidates it if it moves beyond the last field.

It is an error to call this function more than once in a row without a corresponding call to get_XXX/operator XXX.

Returns
true if the iterator moves forward, false if there is no next field and the iterator has been invalidated

References arg_type(), DBus::ARRAY, DBus::INVALID, invalidate(), is_valid(), and m_priv.

Referenced by operator std::map< Key, Data >(), operator++(), and operator>>().

◆ operator bool()

◆ operator DBus::Variant()

VariantIterator::operator DBus::Variant ( )

References DBus::VARIANT.

◆ operator double()

VariantIterator::operator double ( )

◆ operator int16_t()

VariantIterator::operator int16_t ( )

◆ operator int32_t()

VariantIterator::operator int32_t ( )

◆ operator int64_t()

VariantIterator::operator int64_t ( )

◆ operator std::map< Key, Data >()

template<typename Key , typename Data >
DBus::priv::VariantIterator::operator std::map< Key, Data > ( )
inline

References is_dict(), is_valid(), next(), and recurse().

◆ operator std::string()

VariantIterator::operator std::string ( )

◆ operator std::tuple< T... >()

template<typename ... T>
DBus::priv::VariantIterator::operator std::tuple< T... > ( )
inline

References recurse().

◆ operator std::vector< T >()

template<typename T >
DBus::priv::VariantIterator::operator std::vector< T > ( )
inline

References is_array(), is_valid(), and recurse().

◆ operator uint16_t()

VariantIterator::operator uint16_t ( )

◆ operator uint32_t()

VariantIterator::operator uint32_t ( )

◆ operator uint64_t()

VariantIterator::operator uint64_t ( )

◆ operator uint8_t()

VariantIterator::operator uint8_t ( )

◆ operator++() [1/2]

VariantIterator & VariantIterator::operator++ ( )

References next().

◆ operator++() [2/2]

VariantIterator VariantIterator::operator++ ( int  )

◆ operator>>() [1/2]

template<typename T >
VariantIterator& DBus::priv::VariantIterator::operator>> ( T &  v)
inline

References next().

◆ operator>>() [2/2]

VariantIterator & VariantIterator::operator>> ( Variant v)

References next().

◆ recurse()

Member Data Documentation

◆ m_priv


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