signatureiterator.h
Go to the documentation of this file.
1 // SPDX-License-Identifier: LGPL-3.0-or-later OR BSD-3-Clause
2 /***************************************************************************
3  * Copyright (C) 2009,2010 by Rick L. Vinyard, Jr. *
4  * rvinyard@cs.nmsu.edu *
5  * *
6  * This file is part of the dbus-cxx library. *
7  ***************************************************************************/
8 #include <dbus-cxx/enums.h>
10 #include <string>
11 #include <memory>
12 
13 #ifndef DBUSCXX_SIGNATUREITERATOR_H
14 #define DBUSCXX_SIGNATUREITERATOR_H
15 
16 namespace DBus {
17 
18 namespace priv {
19 class SignatureNode;
20 }
21 
34 public:
35 
37 
38  SignatureIterator( const SignatureIterator& other );
39 
40  SignatureIterator( std::shared_ptr<priv::SignatureNode> startnode );
41 
43 
45  void invalidate();
46 
48  bool is_valid() const;
49 
51  operator bool() const;
52 
58  bool next();
59 
65  bool has_next() const;
66 
68 
70 
72 
73  bool operator==( const SignatureIterator& other );
74 
76  DataType type() const;
77 
83  DataType element_type() const;
84 
86  bool is_basic() const;
87 
89  bool is_fixed() const;
90 
92  bool is_container() const;
93 
95  bool is_array() const;
96 
98  bool is_dict() const;
99 
106 
108  std::string signature() const;
109 
110 private:
111 
112  std::string iterate_over_subsig( std::shared_ptr<priv::SignatureNode> start ) const;
113 
114 private:
115  class priv_data;
116 
117  DBUS_CXX_PROPAGATE_CONST( std::unique_ptr<priv_data> ) m_priv;
118 };
119 
120 }
121 
122 #endif
A SignatureIterator allows you to iterate over a given DBus signature, and to extract useful informat...
Definition: signatureiterator.h:33
bool is_container() const
True if the iterator points to a container.
Definition: signatureiterator.cpp:114
bool operator==(const SignatureIterator &other)
Definition: signatureiterator.cpp:87
bool is_dict() const
True if the iterator points to a dictionary.
Definition: signatureiterator.cpp:123
bool next()
Moves the iterator to the next field and invalidates it if it moves beyond the last field.
Definition: signatureiterator.cpp:61
std::string signature() const
Returns the current signature of the iterator.
Definition: signatureiterator.cpp:137
SignatureIterator()
Definition: signatureiterator.cpp:34
bool is_array() const
True if the iterator points to an array.
Definition: signatureiterator.cpp:119
SignatureIterator & operator=(const SignatureIterator &other)
Definition: signatureiterator.cpp:201
SignatureIterator & operator++()
Definition: signatureiterator.cpp:75
DBUS_CXX_PROPAGATE_CONST(std::unique_ptr< priv_data >) m_priv
void invalidate()
Invalidates the iterator.
Definition: signatureiterator.cpp:49
~SignatureIterator()
Definition: signatureiterator.cpp:47
bool is_fixed() const
True if the element type is a fixed type.
Definition: signatureiterator.cpp:109
SignatureIterator recurse()
If the iterator points to a container recurses into the container returning a sub-iterator.
Definition: signatureiterator.cpp:127
DataType type() const
Returns the argument type that the iterator points to.
Definition: signatureiterator.cpp:91
bool is_valid() const
True if this is a valid iterator.
Definition: signatureiterator.cpp:53
bool has_next() const
See if this iterator can advance.
Definition: signatureiterator.cpp:211
DataType element_type() const
Returns the element type of the array that the iterator points to.
Definition: signatureiterator.cpp:97
std::string iterate_over_subsig(std::shared_ptr< priv::SignatureNode > start) const
Definition: signatureiterator.cpp:170
bool is_basic() const
True if the element type is a basic type.
Definition: signatureiterator.cpp:104
Global DBus namespace, where everything happens.
Definition: callmessage.cpp:18
DataType
Definition: enums.h:52