DBus::SignatureIterator Class Reference

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...
 
SignatureIteratoroperator++ ()
 
SignatureIterator operator++ (int)
 
SignatureIteratoroperator= (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
 

Detailed Description

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.

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

Constructor & Destructor Documentation

◆ SignatureIterator() [1/3]

DBus::SignatureIterator::SignatureIterator ( )

Referenced by recurse().

◆ SignatureIterator() [2/3]

DBus::SignatureIterator::SignatureIterator ( const SignatureIterator other)

◆ SignatureIterator() [3/3]

DBus::SignatureIterator::SignatureIterator ( std::shared_ptr< priv::SignatureNode startnode)

◆ ~SignatureIterator()

DBus::SignatureIterator::~SignatureIterator ( )

Member Function Documentation

◆ DBUS_CXX_PROPAGATE_CONST()

DBus::SignatureIterator::DBUS_CXX_PROPAGATE_CONST ( std::unique_ptr< priv_data >  )
private

◆ element_type()

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().

◆ has_next()

bool DBus::SignatureIterator::has_next ( ) const

See if this iterator can advance.

Returns

◆ invalidate()

void DBus::SignatureIterator::invalidate ( )

Invalidates the iterator.

◆ is_array()

bool DBus::SignatureIterator::is_array ( ) const

True if the iterator points to an array.

References DBus::ARRAY, and type().

Referenced by is_dict().

◆ is_basic()

bool DBus::SignatureIterator::is_basic ( ) const

True if the element type is a basic type.

References DBus::TypeInfo::is_basic(), and type().

◆ is_container()

bool DBus::SignatureIterator::is_container ( ) const

True if the iterator points to a container.

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

Referenced by recurse().

◆ is_dict()

bool DBus::SignatureIterator::is_dict ( ) const

True if the iterator points to a dictionary.

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

◆ is_fixed()

bool DBus::SignatureIterator::is_fixed ( ) const

True if the element type is a fixed type.

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

◆ is_valid()

bool DBus::SignatureIterator::is_valid ( ) const

True if this is a valid iterator.

References DBus::INVALID.

Referenced by next(), and DBus::Variant::recurseStruct().

◆ iterate_over_subsig()

std::string DBus::SignatureIterator::iterate_over_subsig ( std::shared_ptr< priv::SignatureNode start) const
private

◆ next()

bool DBus::SignatureIterator::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 is_valid().

Referenced by operator++().

◆ operator bool()

DBus::SignatureIterator::operator bool ( ) const

True if the iterator is valid and initialized, false otherwise.

◆ operator++() [1/2]

SignatureIterator & DBus::SignatureIterator::operator++ ( )

References next().

◆ operator++() [2/2]

SignatureIterator DBus::SignatureIterator::operator++ ( int  )

◆ operator=()

SignatureIterator & DBus::SignatureIterator::operator= ( const SignatureIterator other)

◆ operator==()

bool DBus::SignatureIterator::operator== ( const SignatureIterator other)

◆ recurse()

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().

◆ signature()

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

Returns the current signature of the iterator.

References iterate_over_subsig(), and DBus::TypeInfo::to_dbus_char().

◆ type()


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