Mercurial > projects > qtd
comparison qt/core/QString.d @ 1:e78566595089
initial import
author | mandel |
---|---|
date | Mon, 11 May 2009 16:01:50 +0000 |
parents | |
children | cf8a415f3f32 |
comparison
equal
deleted
inserted
replaced
0:36fb74dc547d | 1:e78566595089 |
---|---|
1 module qt.core.QString; | |
2 | |
3 version (Tango) | |
4 { | |
5 import tango.text.convert.Utf : toString; | |
6 } | |
7 else | |
8 { | |
9 import std.utf : toString = toUTF8; | |
10 } | |
11 | |
12 class QString | |
13 { | |
14 private void* native_id; | |
15 | |
16 public static final char[] toNativeString(void* qstring) { | |
17 wchar* arr = __qtd_QString_utf16(qstring); | |
18 int size = __qtd_QString_size(qstring); | |
19 return .toString(arr[0..size]); | |
20 } | |
21 | |
22 public final char[] toNativeString() { | |
23 return toNativeString(native_id); | |
24 } | |
25 | |
26 public this(void* ptr, bool proxy) { | |
27 native_id = ptr; | |
28 } | |
29 | |
30 public void assign(char[] text) { | |
31 __qtd_QString_operatorAssign(native_id, text.ptr, text.length); | |
32 } | |
33 } | |
34 | |
35 private extern (C) wchar* __qtd_QString_utf16(void* __this_nativeId); | |
36 private extern (C) int __qtd_QString_size(void* __this_nativeId); | |
37 private extern (C) void __qtd_QString_operatorAssign(void* __this_nativeId, char* text, uint text_size); |