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
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
1
e78566595089 initial import
mandel
parents:
diff changeset
1 module qt.core.QString;
e78566595089 initial import
mandel
parents:
diff changeset
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
e78566595089 initial import
mandel
parents:
diff changeset
5 version (Tango)
e78566595089 initial import
mandel
parents:
diff changeset
6 {
e78566595089 initial import
mandel
parents:
diff changeset
7 import tango.text.convert.Utf : toString;
e78566595089 initial import
mandel
parents:
diff changeset
8 }
e78566595089 initial import
mandel
parents:
diff changeset
9 else
e78566595089 initial import
mandel
parents:
diff changeset
10 {
e78566595089 initial import
mandel
parents:
diff changeset
11 import std.utf : toString = toUTF8;
e78566595089 initial import
mandel
parents:
diff changeset
12 }
e78566595089 initial import
mandel
parents:
diff changeset
13
33
cf8a415f3f32 gui package is fully wrapped now. lots of fixes in the generator
eldar
parents: 1
diff changeset
14 struct QString
1
e78566595089 initial import
mandel
parents:
diff changeset
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
e78566595089 initial import
mandel
parents:
diff changeset
22 private void* native_id;
e78566595089 initial import
mandel
parents:
diff changeset
23
e78566595089 initial import
mandel
parents:
diff changeset
24 public static final char[] toNativeString(void* qstring) {
e78566595089 initial import
mandel
parents:
diff changeset
25 wchar* arr = __qtd_QString_utf16(qstring);
e78566595089 initial import
mandel
parents:
diff changeset
26 int size = __qtd_QString_size(qstring);
e78566595089 initial import
mandel
parents:
diff changeset
27 return .toString(arr[0..size]);
e78566595089 initial import
mandel
parents:
diff changeset
28 }
e78566595089 initial import
mandel
parents:
diff changeset
29
e78566595089 initial import
mandel
parents:
diff changeset
30 public final char[] toNativeString() {
e78566595089 initial import
mandel
parents:
diff changeset
31 return toNativeString(native_id);
e78566595089 initial import
mandel
parents:
diff changeset
32 }
e78566595089 initial import
mandel
parents:
diff changeset
33
e78566595089 initial import
mandel
parents:
diff changeset
34 public void assign(char[] text) {
e78566595089 initial import
mandel
parents:
diff changeset
35 __qtd_QString_operatorAssign(native_id, text.ptr, text.length);
e78566595089 initial import
mandel
parents:
diff changeset
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
e78566595089 initial import
mandel
parents:
diff changeset
41 }
e78566595089 initial import
mandel
parents:
diff changeset
42
e78566595089 initial import
mandel
parents:
diff changeset
43 private extern (C) wchar* __qtd_QString_utf16(void* __this_nativeId);
e78566595089 initial import
mandel
parents:
diff changeset
44 private extern (C) int __qtd_QString_size(void* __this_nativeId);
e78566595089 initial import
mandel
parents:
diff changeset
45 private extern (C) void __qtd_QString_operatorAssign(void* __this_nativeId, char* text, uint text_size);