Mercurial > projects > qtd
annotate qt/core/QString.d @ 56:d5a6b6269f44
duic is working now on the first testcase, if there are any issues with it please report
author | eldar |
---|---|
date | Mon, 18 May 2009 22:15:59 +0000 |
parents | cf8a415f3f32 |
children | 7dd099050621 |
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 { | |
7 import tango.text.convert.Utf : toString; | |
8 } | |
9 else | |
10 { | |
11 import std.utf : toString = toUTF8; | |
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 { |
33
cf8a415f3f32
gui package is fully wrapped now. lots of fixes in the generator
eldar
parents:
1
diff
changeset
|
16 public static QString opCall(void* ptr, bool proxy) { |
cf8a415f3f32
gui package is fully wrapped now. lots of fixes in the generator
eldar
parents:
1
diff
changeset
|
17 QString str; |
cf8a415f3f32
gui package is fully wrapped now. lots of fixes in the generator
eldar
parents:
1
diff
changeset
|
18 str.native_id = ptr; |
cf8a415f3f32
gui package is fully wrapped now. lots of fixes in the generator
eldar
parents:
1
diff
changeset
|
19 return str; |
cf8a415f3f32
gui package is fully wrapped now. lots of fixes in the generator
eldar
parents:
1
diff
changeset
|
20 } |
cf8a415f3f32
gui package is fully wrapped now. lots of fixes in the generator
eldar
parents:
1
diff
changeset
|
21 |
1 | 22 private void* native_id; |
23 | |
24 public static final char[] toNativeString(void* qstring) { | |
25 wchar* arr = __qtd_QString_utf16(qstring); | |
26 int size = __qtd_QString_size(qstring); | |
27 return .toString(arr[0..size]); | |
28 } | |
29 | |
30 public final char[] toNativeString() { | |
31 return toNativeString(native_id); | |
32 } | |
33 | |
34 public void assign(char[] text) { | |
35 __qtd_QString_operatorAssign(native_id, text.ptr, text.length); | |
36 } | |
56
d5a6b6269f44
duic is working now on the first testcase, if there are any issues with it please report
eldar
parents:
33
diff
changeset
|
37 |
d5a6b6269f44
duic is working now on the first testcase, if there are any issues with it please report
eldar
parents:
33
diff
changeset
|
38 public static string fromUtf8(string source) { |
d5a6b6269f44
duic is working now on the first testcase, if there are any issues with it please report
eldar
parents:
33
diff
changeset
|
39 return source; |
d5a6b6269f44
duic is working now on the first testcase, if there are any issues with it please report
eldar
parents:
33
diff
changeset
|
40 } |
1 | 41 } |
42 | |
43 private extern (C) wchar* __qtd_QString_utf16(void* __this_nativeId); | |
44 private extern (C) int __qtd_QString_size(void* __this_nativeId); | |
45 private extern (C) void __qtd_QString_operatorAssign(void* __this_nativeId, char* text, uint text_size); |