Mercurial > projects > qtd
comparison qt/core/QString.d @ 302:55ee4603365d signals
string arguments for signals
author | eldar_ins@eldar-laptop |
---|---|
date | Sat, 12 Dec 2009 03:22:54 +0500 |
parents | 5173835bb372 |
children |
comparison
equal
deleted
inserted
replaced
301:4d8481385c71 | 302:55ee4603365d |
---|---|
11 public import std.utf : toUTF8; | 11 public import std.utf : toUTF8; |
12 } | 12 } |
13 | 13 |
14 struct QString | 14 struct QString |
15 { | 15 { |
16 public static QString opCall(void* ptr, bool proxy) { | 16 public static QString opCall() |
17 { | |
17 QString str; | 18 QString str; |
18 str.__nativeId = ptr; | 19 qtd_QString_placed_ctor(&str); |
19 return str; | 20 return str; |
20 } | 21 } |
21 | 22 |
22 public void* __nativeId; | 23 ~this() |
23 | 24 { |
24 public static final string toNativeString(void* qstring) { | 25 qtd_QString_call_destructor(&this); |
25 wchar* arr = qtd_QString_utf16(qstring); | |
26 int size = qtd_QString_size(qstring); | |
27 return .toUTF8(arr[0..size]); | |
28 } | 26 } |
29 | 27 |
30 public final string toNativeString() { | 28 void opAssign(string str) |
31 return toNativeString(__nativeId); | 29 { |
30 qtd_QString_assign_fromUtf8(&this, str); | |
32 } | 31 } |
33 | 32 |
34 public void assign(string text) { | 33 this(string str) |
35 qtd_QString_operatorAssign(__nativeId, text); | 34 { |
36 } | 35 qtd_QString_new_fromUtf8_at(&this, str); |
37 | |
38 public static string fromUtf8(string source) { | |
39 return source; | |
40 } | 36 } |
41 | 37 |
42 public static void __constructPlacedQString(void* place, string source) { | 38 public static void __constructPlacedQString(void* place, string source) { |
43 qtd_QString_new_fromUtf8_at(place, source); | 39 qtd_QString_new_fromUtf8_at(place, source); |
44 } | 40 } |
65 enum bool isStatic = false; | 61 enum bool isStatic = false; |
66 enum bool isLarge = false; | 62 enum bool isLarge = false; |
67 enum bool isPointer = false; | 63 enum bool isPointer = false; |
68 enum bool isDummy = false; | 64 enum bool isDummy = false; |
69 } | 65 } |
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 } | |
70 } | 98 } |
71 private extern(C) void* qtd_QString_placed_copy(const void* orig, void* place); | 99 private extern(C) void* qtd_QString_placed_copy(const void* orig, void* place); |
72 | 100 |
73 private extern (C) void qtd_QString_destructor(void* __this_nativeId); | 101 private extern (C) void qtd_QString_destructor(void* __this_nativeId); |
74 private extern (C) void qtd_QString_call_destructor(void *ptr); | 102 private extern (C) void qtd_QString_call_destructor(void *ptr); |
76 private extern (C) void* qtd_QString_QString_QString(void* orig); | 104 private extern (C) void* qtd_QString_QString_QString(void* orig); |
77 | 105 |
78 private extern (C) wchar* qtd_QString_utf16(void* __this_nativeId); | 106 private extern (C) wchar* qtd_QString_utf16(void* __this_nativeId); |
79 private extern (C) int qtd_QString_size(void* __this_nativeId); | 107 private extern (C) int qtd_QString_size(void* __this_nativeId); |
80 private extern (C) void qtd_QString_operatorAssign(void* __this_nativeId, string text); | 108 private extern (C) void qtd_QString_operatorAssign(void* __this_nativeId, string text); |
81 private extern (C) void qtd_QString_new_fromUtf8_at(void* place, string text); | 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); |