summaryrefslogtreecommitdiffstats
path: root/src/util.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/util.h')
-rw-r--r--src/util.h92
1 files changed, 7 insertions, 85 deletions
diff --git a/src/util.h b/src/util.h
index 656bfff..f27b7b8 100644
--- a/src/util.h
+++ b/src/util.h
@@ -30,96 +30,18 @@
// TDE
#include <kurl.h>
-inline bool check_variant(TQT_DBusVariant variant, TQString signature)
-{
- return !variant.signature.isNull() && variant.signature == signature;
-}
+typedef TQMap<TQString, TQT_DBusVariant> TQT_DBusVariantMap;
+typedef TQValueList<TQT_DBusData> TQT_DBusValueList;
-inline TQString bytelist_to_string(TQT_DBusDataList list)
-{
- if (list.type() != TQT_DBusData::Byte) return TQString::null;
- TQCString bytes;
- TQValueList<TQ_UINT8> vl = list.toByteList();
- TQValueList<TQ_UINT8>::iterator vlit;
- for (vlit = vl.begin(); vlit != vl.end(); ++vlit)
- {
- bytes += (*vlit);
- }
- return TQString::fromLocal8Bit(bytes.data(), bytes.size());
-}
+extern bool check_variant(TQT_DBusVariant variant, TQString signature);
-inline TQT_DBusDataList string_to_bytelist(TQString str)
-{
- TQCString bytes = str.latin1();
- TQValueList<TQ_UINT8> vl;
- char *bit;
- for (bit = bytes.begin(); bit != bytes.end(); ++bit)
- {
- vl << (TQ_UINT8)(*bit);
- }
- return TQT_DBusDataList(vl);
-}
+extern TQString bytelist_to_string(TQT_DBusDataList list);
-inline TQT_DBusDataList kurl_list_to_datalist(KURL::List urls)
-{
- return TQT_DBusDataList(urls.toStringList());
-}
+extern TQT_DBusDataList string_to_bytelist(TQString str);
-inline bool make_variant(TQVariant variant, TQT_DBusVariant &other)
-{
- TQString signature;
- switch (variant.type()) {
- case TQVariant::String:
- case TQVariant::Color:
- case TQVariant::Font:
- case TQVariant::Date:
- case TQVariant::DateTime:
- case TQVariant::Time:
- case TQVariant::KeySequence:
- other.signature = "s";
- other.value = TQT_DBusData::fromString(variant.toString());
- break;
+extern TQT_DBusDataList kurl_list_to_datalist(KURL::List urls);
- case TQVariant::Int:
- other.signature = "i";
- other.value = TQT_DBusData::fromInt32(variant.toInt());
- break;
-
- case TQVariant::UInt:
- other.signature = "u";
- other.value = TQT_DBusData::fromUInt32(variant.toUInt());
- break;
-
- case TQVariant::Double:
- case TQVariant::LongLong:
- case TQVariant::ULongLong:
- other.signature = "d";
- other.value = TQT_DBusData::fromDouble(variant.toDouble());
- break;
-
- case TQVariant::Bool:
- other.signature = "b";
- other.value = TQT_DBusData::fromBool(variant.toBool());
- break;
-
- case TQVariant::StringList:
- other.signature = "as";
- other.value = TQT_DBusData::fromList(TQT_DBusDataList(variant.toStringList()));
- break;
-
- default:
- if (variant.canCast(TQVariant::String)) {
- other.signature = "s";
- other.value = TQT_DBusData::fromString(variant.toString());
- }
- else {
- kdDebug() << "Cannot cast TQVariant of type " << variant.type()
- << "to TQT_DBusVariant!" << endl;
- return false;
- }
- }
- return true;
-}
+extern bool make_variant(TQVariant variant, TQT_DBusVariant &other);
#endif // __UTIL_H