Change signature type from char[] to const(char)[]
This commit is contained in:
parent
f477599a8f
commit
455c0a8f0d
|
@ -41,7 +41,7 @@ void buildIter(TS...)(DBusMessageIter *iter, TS args) if(allCanDBus!TS) {
|
||||||
}
|
}
|
||||||
DBusMessageIter subStore;
|
DBusMessageIter subStore;
|
||||||
DBusMessageIter* sub = &subStore;
|
DBusMessageIter* sub = &subStore;
|
||||||
char[] sig = [cast(char) val.type];
|
const(char)[] sig = [ cast(char) val.type ];
|
||||||
if(val.type == 'a')
|
if(val.type == 'a')
|
||||||
sig ~= val.signature;
|
sig ~= val.signature;
|
||||||
else if(val.type == 'r')
|
else if(val.type == 'r')
|
||||||
|
|
|
@ -35,7 +35,7 @@ struct DBusAny {
|
||||||
/// DBus type of the value (never 'v'), see typeSig!T
|
/// DBus type of the value (never 'v'), see typeSig!T
|
||||||
int type;
|
int type;
|
||||||
/// Child signature for Arrays & Tuples
|
/// Child signature for Arrays & Tuples
|
||||||
char[] signature;
|
const(char)[] signature;
|
||||||
/// If true, this value will get serialized as variant value, otherwise it is serialized like it wasn't in a DBusAny wrapper.
|
/// If true, this value will get serialized as variant value, otherwise it is serialized like it wasn't in a DBusAny wrapper.
|
||||||
/// Same functionality as Variant!T but with dynamic types if true.
|
/// Same functionality as Variant!T but with dynamic types if true.
|
||||||
bool explicitVariant;
|
bool explicitVariant;
|
||||||
|
@ -73,7 +73,7 @@ struct DBusAny {
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Manually creates a DBusAny object using a type, signature and implicit specifier.
|
/// Manually creates a DBusAny object using a type, signature and implicit specifier.
|
||||||
this(int type, char[] signature, bool explicit) {
|
this(int type, const(char)[] signature, bool explicit) {
|
||||||
this.type = type;
|
this.type = type;
|
||||||
this.signature = signature;
|
this.signature = signature;
|
||||||
this.explicitVariant = explicit;
|
this.explicitVariant = explicit;
|
||||||
|
@ -150,7 +150,7 @@ struct DBusAny {
|
||||||
this.type = 'a';
|
this.type = 'a';
|
||||||
static assert(!is(ElementType!T == DBusAny), "Array must consist of the same type, use Variant!DBusAny or DBusAny(tuple(...)) instead");
|
static assert(!is(ElementType!T == DBusAny), "Array must consist of the same type, use Variant!DBusAny or DBusAny(tuple(...)) instead");
|
||||||
static assert(typeSig!(ElementType!T) != "y");
|
static assert(typeSig!(ElementType!T) != "y");
|
||||||
this.signature = typeSig!(ElementType!T).dup;
|
this.signature = typeSig!(ElementType!T);
|
||||||
this.explicitVariant = false;
|
this.explicitVariant = false;
|
||||||
foreach(elem; value)
|
foreach(elem; value)
|
||||||
array ~= DBusAny(elem);
|
array ~= DBusAny(elem);
|
||||||
|
@ -378,10 +378,10 @@ unittest {
|
||||||
test(variant([1, 2, 3]), set!"array"(DBusAny('a', ['i'], true), [DBusAny(1), DBusAny(2), DBusAny(3)]));
|
test(variant([1, 2, 3]), set!"array"(DBusAny('a', ['i'], true), [DBusAny(1), DBusAny(2), DBusAny(3)]));
|
||||||
|
|
||||||
test(tuple("a", 4, [1, 2]), set!"tuple"(DBusAny('r', "(siai)".dup, false), [DBusAny("a"), DBusAny(4), DBusAny([1, 2])]));
|
test(tuple("a", 4, [1, 2]), set!"tuple"(DBusAny('r', "(siai)".dup, false), [DBusAny("a"), DBusAny(4), DBusAny([1, 2])]));
|
||||||
test(tuple("a", variant(4), variant([1, 2])), set!"tuple"(DBusAny('r', "(svv)".dup, false), [DBusAny("a"), DBusAny(variant(4)), DBusAny(variant([1, 2]))]));
|
test(tuple("a", variant(4), variant([1, 2])), set!"tuple"(DBusAny('r', "(svv)", false), [DBusAny("a"), DBusAny(variant(4)), DBusAny(variant([1, 2]))]));
|
||||||
|
|
||||||
test(["a": "b"], set!"array"(DBusAny('a', "{ss}".dup, false), [DBusAny(DictionaryEntry!(DBusAny, DBusAny)(DBusAny("a"), DBusAny("b")))]));
|
test(["a": "b"], set!"array"(DBusAny('a', "{ss}", false), [DBusAny(DictionaryEntry!(DBusAny, DBusAny)(DBusAny("a"), DBusAny("b")))]));
|
||||||
test([variant("a"): 4], set!"array"(DBusAny('a', "{vi}".dup, false), [DBusAny(DictionaryEntry!(DBusAny, DBusAny)(DBusAny(variant("a")), DBusAny(4)))]));
|
test([variant("a"): 4], set!"array"(DBusAny('a', "{vi}", false), [DBusAny(DictionaryEntry!(DBusAny, DBusAny)(DBusAny(variant("a")), DBusAny(4)))]));
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Marks the data as variant on serialization
|
/// Marks the data as variant on serialization
|
||||||
|
|
Loading…
Reference in a new issue