summaryrefslogtreecommitdiffstats
path: root/tqdbusdata.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'tqdbusdata.cpp')
-rw-r--r--tqdbusdata.cpp77
1 files changed, 77 insertions, 0 deletions
diff --git a/tqdbusdata.cpp b/tqdbusdata.cpp
index 26ca154..5a6cfa9 100644
--- a/tqdbusdata.cpp
+++ b/tqdbusdata.cpp
@@ -27,6 +27,7 @@
#include "tqdbusdatalist.h"
#include "tqdbusdatamap.h"
#include "tqdbusobjectpath.h"
+#include "tqdbusunixfd.h"
#include "tqdbusvariant.h"
#include <tqshared.h>
@@ -50,6 +51,10 @@ public:
delete (TQT_DBusObjectPath*)value.pointer;
break;
+ case TQT_DBusData::UnixFd:
+ delete (TQT_DBusUnixFd*)value.pointer;
+ break;
+
case TQT_DBusData::List:
delete (TQT_DBusDataList*)value.pointer;
break;
@@ -101,6 +106,10 @@ public:
delete (TQT_DBusDataMap<TQT_DBusObjectPath>*)value.pointer;
break;
+ case TQT_DBusData::UnixFd:
+ delete (TQT_DBusDataMap<TQT_DBusUnixFd>*)value.pointer;
+ break;
+
default:
tqFatal("TQT_DBusData::Private: unhandled map key type %d(%s)",
keyType, TQT_DBusData::typeName(keyType));
@@ -208,6 +217,9 @@ bool TQT_DBusData::operator==(const TQT_DBusData& other) const
case TQT_DBusData::ObjectPath:
return toObjectPath() == other.toObjectPath();
+ case TQT_DBusData::UnixFd:
+ return toUnixFd() == other.toUnixFd();
+
case TQT_DBusData::List:
return toList() == other.toList();
@@ -257,6 +269,10 @@ bool TQT_DBusData::operator==(const TQT_DBusData& other) const
toObjectPathKeyMap() == other.toObjectPathKeyMap();
break;
+ case TQT_DBusData::UnixFd:
+ toUnixFdKeyMap() == other.toUnixFdKeyMap();
+ break;
+
default:
tqFatal("TQT_DBusData operator== unhandled map key type %d(%s)",
d->keyType, TQT_DBusData::typeName(d->keyType));
@@ -303,6 +319,7 @@ const char* TQT_DBusData::typeName(Type type)
case TQT_DBusData::Double: return "Double";
case TQT_DBusData::String: return "String";
case TQT_DBusData::ObjectPath: return "ObjectPath";
+ case TQT_DBusData::UnixFd: return "UnixFd";
case TQT_DBusData::List: return "List";
case TQT_DBusData::Struct: return "Struct";
case TQT_DBusData::Variant: return "Variant";
@@ -568,6 +585,32 @@ TQT_DBusObjectPath TQT_DBusData::toObjectPath(bool* ok) const
return *((TQT_DBusObjectPath*)d->value.pointer);
}
+TQT_DBusData TQT_DBusData::fromUnixFd(const TQT_DBusUnixFd& value)
+{
+ TQT_DBusData data;
+
+ if (value.isValid())
+ {
+ data.d->type = TQT_DBusData::UnixFd;
+ data.d->value.pointer = new TQT_DBusUnixFd(value);
+ }
+
+ return data;
+}
+
+TQT_DBusUnixFd TQT_DBusData::toUnixFd(bool* ok) const
+{
+ if (d->type != TQT_DBusData::UnixFd)
+ {
+ if (ok != 0) *ok = false;
+ return TQT_DBusUnixFd();
+ }
+
+ if (ok != 0) *ok = true;
+
+ return *((TQT_DBusUnixFd*)d->value.pointer);
+}
+
TQT_DBusData TQT_DBusData::fromList(const TQT_DBusDataList& list)
{
TQT_DBusData data;
@@ -885,6 +928,31 @@ TQT_DBusDataMap<TQT_DBusObjectPath> TQT_DBusData::toObjectPathKeyMap(bool* ok) c
return *((TQT_DBusDataMap<TQT_DBusObjectPath>*)d->value.pointer);
}
+TQT_DBusData TQT_DBusData::fromUnixFdKeyMap(const TQT_DBusDataMap<TQT_DBusUnixFd>& map)
+{
+ TQT_DBusData data;
+
+ data.d->type = TQT_DBusData::Map;
+ data.d->keyType = map.keyType();
+ data.d->value.pointer = new TQT_DBusDataMap<TQT_DBusUnixFd>(map);
+
+ return data;
+}
+
+TQT_DBusDataMap<TQT_DBusUnixFd> TQT_DBusData::toUnixFdKeyMap(bool* ok) const
+{
+ if (d->type != TQT_DBusData::Map &&
+ d->keyType != TQT_DBusDataMap<TQT_DBusUnixFd>::m_keyType)
+ {
+ if (ok != 0) *ok = false;
+ return TQT_DBusDataMap<TQT_DBusUnixFd>();
+ }
+
+ if (ok != 0) *ok = true;
+
+ return *((TQT_DBusDataMap<TQT_DBusUnixFd>*)d->value.pointer);
+}
+
static const char* qDBusTypeForTQT_DBusType(TQT_DBusData::Type type)
{
switch (type)
@@ -913,6 +981,8 @@ static const char* qDBusTypeForTQT_DBusType(TQT_DBusData::Type type)
return DBUS_TYPE_STRING_AS_STRING;
case TQT_DBusData::ObjectPath:
return DBUS_TYPE_OBJECT_PATH_AS_STRING;
+ case TQT_DBusData::UnixFd:
+ return DBUS_TYPE_UNIX_FD_AS_STRING;
case TQT_DBusData::Variant:
return DBUS_TYPE_VARIANT_AS_STRING;
default:
@@ -1008,6 +1078,10 @@ TQCString TQT_DBusData::buildDBusSignature() const
signature += qDBusSignatureForMapValue<TQT_DBusObjectPath>(
*((TQT_DBusDataMap<TQT_DBusObjectPath>*) d->value.pointer));
break;
+ case TQT_DBusData::UnixFd:
+ signature += qDBusSignatureForMapValue<TQT_DBusUnixFd>(
+ *((TQT_DBusDataMap<TQT_DBusUnixFd>*) d->value.pointer));
+ break;
default:
break;
}
@@ -1052,3 +1126,6 @@ const TQT_DBusData::Type TQT_DBusDataMap<TQString>::m_keyType = TQT_DBusData::St
template <>
const TQT_DBusData::Type TQT_DBusDataMap<TQT_DBusObjectPath>::m_keyType =
TQT_DBusData::ObjectPath;
+
+template <>
+const TQT_DBusData::Type TQT_DBusDataMap<TQT_DBusUnixFd>::m_keyType = TQT_DBusData::UnixFd;