Mercurial > projects > qtd
comparison qt/qtd/MetaMarshall.d @ 303:98b211f3ee34 signals
fix for #19
author | eldar_ins@eldar-laptop |
---|---|
date | Sat, 12 Dec 2009 16:01:55 +0500 |
parents | 55ee4603365d |
children | 91ed8edd442e |
comparison
equal
deleted
inserted
replaced
302:55ee4603365d | 303:98b211f3ee34 |
---|---|
56 } | 56 } |
57 | 57 |
58 // converts an argumnent from C++ to D in qt_metacall | 58 // converts an argumnent from C++ to D in qt_metacall |
59 string metaCallArgument(T)(string ptr) | 59 string metaCallArgument(T)(string ptr) |
60 { | 60 { |
61 static if (isQObjectType!T) | 61 static if (isQObjectType!T || isObjectType!T) |
62 return T.stringof ~ ".__getObject(*cast(void**)(" ~ ptr ~ "))"; | 62 return T.stringof ~ ".__getObject(*cast(void**)(" ~ ptr ~ "))"; |
63 else static if (isNativeType!T) | 63 else static if (isNativeType!T) |
64 return "*(cast(" ~ T.stringof ~ "*)" ~ ptr ~ ")"; | 64 return "*(cast(" ~ T.stringof ~ "*)" ~ ptr ~ ")"; |
65 else static if (isStringType!T) | 65 else static if (isStringType!T) |
66 return "QStringUtil.toNativeString(" ~ ptr ~ ")"; | 66 return "QStringUtil.toNativeString(" ~ ptr ~ ")"; |
70 } | 70 } |
71 | 71 |
72 // converts a D argument type to C++ for registering in Qt meta system | 72 // converts a D argument type to C++ for registering in Qt meta system |
73 string qtDeclArg(T)() | 73 string qtDeclArg(T)() |
74 { | 74 { |
75 static if (isQObjectType!T) | 75 static if (isQObjectType!T || isObjectType!T) |
76 return T.stringof ~ "*"; | 76 return T.stringof ~ "*"; |
77 else static if (isStringType!T) | 77 else static if (isStringType!T) |
78 return "QString"; | 78 return "QString"; |
79 else static if (isNativeType!T) | 79 else static if (isNativeType!T) |
80 return Unqual!T.stringof; | 80 return Unqual!T.stringof; |
83 } | 83 } |
84 | 84 |
85 // converts an argument from D to C++ in a signal emitter | 85 // converts an argument from D to C++ in a signal emitter |
86 string convertSignalArgument(T)(string arg) | 86 string convertSignalArgument(T)(string arg) |
87 { | 87 { |
88 static if (isQObjectType!T) | 88 static if (isQObjectType!T || isObjectType!T) |
89 return arg ~ ".__nativeId"; | 89 return arg ~ ".__nativeId"; |
90 else static if (isStringType!T) | 90 else static if (isStringType!T) |
91 return "_qt" ~ arg; | 91 return "_qt" ~ arg; |
92 else static if (isNativeType!T) | 92 else static if (isNativeType!T) |
93 return arg; | 93 return arg; |