A SignatureIterator allows you to iterate over a given DBus signature, and to extract useful information out of the signature. More...
#include <signatureiterator.h>
Public Member Functions | |
SignatureIterator () | |
SignatureIterator (const SignatureIterator &other) | |
SignatureIterator (std::shared_ptr< priv::SignatureNode > startnode) | |
~SignatureIterator () | |
void | invalidate () |
Invalidates the iterator. More... | |
bool | is_valid () const |
True if this is a valid iterator. More... | |
operator bool () const | |
True if the iterator is valid and initialized, false otherwise. More... | |
bool | next () |
Moves the iterator to the next field and invalidates it if it moves beyond the last field. More... | |
bool | has_next () const |
See if this iterator can advance. More... | |
SignatureIterator & | operator++ () |
SignatureIterator | operator++ (int) |
SignatureIterator & | operator= (const SignatureIterator &other) |
bool | operator== (const SignatureIterator &other) |
DataType | 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_basic () const |
True if the element type is a basic type. 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... | |
SignatureIterator | 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... | |
Private Member Functions | |
std::string | iterate_over_subsig (std::shared_ptr< priv::SignatureNode > start) const |
DBUS_CXX_PROPAGATE_CONST (std::unique_ptr< priv_data >) m_priv | |
A SignatureIterator allows you to iterate over a given DBus signature, and to extract useful information out of the signature.
Note that you must have a valid signature before you can create a SignatureIterator. Don't create this class directly; it can only be created from the Signature class.
DBus::SignatureIterator::SignatureIterator | ( | ) |
Referenced by recurse().
DBus::SignatureIterator::SignatureIterator | ( | const SignatureIterator & | other | ) |
DBus::SignatureIterator::SignatureIterator | ( | std::shared_ptr< priv::SignatureNode > | startnode | ) |
DBus::SignatureIterator::~SignatureIterator | ( | ) |
|
private |
DataType DBus::SignatureIterator::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 DBus::ARRAY, DBus::INVALID, and type().
Referenced by is_dict().
bool DBus::SignatureIterator::has_next | ( | ) | const |
See if this iterator can advance.
void DBus::SignatureIterator::invalidate | ( | ) |
Invalidates the iterator.
bool DBus::SignatureIterator::is_array | ( | ) | const |
True if the iterator points to an array.
References DBus::ARRAY, and type().
Referenced by is_dict().
bool DBus::SignatureIterator::is_basic | ( | ) | const |
True if the element type is a basic type.
References DBus::TypeInfo::is_basic(), and type().
bool DBus::SignatureIterator::is_container | ( | ) | const |
True if the iterator points to a container.
References DBus::TypeInfo::is_container(), and type().
Referenced by recurse().
bool DBus::SignatureIterator::is_dict | ( | ) | const |
True if the iterator points to a dictionary.
References DBus::DICT_ENTRY, element_type(), and is_array().
bool DBus::SignatureIterator::is_fixed | ( | ) | const |
True if the element type is a fixed type.
References DBus::TypeInfo::is_fixed(), and type().
bool DBus::SignatureIterator::is_valid | ( | ) | const |
True if this is a valid iterator.
References DBus::INVALID.
Referenced by next(), and DBus::Variant::recurseStruct().
|
private |
References DBus::DICT_ENTRY, and DBus::TypeInfo::to_dbus_char().
Referenced by signature().
bool DBus::SignatureIterator::next | ( | ) |
Moves the iterator to the next field and invalidates it if it moves beyond the last field.
References is_valid().
Referenced by operator++().
DBus::SignatureIterator::operator bool | ( | ) | const |
True if the iterator is valid and initialized, false otherwise.
SignatureIterator & DBus::SignatureIterator::operator++ | ( | ) |
References next().
SignatureIterator DBus::SignatureIterator::operator++ | ( | int | ) |
SignatureIterator & DBus::SignatureIterator::operator= | ( | const SignatureIterator & | other | ) |
bool DBus::SignatureIterator::operator== | ( | const SignatureIterator & | other | ) |
SignatureIterator DBus::SignatureIterator::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(), and SignatureIterator().
Referenced by DBus::Variant::createFromDemarshal(), DBus::MessageAppendIterator::operator<<(), DBus::priv::VariantAppendIterator::operator<<(), DBus::Variant::recurseArray(), and DBus::Variant::remarshal().
std::string DBus::SignatureIterator::signature | ( | ) | const |
Returns the current signature of the iterator.
References iterate_over_subsig(), and DBus::TypeInfo::to_dbus_char().
DataType DBus::SignatureIterator::type | ( | ) | const |
Returns the argument type that the iterator points to.
References DBus::INVALID.
Referenced by DBus::Variant::createFromDemarshal(), DBus::Demarshaling::demarshal_variant(), element_type(), is_array(), is_basic(), is_container(), is_fixed(), DBus::ErrorMessage::message(), DBus::MessageAppendIterator::open_container(), DBus::priv::VariantAppendIterator::open_container(), DBus::Variant::recurseArray(), DBus::Variant::recurseDictEntry(), and DBus::Variant::recurseStruct().