parent
e6d03252d2
commit
e4186bcc5c
|
@ -122,7 +122,7 @@ void buildIter(TS...)(DBusMessageIter *iter, TS args) if(allCanDBus!TS) {
|
||||||
}
|
}
|
||||||
if(val.explicitVariant)
|
if(val.explicitVariant)
|
||||||
dbus_message_iter_close_container(iter, sub);
|
dbus_message_iter_close_container(iter, sub);
|
||||||
} else static if(isVariant!T) {
|
} else static if(isInstanceOf!(Variant, T)) {
|
||||||
DBusMessageIter sub;
|
DBusMessageIter sub;
|
||||||
const(char)* subSig = typeSig!(VariantType!T).toStringz();
|
const(char)* subSig = typeSig!(VariantType!T).toStringz();
|
||||||
dbus_message_iter_open_container(iter, 'v', subSig, &sub);
|
dbus_message_iter_open_container(iter, 'v', subSig, &sub);
|
||||||
|
@ -188,7 +188,7 @@ T readIter(T)(DBusMessageIter *iter) if (!is(T == enum) && !isInstanceOf!(BitFla
|
||||||
auto argType = dbus_message_iter_get_arg_type(iter);
|
auto argType = dbus_message_iter_get_arg_type(iter);
|
||||||
T ret;
|
T ret;
|
||||||
|
|
||||||
static if(!isVariant!T || is(T == Variant!DBusAny)) {
|
static if(!isInstanceOf!(Variant, T) || is(T == Variant!DBusAny)) {
|
||||||
if(argType == 'v') {
|
if(argType == 'v') {
|
||||||
DBusMessageIter sub;
|
DBusMessageIter sub;
|
||||||
dbus_message_iter_recurse(iter, &sub);
|
dbus_message_iter_recurse(iter, &sub);
|
||||||
|
@ -242,7 +242,7 @@ T readIter(T)(DBusMessageIter *iter) if (!is(T == enum) && !isInstanceOf!(BitFla
|
||||||
ret ~= readIter!U(&sub);
|
ret ~= readIter!U(&sub);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else static if(isVariant!T) {
|
} else static if(isInstanceOf!(Variant, T)) {
|
||||||
DBusMessageIter sub;
|
DBusMessageIter sub;
|
||||||
dbus_message_iter_recurse(iter, &sub);
|
dbus_message_iter_recurse(iter, &sub);
|
||||||
ret.data = readIter!(VariantType!T)(&sub);
|
ret.data = readIter!(VariantType!T)(&sub);
|
||||||
|
|
|
@ -17,6 +17,15 @@ auto byDictionaryEntries(K, V)(V[K] aa) {
|
||||||
return aa.byKeyValue.map!(pair => DictionaryEntry!(K, V)(pair.key, pair.value));
|
return aa.byKeyValue.map!(pair => DictionaryEntry!(K, V)(pair.key, pair.value));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/+
|
||||||
|
Predicate template indicating whether T is an instance of ddbus.thin.Variant.
|
||||||
|
|
||||||
|
Deprecated:
|
||||||
|
This template used to be undocumented and user code should not depend on it.
|
||||||
|
Its meaning became unclear when support for Phobos-style variants was added.
|
||||||
|
It seemed best to remove it at that point.
|
||||||
|
+/
|
||||||
|
deprecated("Use std.traits.isInstanceOf instead.")
|
||||||
template isVariant(T) {
|
template isVariant(T) {
|
||||||
static if(isBasicType!T || isInputRange!T) {
|
static if(isBasicType!T || isInputRange!T) {
|
||||||
enum isVariant = false;
|
enum isVariant = false;
|
||||||
|
@ -61,7 +70,7 @@ template basicDBus(T) {
|
||||||
template canDBus(T) {
|
template canDBus(T) {
|
||||||
static if(basicDBus!T || is(T == DBusAny)) {
|
static if(basicDBus!T || is(T == DBusAny)) {
|
||||||
enum canDBus = true;
|
enum canDBus = true;
|
||||||
} else static if(isVariant!T) {
|
} else static if(isInstanceOf!(Variant, T)) {
|
||||||
enum canDBus = canDBus!(VariantType!T);
|
enum canDBus = canDBus!(VariantType!T);
|
||||||
} else static if(isInstanceOf!(VariantN, T)) {
|
} else static if(isInstanceOf!(VariantN, T)) {
|
||||||
// Phobos-style variants are supported if limited to DBus compatible types.
|
// Phobos-style variants are supported if limited to DBus compatible types.
|
||||||
|
@ -116,7 +125,7 @@ string typeSig(T)() if(canDBus!T) {
|
||||||
return "s";
|
return "s";
|
||||||
} else static if(is(T == ObjectPath)) {
|
} else static if(is(T == ObjectPath)) {
|
||||||
return "o";
|
return "o";
|
||||||
} else static if(isVariant!T || isInstanceOf!(VariantN, T)) {
|
} else static if(isInstanceOf!(Variant, T) || isInstanceOf!(VariantN, T)) {
|
||||||
return "v";
|
return "v";
|
||||||
} else static if(is(T B == enum)) {
|
} else static if(is(T B == enum)) {
|
||||||
return typeSig!B;
|
return typeSig!B;
|
||||||
|
|
Loading…
Reference in a new issue