Mercurial > projects > qtd
annotate d1/qt/core/QString.d @ 344:96a75b1e5b26
project structure changes
author | Max Samukha <maxter@spambox.com> |
---|---|
date | Fri, 14 May 2010 12:14:37 +0300 |
parents | qt/core/QString.d@55ee4603365d |
children |
rev | line source |
---|---|
1 | 1 module qt.core.QString; |
2 | |
56
d5a6b6269f44
duic is working now on the first testcase, if there are any issues with it please report
eldar
parents:
33
diff
changeset
|
3 import qt.QGlobal; |
d5a6b6269f44
duic is working now on the first testcase, if there are any issues with it please report
eldar
parents:
33
diff
changeset
|
4 |
1 | 5 version (Tango) |
6 { | |
188 | 7 public import tango.text.convert.Utf : toUTF8 = toString; |
1 | 8 } |
9 else | |
10 { | |
188 | 11 public import std.utf : toUTF8; |
1 | 12 } |
13 | |
33
cf8a415f3f32
gui package is fully wrapped now. lots of fixes in the generator
eldar
parents:
1
diff
changeset
|
14 struct QString |
1 | 15 { |
302 | 16 public static QString opCall() |
17 { | |
33
cf8a415f3f32
gui package is fully wrapped now. lots of fixes in the generator
eldar
parents:
1
diff
changeset
|
18 QString str; |
302 | 19 qtd_QString_placed_ctor(&str); |
33
cf8a415f3f32
gui package is fully wrapped now. lots of fixes in the generator
eldar
parents:
1
diff
changeset
|
20 return str; |
cf8a415f3f32
gui package is fully wrapped now. lots of fixes in the generator
eldar
parents:
1
diff
changeset
|
21 } |
cf8a415f3f32
gui package is fully wrapped now. lots of fixes in the generator
eldar
parents:
1
diff
changeset
|
22 |
302 | 23 ~this() |
24 { | |
25 qtd_QString_call_destructor(&this); | |
1 | 26 } |
27 | |
302 | 28 void opAssign(string str) |
29 { | |
30 qtd_QString_assign_fromUtf8(&this, str); | |
1 | 31 } |
32 | |
302 | 33 this(string str) |
34 { | |
35 qtd_QString_new_fromUtf8_at(&this, str); | |
56
d5a6b6269f44
duic is working now on the first testcase, if there are any issues with it please report
eldar
parents:
33
diff
changeset
|
36 } |
296 | 37 |
38 public static void __constructPlacedQString(void* place, string source) { | |
39 qtd_QString_new_fromUtf8_at(place, source); | |
40 } | |
41 | |
42 // service stuff | |
43 static void* __constructNativeCopy(const void* orig) { | |
44 return qtd_QString_QString_QString(cast(void*)orig); | |
45 } | |
46 | |
47 static void* __constructPlacedNativeCopy(const void* orig, void* place) { | |
48 return qtd_QString_placed_copy(orig, place); | |
49 } | |
50 | |
51 public static void __deleteNativeObject(void* ptr) { | |
52 qtd_QString_destructor(ptr); | |
53 } | |
54 | |
55 public static void __callNativeDestructor(void* ptr) { | |
56 qtd_QString_call_destructor(ptr); | |
57 } | |
58 struct QTypeInfo | |
59 { | |
60 enum bool isComplex = true; | |
61 enum bool isStatic = false; | |
62 enum bool isLarge = false; | |
63 enum bool isPointer = false; | |
64 enum bool isDummy = false; | |
65 } | |
302 | 66 |
67 private: | |
68 void *dummy; // sizeof(QString) == sizeof(void*) | |
69 } | |
70 | |
71 struct QStringUtil | |
72 { | |
73 public static final string toNativeString(void* qstring) { | |
74 wchar* arr = qtd_QString_utf16(qstring); | |
75 int size = qtd_QString_size(qstring); | |
76 return .toUTF8(arr[0..size]); | |
77 } | |
78 | |
79 public static string fromUtf8(string source) { | |
80 return source; | |
81 } | |
82 | |
83 public static QStringUtil opCall(void* ptr, bool proxy) { | |
84 QStringUtil str; | |
85 str.__nativeId = ptr; | |
86 return str; | |
87 } | |
88 | |
89 public void* __nativeId; | |
90 | |
91 public final string toNativeString() { | |
92 return QStringUtil.toNativeString(__nativeId); | |
93 } | |
94 | |
95 public void assign(string text) { | |
96 qtd_QString_operatorAssign(__nativeId, text); | |
97 } | |
1 | 98 } |
296 | 99 private extern(C) void* qtd_QString_placed_copy(const void* orig, void* place); |
1 | 100 |
296 | 101 private extern (C) void qtd_QString_destructor(void* __this_nativeId); |
102 private extern (C) void qtd_QString_call_destructor(void *ptr); | |
103 | |
104 private extern (C) void* qtd_QString_QString_QString(void* orig); | |
105 | |
106 private extern (C) wchar* qtd_QString_utf16(void* __this_nativeId); | |
107 private extern (C) int qtd_QString_size(void* __this_nativeId); | |
108 private extern (C) void qtd_QString_operatorAssign(void* __this_nativeId, string text); | |
302 | 109 private extern (C) void* qtd_QString_new_fromUtf8_at(void* place, string text); |
110 | |
111 private extern (C) void qtd_QString_placed_ctor(void* place); | |
112 private extern (C) void qtd_QString_assign_fromUtf8(QString *__qt_this, string text); |