8 #ifndef DBUSCXX_VARIANT_H
9 #define DBUSCXX_VARIANT_H
30 class MessageIterator;
69 template<
typename Key,
typename Value>
70 Variant(
const std::map<Key, Value>& map ) :
79 template<
typename ...T>
96 const std::vector<uint8_t>*
marshaled()
const;
104 template <
typename T>
111 std::vector<T> retval = vi;
116 template <
typename Key,
typename Value>
123 std::map<Key, Value> retval = vi;
128 template <
typename ...T>
133 std::tuple<T...> tup;
163 operator std::string();
167 template <
typename T>
168 operator std::vector<T>() {
169 return to_vector<T>();
172 template <
typename Key,
typename Data>
173 operator std::map<Key, Data>() {
174 return to_map<Key, Data>();
177 template <
typename... T>
178 operator std::tuple<T...>() {
Implements the marshaling algorithms on a given vector of data.
Definition: marshaling.h:27
Extraction iterator allowing values to be retrieved from a message.
Definition: messageiterator.h:56
Represents a DBus Path.
Definition: path.h:21
A SignatureIterator allows you to iterate over a given DBus signature, and to extract useful informat...
Definition: signatureiterator.h:33
Represents a DBus signature.
Definition: signature.h:74
A Variant is a type-safe union for DBus operations.
Definition: variant.h:42
std::vector< T > to_vector()
Definition: variant.h:105
int data_alignment() const
Definition: variant.cpp:452
int16_t to_int16() const
Definition: variant.cpp:503
friend std::ostream & operator<<(std::ostream &os, const Variant &var)
Definition: variant.cpp:634
uint8_t to_uint8() const
Definition: variant.cpp:485
Variant(const std::map< Key, Value > &map)
Definition: variant.h:70
std::tuple< T... > to_tuple()
Definition: variant.h:129
bool to_bool() const
Definition: variant.cpp:476
DBus::Signature to_signature() const
Definition: variant.cpp:575
DataType m_currentType
Definition: variant.h:213
static Variant createFromDemarshal(Signature sig, std::shared_ptr< Demarshaling > demarshal, const std::vector< int > &filedescriptors, uint32_t depth)
Definition: variant.cpp:155
static Variant createFromMessage(MessageIterator iter)
Obsolete, do not call.
Definition: variant.cpp:309
int32_t to_int32() const
Definition: variant.cpp:521
int m_dataAlignment
Definition: variant.h:216
double to_double() const
Definition: variant.cpp:548
std::vector< uint8_t > m_marshaled
Definition: variant.h:215
void recurseDictEntry(SignatureIterator iter, std::shared_ptr< Demarshaling > demarshal, Marshaling *marshal, uint32_t ending_offset, const std::vector< int > &filedescriptors, uint32_t depth)
Definition: variant.cpp:281
int64_t to_int64() const
Definition: variant.cpp:539
uint16_t to_uint16() const
Definition: variant.cpp:494
std::string to_string() const
Definition: variant.cpp:557
uint32_t to_uint32() const
Definition: variant.cpp:512
void recurseArray(SignatureIterator iter, std::shared_ptr< Demarshaling > demarshal, Marshaling *marshal, const std::vector< int > &filedescriptors, uint32_t depth)
Definition: variant.cpp:250
const std::vector< uint8_t > * marshaled() const
Definition: variant.cpp:448
void recurseStruct(SignatureIterator sigit, std::shared_ptr< Demarshaling > demarshal, Marshaling *marshal, const std::vector< int > &filedescriptors, uint32_t depth)
Definition: variant.cpp:319
Signature signature() const
Definition: variant.cpp:147
Variant(const std::tuple< T... > &tup)
Definition: variant.h:80
void remarshal(DataType dt, SignatureIterator sigit, std::shared_ptr< Demarshaling > demarshal, Marshaling *marshal, const std::vector< int > &filedescriptors, uint32_t depth)
Definition: variant.cpp:338
Variant(const std::vector< T > &vec)
Definition: variant.h:60
Variant & operator=(const Variant &other)
Definition: variant.cpp:467
DBus::Path to_path() const
Definition: variant.cpp:566
std::map< Key, Value > to_map()
Definition: variant.h:117
DataType type() const
Definition: variant.cpp:151
bool operator==(const Variant &other) const
Definition: variant.cpp:456
uint64_t to_uint64() const
Definition: variant.cpp:530
Signature m_signature
Definition: variant.h:214
Variant()
Definition: variant.cpp:28
~Variant()
Definition: variant.cpp:145
Used to append a single, complete value to a Variant.
Definition: variantappenditerator.h:28
Definition: variantiterator.h:24
Global DBus namespace, where everything happens.
Definition: callmessage.cpp:18
DataType
Definition: enums.h:52