dbus-cxx logo
Public Member Functions | Protected Attributes | List of all members
DBus::MessageIterator Class Reference

Extraction iterator allowing values to be retrieved from a message. More...

#include <messageiterator.h>

Public Member Functions

 MessageIterator ()
 
 MessageIterator (const Message &message)
 
 MessageIterator (DBusCxxPointer< Message > message)
 
const Messagemessage () const
 Returns a pointer to the message associated with this iterator or NULL if no message is associated. More...
 
DBusMessageIter * cobj ()
 Returns a pointer to the underlying DBusMessageIter object. More...
 
bool init (const Message &message)
 Initializes the iterator for the specified message. More...
 
void invalidate ()
 Invalidates the iterator. More...
 
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...
 
MessageIteratoroperator++ ()
 
MessageIterator operator++ (int)
 
bool operator== (const MessageIterator &other)
 
Type arg_type () const
 Returns the argument type that the iterator points to. More...
 
Type element_type () const
 Returns the element type of the array that the iterator points to. More...
 
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...
 
MessageIterator recurse ()
 If the iterator points to a container recurses into the container returning a sub-iterator. More...
 
std::string signature () const
 Returns the current signature of the iterator. More...
 
 operator bool ()
 TODO. More...
 
 operator uint8_t ()
 
 operator uint16_t ()
 
 operator int16_t ()
 
 operator uint32_t ()
 
 operator int32_t ()
 
 operator uint64_t ()
 
 operator int64_t ()
 
 operator double ()
 
 operator const char * ()
 
 operator char ()
 
 operator int8_t ()
 
 operator float ()
 
template<typename T >
 operator std::vector< T > ()
 
template<typename Key , typename Data >
 operator std::map< Key, Data > ()
 
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 ()
 
const char * get_string ()
 
FileDescriptor get_filedescriptor ()
 
template<typename T >
void get_array_simple (std::vector< T > &array)
 
template<typename T >
std::vector< T > get_array_simple ()
 
template<typename T >
void get_array_complex (std::vector< T > &array)
 
template<typename T >
std::vector< T > get_array_complex ()
 
template<typename Key , typename Data >
void get_dict (std::map< Key, Data > &dict)
 
template<typename Key , typename Data >
std::map< Key, Data > get_dict ()
 
template<typename Key , typename Data >
MessageIteratoroperator>> (std::map< Key, Data > &m)
 
template<typename T >
MessageIteratoroperator>> (std::vector< T > &v)
 
template<typename T >
MessageIteratoroperator>> (T &v)
 
template<typename T >
MessageIteratoroperator>> (Variant< T > &v)
 
template<typename T >
void value (T &temp)
 

Protected Attributes

const Messagem_message
 
DBusMessageIter m_cobj
 

Detailed Description

Extraction iterator allowing values to be retrieved from a message.

Author
Rick L Vinyard Jr rviny.nosp@m.ard@.nosp@m.cs.nm.nosp@m.su.e.nosp@m.du
Examples:
caller_raw.cpp.

Constructor & Destructor Documentation

DBus::MessageIterator::MessageIterator ( )

References m_cobj.

DBus::MessageIterator::MessageIterator ( const Message message)

References init(), and m_cobj.

DBus::MessageIterator::MessageIterator ( DBusCxxPointer< Message message)

References init(), and m_cobj.

Member Function Documentation

Type DBus::MessageIterator::arg_type ( ) const
DBusMessageIter * DBus::MessageIterator::cobj ( )

Returns a pointer to the underlying DBusMessageIter object.

References m_cobj.

Referenced by get_array_simple(), and operator>>().

Type DBus::MessageIterator::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::checked_type_cast(), m_cobj, DBus::TYPE_ARRAY, and DBus::TYPE_INVALID.

Referenced by get_array_complex(), get_array_simple(), is_dict(), and is_fixed().

template<typename T >
void DBus::MessageIterator::get_array_complex ( std::vector< T > &  array)
inline
template<typename T >
std::vector<T> DBus::MessageIterator::get_array_complex ( )
inline
template<typename T >
void DBus::MessageIterator::get_array_simple ( std::vector< T > &  array)
inline
template<typename T >
std::vector<T> DBus::MessageIterator::get_array_simple ( )
inline
bool DBus::MessageIterator::get_bool ( )
template<typename Key , typename Data >
void DBus::MessageIterator::get_dict ( std::map< Key, Data > &  dict)
inline

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

template<typename Key , typename Data >
std::map<Key,Data> DBus::MessageIterator::get_dict ( )
inline
double DBus::MessageIterator::get_double ( )

References arg_type(), m_cobj, and DBus::TYPE_DOUBLE.

FileDescriptor DBus::MessageIterator::get_filedescriptor ( )
int16_t DBus::MessageIterator::get_int16 ( )

References arg_type(), m_cobj, and DBus::TYPE_INT16.

int32_t DBus::MessageIterator::get_int32 ( )

References arg_type(), m_cobj, and DBus::TYPE_INT32.

int64_t DBus::MessageIterator::get_int64 ( )

References arg_type(), m_cobj, and DBus::TYPE_INT64.

const char * DBus::MessageIterator::get_string ( )
uint16_t DBus::MessageIterator::get_uint16 ( )

References arg_type(), m_cobj, and DBus::TYPE_UINT16.

uint32_t DBus::MessageIterator::get_uint32 ( )

References arg_type(), m_cobj, and DBus::TYPE_UINT32.

uint64_t DBus::MessageIterator::get_uint64 ( )

References arg_type(), m_cobj, and DBus::TYPE_UINT64.

uint8_t DBus::MessageIterator::get_uint8 ( )

References arg_type(), m_cobj, and DBus::TYPE_BYTE.

bool DBus::MessageIterator::has_next ( ) const

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

References is_valid(), and m_cobj.

bool DBus::MessageIterator::init ( const Message message)

Initializes the iterator for the specified message.

References DBus::Message::cobj(), m_cobj, m_message, and message().

Referenced by MessageIterator().

void DBus::MessageIterator::invalidate ( )

Invalidates the iterator.

References m_cobj, and m_message.

Referenced by next().

bool DBus::MessageIterator::is_array ( ) const

True if the iterator points to an array.

References arg_type(), and DBus::TYPE_ARRAY.

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

bool DBus::MessageIterator::is_container ( ) const

True if the iterator points to a container.

References arg_type().

Referenced by recurse().

bool DBus::MessageIterator::is_dict ( ) const

True if the iterator points to a dictionary.

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

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

bool DBus::MessageIterator::is_fixed ( ) const

True if the element type is a fixed type.

References element_type().

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

bool DBus::MessageIterator::is_valid ( ) const

True if this is a valid iterator.

References arg_type(), DBus::Message::is_valid(), m_message, and DBus::TYPE_INVALID.

Referenced by get_array_complex(), get_dict(), has_next(), and next().

const Message * DBus::MessageIterator::message ( ) const

Returns a pointer to the message associated with this iterator or NULL if no message is associated.

References m_message.

Referenced by init().

bool DBus::MessageIterator::next ( )

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

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

References arg_type(), invalidate(), is_valid(), m_cobj, and DBus::TYPE_INVALID.

Referenced by get_dict(), operator++(), and operator>>().

DBus::MessageIterator::operator bool ( )

TODO.

Add support for:

  • dbus_message_iter_get_fixed_array
  • dbus_message_iter_get_array_len

References DBus::TYPE_BOOLEAN, DBus::TYPE_BYTE, DBus::TYPE_DOUBLE, DBus::TYPE_INT16, DBus::TYPE_INT32, DBus::TYPE_INT64, DBus::TYPE_UINT16, DBus::TYPE_UINT32, and DBus::TYPE_UINT64.

DBus::MessageIterator::operator char ( )
DBus::MessageIterator::operator const char * ( )
DBus::MessageIterator::operator double ( )
DBus::MessageIterator::operator float ( )
DBus::MessageIterator::operator int16_t ( )
DBus::MessageIterator::operator int32_t ( )
DBus::MessageIterator::operator int64_t ( )
DBus::MessageIterator::operator int8_t ( )
template<typename Key , typename Data >
DBus::MessageIterator::operator std::map< Key, Data > ( )
inline

References is_dict().

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

References is_array(), and is_fixed().

DBus::MessageIterator::operator uint16_t ( )
DBus::MessageIterator::operator uint32_t ( )
DBus::MessageIterator::operator uint64_t ( )
DBus::MessageIterator::operator uint8_t ( )
MessageIterator & DBus::MessageIterator::operator++ ( )

References next().

MessageIterator DBus::MessageIterator::operator++ ( int  )
bool DBus::MessageIterator::operator== ( const MessageIterator other)

References m_cobj, and m_message.

template<typename Key , typename Data >
MessageIterator& DBus::MessageIterator::operator>> ( std::map< Key, Data > &  m)
inline

References is_dict(), and next().

template<typename T >
MessageIterator& DBus::MessageIterator::operator>> ( std::vector< T > &  v)
inline

References is_array(), is_fixed(), and next().

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

References next().

template<typename T >
MessageIterator& DBus::MessageIterator::operator>> ( Variant< T > &  v)
inline
MessageIterator DBus::MessageIterator::recurse ( )

If the iterator points to a container recurses into the container returning a sub-iterator.

If the iterator does not point to a container returns an empty (invalid) iterator.

References is_container(), m_cobj, and m_message.

Referenced by get_array_complex(), get_array_simple(), get_dict(), and operator>>().

std::string DBus::MessageIterator::signature ( ) const

Returns the current signature of the iterator.

References m_cobj.

template<typename T >
void DBus::MessageIterator::value ( T &  temp)
inline

Member Data Documentation

DBusMessageIter DBus::MessageIterator::m_cobj
protected
const Message* DBus::MessageIterator::m_message
protected

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

Generated on Sun Mar 19 2017 14:54:27 for dbus-cxx by doxygen 1.8.8