Mercurial > projects > qtd
changeset 347:970332a88b72
lowered the marshall in rank
author | maxter <spambox@d-coding.com> |
---|---|
date | Sat, 15 May 2010 00:22:47 +0300 |
parents | 2691dd58d7e1 |
children | 29ea6511681f |
files | build/core.txt d2/qt/core/QList.d d2/qt/core/QTypeInfo.d d2/qtd/Attribute.d d2/qtd/MOC.d d2/qtd/Signal.d |
diffstat | 6 files changed, 105 insertions(+), 6 deletions(-) [+] |
line wrap: on
line diff
--- a/build/core.txt Fri May 14 13:15:24 2010 +0300 +++ b/build/core.txt Sat May 15 00:22:47 2010 +0300 @@ -29,7 +29,7 @@ Signal Str Atomic - MetaMarshall + Marshal MOC Meta Array
--- a/d2/qt/core/QList.d Fri May 14 13:15:24 2010 +0300 +++ b/d2/qt/core/QList.d Sat May 15 00:22:47 2010 +0300 @@ -5,7 +5,7 @@ import qt.core.QString; import qtd.QtdObject; import qtd.Atomic; -import qtd.MetaMarshall; +import qtd.Marshal; import core.stdc.stdlib : qRealloc = realloc, qFree = free, qMalloc = malloc; import core.stdc.string : memcpy, memmove;
--- a/d2/qt/core/QTypeInfo.d Fri May 14 13:15:24 2010 +0300 +++ b/d2/qt/core/QTypeInfo.d Sat May 15 00:22:47 2010 +0300 @@ -8,7 +8,7 @@ */ import std.traits; -import qtd.MetaMarshall; +import qtd.Marshal; import qt.core.QString; bool qIsDetached(T)(ref T) { return true; }
--- a/d2/qtd/Attribute.d Fri May 14 13:15:24 2010 +0300 +++ b/d2/qtd/Attribute.d Sat May 15 00:22:47 2010 +0300 @@ -26,7 +26,66 @@ */ allowMultiple = 0x0000_0001, - /* internal */ inner = 0x0000_0002 + /* internal */ inner = 0x0000_0002, + + /** + Attribute data are in key-value form. + */ + named = 0x0000_0004 +} + +/** + When mixed in an aggregate, converts a compile-time tuple to + members of that aggregate. + */ +mixin template tupleToMembers!(string nameSpace, size_t index, A...) +{ + static if (index < A.length) + { + enum indexStr = to!string(index); + + static if (is(__traits(compiles, { struct { typeof(A[index]) x; } }() }))) + mixin("typeof(A[" ~ indexStr ~ "]) " ~ nameSpace ~ ~ " = A[" ~ indexStr ~"];\n" ~ next; + else + mixin("alias A[" ~ indexStr ~ "] " ~ nameSpace ~ indexStr ~ ";\n" ~ next; + + mixin tupleToFields!(nameSpace, index + 1, A); + } +} + +/** + When mixed in an aggregate, converts a compile-time tuple of name-value pairs to + members of that aggregate. + */ +struct NamedValueTupleToFields(A...) +{ + +} + +version (QtdUnittest) +{ + unittest + { + static int foo() + { + return 42; + } + + static struct S + { + mixin TupleToFields!("field", 0, + int, + "a", + 22, + foo); + } + + static assert(is(S.field0 == int)); + S s; + assert(s.field1 == "a"); + assert(s.field2 == "22"); + assert(S.foo() == 42); + } } private template attributeId(alias symbol, uint index = 0) @@ -158,6 +217,46 @@ mixin ("alias TypeTuple!(attrClass, A) " ~ attrId ~ ";"); } +/** + Base class for run time attributes + */ +abstract class MetaAttribute +{ +} + +/** + Default implementation of run time attributes + */ +final class MetaAttributeVariant : MetaAttribute +{ +private: + Variant[] values_; + +public: + Variant values() + { + return values_; + } + + static MetaAttributeVariant create(string category, AttributeOptions opts, A...)() + { + } +} + +class MetaAttributeTypedImpl(A...) +{ +} + + +abstract class MetaAtributeTyped : MetaAttribute +{ + void construct(A...)() + { + } +} + + + private string stringOfFunction(alias symbol)() { auto ptrType = typeof(&symbol).stringof;