Extraction iterator allowing values to be retrieved from a message. More...
#include <messageiterator.h>
Public Member Functions | |
MessageIterator () | |
MessageIterator (const Message &message) | |
MessageIterator (std::shared_ptr< Message > message) | |
const Message * | message () const |
Returns a pointer to the message associated with this iterator or NULL if no message is associated. 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... | |
MessageIterator & | operator++ () |
MessageIterator | operator++ (int) |
bool | operator== (const MessageIterator &other) |
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... | |
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 () | |
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 std::shared_ptr< FileDescriptor > () | |
operator 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... > () | |
template<typename... T> | |
operator DBus::MultipleReturn< 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 () |
std::shared_ptr< FileDescriptor > | get_filedescriptor () |
Variant | get_variant () |
Signature | get_signature () |
template<typename T > | |
void | get_array (std::vector< T > &array) |
Get values in an array, pushing them back one at a time. More... | |
template<typename... T> | |
void | get_struct (std::tuple< T... > &tup) |
template<typename Key , typename Data > | |
void | get_dict (std::map< Key, Data > &dict) |
template<typename... T> | |
void | get_multiplereturn (MultipleReturn< T... > &v) |
template<typename Key , typename Data > | |
std::map< Key, Data > | get_dict () |
template<typename Key , typename Data > | |
MessageIterator & | operator>> (std::map< Key, Data > &m) |
template<typename... T> | |
MessageIterator & | operator>> (std::tuple< T... > &v) |
template<typename T > | |
MessageIterator & | operator>> (std::vector< T > &v) |
MessageIterator & | operator>> (Variant &v) |
template<typename ... T> | |
MessageIterator & | operator>> (MultipleReturn< T... > &v) |
template<typename T > | |
MessageIterator & | operator>> (T &v) |
template<typename T > | |
T | get () |
Private Member Functions | |
MessageIterator (DataType d, SignatureIterator sig, const Message *message, std::shared_ptr< Demarshaling > demarshal) | |
Create a new sub-iterator. More... | |
SignatureIterator | signature_iterator () |
void | align (int alignment) |
Align our memory to the specified location. More... | |
Private Attributes | |
std::shared_ptr< priv_data > | m_priv |
Friends | |
class | Variant |
Extraction iterator allowing values to be retrieved from a message.
|
private |
Create a new sub-iterator.
d | The data type we are iterating over |
sig | The signature within the data type |
message | Our parent message |
demarshal | The demarshaller |
References DBus::ARRAY, DBus::DICT_ENTRY, LOGGER_NAME, m_priv, message(), and DBus::STRUCT.
DBus::MessageIterator::MessageIterator | ( | ) |
References DBus::INVALID, and m_priv.
Referenced by recurse().
DBus::MessageIterator::MessageIterator | ( | const Message & | message | ) |
References DBus::INVALID, m_priv, and message().
DBus::MessageIterator::MessageIterator | ( | std::shared_ptr< Message > | message | ) |
References DBus::INVALID, m_priv, and message().
|
private |
Align our memory to the specified location.
This skips bytes. This is for internal use only; don't call it in client code!
alignment |
References m_priv.
DataType DBus::MessageIterator::arg_type | ( | ) | const |
Returns the argument type that the iterator points to.
References m_priv.
Referenced by element_type(), get_bool(), get_double(), get_int16(), get_int32(), get_int64(), get_string(), get_uint16(), get_uint32(), get_uint64(), get_uint8(), is_array(), is_container(), is_fixed(), is_valid(), and next().
DataType 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::ARRAY, DBus::INVALID, and m_priv.
Referenced by is_dict().
|
inline |
References next().
|
inline |
Get values in an array, pushing them back one at a time.
References is_array(), is_valid(), and recurse().
bool DBus::MessageIterator::get_bool | ( | ) |
References arg_type(), DBus::BOOLEAN, and m_priv.
|
inline |
|
inline |
References is_valid(), next(), and recurse().
double DBus::MessageIterator::get_double | ( | ) |
References arg_type(), DBus::DOUBLE, and m_priv.
std::shared_ptr< FileDescriptor > DBus::MessageIterator::get_filedescriptor | ( | ) |
References DBus::FileDescriptor::create(), and m_priv.
int16_t DBus::MessageIterator::get_int16 | ( | ) |
References arg_type(), DBus::INT16, and m_priv.
int32_t DBus::MessageIterator::get_int32 | ( | ) |
References arg_type(), DBus::INT32, and m_priv.
int64_t DBus::MessageIterator::get_int64 | ( | ) |
References arg_type(), DBus::INT64, and m_priv.
|
inline |
References DBus::MultipleReturn< Ts >::m_data.
Referenced by operator DBus::MultipleReturn< T... >(), and operator>>().
Signature DBus::MessageIterator::get_signature | ( | ) |
References m_priv.
Referenced by get_variant().
std::string DBus::MessageIterator::get_string | ( | ) |
References arg_type(), m_priv, DBus::OBJECT_PATH, DBus::SIGNATURE, and DBus::STRING.
|
inline |
References recurse().
Referenced by operator std::tuple< T... >(), and operator>>().
uint16_t DBus::MessageIterator::get_uint16 | ( | ) |
References arg_type(), m_priv, and DBus::UINT16.
uint32_t DBus::MessageIterator::get_uint32 | ( | ) |
References arg_type(), m_priv, and DBus::UINT32.
uint64_t DBus::MessageIterator::get_uint64 | ( | ) |
References arg_type(), m_priv, and DBus::UINT64.
uint8_t DBus::MessageIterator::get_uint8 | ( | ) |
References arg_type(), DBus::BYTE, and m_priv.
Variant DBus::MessageIterator::get_variant | ( | ) |
References DBus::Variant::createFromDemarshal(), get_signature(), and m_priv.
Referenced by operator>>().
bool DBus::MessageIterator::has_next | ( | ) | const |
True if there are any more fields left to iterate over.
References is_valid(), and m_priv.
void DBus::MessageIterator::invalidate | ( | ) |
bool DBus::MessageIterator::is_array | ( | ) | const |
True if the iterator points to an array.
References arg_type(), and DBus::ARRAY.
Referenced by get_array(), 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(), and DBus::TypeInfo::is_container().
Referenced by recurse().
bool DBus::MessageIterator::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 >(), and operator>>().
bool DBus::MessageIterator::is_fixed | ( | ) | const |
True if the element type is a fixed type.
References arg_type(), and DBus::TypeInfo::is_fixed().
bool DBus::MessageIterator::is_valid | ( | ) | const |
True if this is a valid iterator.
References arg_type(), DBus::ARRAY, DBus::INVALID, LOGGER_NAME, and m_priv.
Referenced by get_array(), 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_priv.
Referenced by MessageIterator().
bool DBus::MessageIterator::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.
References arg_type(), DBus::ARRAY, DBus::INVALID, invalidate(), is_valid(), and m_priv.
Referenced by get(), get_dict(), operator++(), and operator>>().
DBus::MessageIterator::operator bool | ( | ) |
References DBus::BOOLEAN, DBus::BYTE, DBus::DOUBLE, DBus::INT16, DBus::INT32, DBus::INT64, DBus::UINT16, DBus::UINT32, and DBus::UINT64.
|
inline |
References get_multiplereturn().
DBus::MessageIterator::operator double | ( | ) |
References DBus::BOOLEAN, DBus::BYTE, DBus::DOUBLE, DBus::INT16, DBus::INT32, DBus::INT64, DBus::UINT16, DBus::UINT32, and DBus::UINT64.
DBus::MessageIterator::operator int16_t | ( | ) |
References DBus::BOOLEAN, DBus::BYTE, DBus::DOUBLE, DBus::INT16, DBus::INT32, DBus::INT64, DBus::UINT16, DBus::UINT32, and DBus::UINT64.
DBus::MessageIterator::operator int32_t | ( | ) |
References DBus::BOOLEAN, DBus::BYTE, DBus::DOUBLE, DBus::INT16, DBus::INT32, DBus::INT64, DBus::UINT16, DBus::UINT32, and DBus::UINT64.
DBus::MessageIterator::operator int64_t | ( | ) |
References DBus::BOOLEAN, DBus::BYTE, DBus::DOUBLE, DBus::INT16, DBus::INT32, DBus::INT64, DBus::UINT16, DBus::UINT32, and DBus::UINT64.
|
inline |
References is_dict().
DBus::MessageIterator::operator std::shared_ptr< FileDescriptor > | ( | ) |
References DBus::UNIX_FD.
DBus::MessageIterator::operator std::string | ( | ) |
References DBus::OBJECT_PATH, DBus::SIGNATURE, and DBus::STRING.
|
inline |
References get_struct().
|
inline |
References is_array().
DBus::MessageIterator::operator uint16_t | ( | ) |
References DBus::BOOLEAN, DBus::BYTE, DBus::DOUBLE, DBus::INT16, DBus::INT32, DBus::INT64, DBus::UINT16, DBus::UINT32, and DBus::UINT64.
DBus::MessageIterator::operator uint32_t | ( | ) |
References DBus::BOOLEAN, DBus::BYTE, DBus::DOUBLE, DBus::INT16, DBus::INT32, DBus::INT64, DBus::UINT16, DBus::UINT32, and DBus::UINT64.
DBus::MessageIterator::operator uint64_t | ( | ) |
References DBus::BOOLEAN, DBus::BYTE, DBus::DOUBLE, DBus::INT16, DBus::INT32, DBus::INT64, DBus::UINT16, DBus::UINT32, and DBus::UINT64.
DBus::MessageIterator::operator uint8_t | ( | ) |
References DBus::BOOLEAN, DBus::BYTE, DBus::DOUBLE, DBus::INT16, DBus::INT32, DBus::INT64, DBus::UINT16, DBus::UINT32, and DBus::UINT64.
DBus::MessageIterator::operator Variant | ( | ) |
References DBus::VARIANT.
MessageIterator & DBus::MessageIterator::operator++ | ( | ) |
References next().
MessageIterator DBus::MessageIterator::operator++ | ( | int | ) |
bool DBus::MessageIterator::operator== | ( | const MessageIterator & | other | ) |
References m_priv.
|
inline |
References get_multiplereturn(), and next().
|
inline |
|
inline |
References get_struct(), and next().
|
inline |
References is_array(), and next().
|
inline |
References next().
|
inline |
References get_variant(), and next().
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_priv, and MessageIterator().
Referenced by get_array(), get_dict(), and get_struct().
std::string DBus::MessageIterator::signature | ( | ) | const |
Returns the current signature of the iterator.
References m_priv.
|
private |
References m_priv.
|
friend |
|
private |
Referenced by align(), arg_type(), element_type(), get_bool(), get_double(), get_filedescriptor(), get_int16(), get_int32(), get_int64(), get_signature(), get_string(), get_uint16(), get_uint32(), get_uint64(), get_uint8(), get_variant(), has_next(), invalidate(), is_valid(), message(), MessageIterator(), next(), operator==(), recurse(), signature(), and signature_iterator().