annotate qt/d1/qt/qtd/Str.d @ 248:7664de4a55e5

Fixed #23. QtD_QObjectEntity is not created dynamically for shell classes any more. Class initialization is now performed by static constructors. When wrapping QObjects returned from functions, their run-time types are now taken into account. QObjects are allocated on GC heap, a doubly-linked list is used to prevent them from been collected (arguably a better solution than allocating on C heap and adding GC ranges) Minor changes (including unnecessary).
author maxter
date Thu, 20 Aug 2009 14:47:17 +0000
parents 27497bbe62a1
children 37eed70de029
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
188
7dd099050621 initial commit for D2 support
eldar
parents:
diff changeset
1 /**
7dd099050621 initial commit for D2 support
eldar
parents:
diff changeset
2 *
7dd099050621 initial commit for D2 support
eldar
parents:
diff changeset
3 * Copyright: Copyright QtD Team, 2008-2009
7dd099050621 initial commit for D2 support
eldar
parents:
diff changeset
4 * License: <a href="http://www.boost.org/LICENSE_1_0.txt>Boost License 1.0</a>
7dd099050621 initial commit for D2 support
eldar
parents:
diff changeset
5 *
7dd099050621 initial commit for D2 support
eldar
parents:
diff changeset
6 * Copyright QtD Team, 2008-2009
7dd099050621 initial commit for D2 support
eldar
parents:
diff changeset
7 * Distributed under the Boost Software License, Version 1.0.
7dd099050621 initial commit for D2 support
eldar
parents:
diff changeset
8 * (See accompanying file boost-license-1.0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
7dd099050621 initial commit for D2 support
eldar
parents:
diff changeset
9 *
7dd099050621 initial commit for D2 support
eldar
parents:
diff changeset
10 */
7dd099050621 initial commit for D2 support
eldar
parents:
diff changeset
11
7dd099050621 initial commit for D2 support
eldar
parents:
diff changeset
12 module qt.qtd.Str;
7dd099050621 initial commit for D2 support
eldar
parents:
diff changeset
13
248
7664de4a55e5 Fixed #23.
maxter
parents: 247
diff changeset
14 import tango.text.convert.Utf : toString;
247
27497bbe62a1 Implemented qVersion, qSharedBuild. Fixes #31
maxter
parents: 188
diff changeset
15 public import tango.stdc.stringz : fromStringz;
27497bbe62a1 Implemented qVersion, qSharedBuild. Fixes #31
maxter
parents: 188
diff changeset
16
248
7664de4a55e5 Fixed #23.
maxter
parents: 247
diff changeset
17 alias char[] string;
7664de4a55e5 Fixed #23.
maxter
parents: 247
diff changeset
18 alias wchar[] wstring;
247
27497bbe62a1 Implemented qVersion, qSharedBuild. Fixes #31
maxter
parents: 188
diff changeset
19
27497bbe62a1 Implemented qVersion, qSharedBuild. Fixes #31
maxter
parents: 188
diff changeset
20 alias char* stringz;
27497bbe62a1 Implemented qVersion, qSharedBuild. Fixes #31
maxter
parents: 188
diff changeset
21 alias char* cstringz;
188
7dd099050621 initial commit for D2 support
eldar
parents:
diff changeset
22
7dd099050621 initial commit for D2 support
eldar
parents:
diff changeset
23 public static char** toStringzArray(char[][] args)
7dd099050621 initial commit for D2 support
eldar
parents:
diff changeset
24 {
7dd099050621 initial commit for D2 support
eldar
parents:
diff changeset
25 if ( args is null )
7dd099050621 initial commit for D2 support
eldar
parents:
diff changeset
26 {
7dd099050621 initial commit for D2 support
eldar
parents:
diff changeset
27 return null;
7dd099050621 initial commit for D2 support
eldar
parents:
diff changeset
28 }
7dd099050621 initial commit for D2 support
eldar
parents:
diff changeset
29 char** argv = (new char*[args.length]).ptr;
7dd099050621 initial commit for D2 support
eldar
parents:
diff changeset
30 int argc = 0;
7dd099050621 initial commit for D2 support
eldar
parents:
diff changeset
31 foreach (char[] p; args)
7dd099050621 initial commit for D2 support
eldar
parents:
diff changeset
32 {
7dd099050621 initial commit for D2 support
eldar
parents:
diff changeset
33 argv[argc++] = cast(char*)(p.dup~'\0');
7dd099050621 initial commit for D2 support
eldar
parents:
diff changeset
34 }
7dd099050621 initial commit for D2 support
eldar
parents:
diff changeset
35 argv[argc] = null;
7dd099050621 initial commit for D2 support
eldar
parents:
diff changeset
36
7dd099050621 initial commit for D2 support
eldar
parents:
diff changeset
37 return argv;
7dd099050621 initial commit for D2 support
eldar
parents:
diff changeset
38 }
248
7664de4a55e5 Fixed #23.
maxter
parents: 247
diff changeset
39 extern(C) void qtd_toUtf8(wchar* arr, uint size, string* str){
7664de4a55e5 Fixed #23.
maxter
parents: 247
diff changeset
40 *str = toString(arr[0..size]);
188
7dd099050621 initial commit for D2 support
eldar
parents:
diff changeset
41 }
7dd099050621 initial commit for D2 support
eldar
parents:
diff changeset
42
7dd099050621 initial commit for D2 support
eldar
parents:
diff changeset
43