Mercurial > projects > qtd
annotate qt/core/QString.d @ 188:7dd099050621
initial commit for D2 support
author | eldar |
---|---|
date | Sun, 12 Jul 2009 18:58:03 +0000 |
parents | d5a6b6269f44 |
children | 5173835bb372 |
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 { |
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 | |
188 | 24 public static final string toNativeString(void* qstring) { |
1 | 25 wchar* arr = __qtd_QString_utf16(qstring); |
26 int size = __qtd_QString_size(qstring); | |
188 | 27 return .toUTF8(arr[0..size]); |
1 | 28 } |
29 | |
188 | 30 public final string toNativeString() { |
1 | 31 return toNativeString(native_id); |
32 } | |
33 | |
188 | 34 public void assign(string text) { |
35 __qtd_QString_operatorAssign(native_id, text); | |
1 | 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 } |
188 | 41 /* |
42 public static string fromUtf16(wstring src) { | |
43 version(Tango) | |
44 }*/ | |
1 | 45 } |
46 | |
47 private extern (C) wchar* __qtd_QString_utf16(void* __this_nativeId); | |
48 private extern (C) int __qtd_QString_size(void* __this_nativeId); | |
188 | 49 private extern (C) void __qtd_QString_operatorAssign(void* __this_nativeId, string text); |