summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorMichele Calgaro <michele.calgaro@yahoo.it>2019-05-15 23:36:40 +0900
committerMichele Calgaro <michele.calgaro@yahoo.it>2019-05-15 23:36:40 +0900
commit17b82c03cd5f218203cb99b648fc246457a82d9b (patch)
tree4edfeda29dd7502c78ca9c0b483dfbc12a63f267 /src
parent1d2ed792d8f35e0737943873c03bba2b090bba53 (diff)
downloaddbus-1-tqt-17b82c03cd5f218203cb99b648fc246457a82d9b.tar.gz
dbus-1-tqt-17b82c03cd5f218203cb99b648fc246457a82d9b.zip
Added function to easily create a TQT_DBusData variant object from a given
TQT_DBusData object. This simplify the creation of dictionaries where the value has to be of type Variant. Signed-off-by: Michele Calgaro <michele.calgaro@yahoo.it>
Diffstat (limited to 'src')
-rw-r--r--src/tqdbusdata.cpp8
-rw-r--r--src/tqdbusdata.h7
2 files changed, 15 insertions, 0 deletions
diff --git a/src/tqdbusdata.cpp b/src/tqdbusdata.cpp
index 629df57..7dc8c63 100644
--- a/src/tqdbusdata.cpp
+++ b/src/tqdbusdata.cpp
@@ -731,6 +731,14 @@ TQT_DBusVariant TQT_DBusData::toVariant(bool* ok) const
return *((TQT_DBusVariant*)d->value.pointer);
}
+TQT_DBusData TQT_DBusData::getAsVariantData()
+{
+ TQT_DBusVariant variant;
+ variant.value = *this;
+ variant.signature = variant.value.buildDBusSignature();
+ return TQT_DBusData::fromVariant(variant);
+}
+
TQT_DBusData TQT_DBusData::fromByteKeyMap(const TQT_DBusDataMap<TQ_UINT8>& map)
{
TQT_DBusData data;
diff --git a/src/tqdbusdata.h b/src/tqdbusdata.h
index ae64706..20c2c82 100644
--- a/src/tqdbusdata.h
+++ b/src/tqdbusdata.h
@@ -852,6 +852,13 @@ public:
TQT_DBusVariant toVariant(bool* ok = 0) const;
/**
+ * @brief Creates a variant from @p this object and returns it as a TQT_DBusData object
+ *
+ * @return a data object of type #Variant containing @p this object
+ */
+ TQT_DBusData getAsVariantData();
+
+ /**
* @brief Creates a data object for the given @p map
*
* \note The map is allowed to be empty but is required to have a valid