From 9a134f5699708c76d4abd12da71c9df03830556a Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Sl=C3=A1vek=20Banko?= <slavek.banko@axis.cz>
Date: Mon, 18 Nov 2013 21:21:15 +0100
Subject: Add support for data type UnixFD

---
 tqdbusdatalist.cpp | 38 ++++++++++++++++++++++++++++++++++++++
 1 file changed, 38 insertions(+)

(limited to 'tqdbusdatalist.cpp')

diff --git a/tqdbusdatalist.cpp b/tqdbusdatalist.cpp
index ccf9a39..23f60a5 100644
--- a/tqdbusdatalist.cpp
+++ b/tqdbusdatalist.cpp
@@ -23,6 +23,7 @@
 
 #include "tqdbusdatalist.h"
 #include "tqdbusobjectpath.h"
+#include "tqdbusunixfd.h"
 #include "tqdbusvariant.h"
 
 #include <tqstringlist.h>
@@ -281,6 +282,21 @@ TQT_DBusDataList::TQT_DBusDataList(const TQValueList<TQT_DBusObjectPath>& other)
     }
 }
 
+TQT_DBusDataList::TQT_DBusDataList(const TQValueList<TQT_DBusUnixFd>& other)
+    : d(new Private())
+{
+    d->type = TQT_DBusData::UnixFd;
+
+    if (other.isEmpty()) return;
+
+    TQValueList<TQT_DBusUnixFd>::const_iterator it    = other.begin();
+    TQValueList<TQT_DBusUnixFd>::const_iterator endIt = other.end();
+    for (; it != endIt; ++it)
+    {
+        d->list << TQT_DBusData::fromUnixFd(*it);
+    }
+}
+
 TQT_DBusDataList::~TQT_DBusDataList()
 {
     delete d;
@@ -725,6 +741,28 @@ TQValueList<TQT_DBusObjectPath> TQT_DBusDataList::toObjectPathList(bool* ok) con
     return result;
 }
 
+TQValueList<TQT_DBusUnixFd> TQT_DBusDataList::toUnixFdList(bool* ok) const
+{
+    if (d->type != TQT_DBusData::UnixFd)
+    {
+        if (ok != 0) *ok = false;
+        return TQValueList<TQT_DBusUnixFd>();
+    }
+
+    TQValueList<TQT_DBusUnixFd> result;
+
+    TQValueList<TQT_DBusData>::const_iterator it    = d->list.begin();
+    TQValueList<TQT_DBusData>::const_iterator endIt = d->list.end();
+    for (; it != endIt; ++it)
+    {
+        result << (*it).toUnixFd();
+    }
+
+    if (ok != 0) *ok = true;
+
+    return result;
+}
+
 TQValueList<TQT_DBusVariant> TQT_DBusDataList::toVariantList(bool* ok) const
 {
     if (d->type != TQT_DBusData::Variant)
-- 
cgit v1.2.1