annotate qt/d1/qt/qtd/Str.d @ 252:37eed70de029

More things broken than fixed. Rolling back to 263
author maxter
date Sat, 22 Aug 2009 12:50:58 +0000
parents 7664de4a55e5
children 34a37904ff77
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
252
37eed70de029 More things broken than fixed. Rolling back to 263
maxter
parents: 248
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
252
37eed70de029 More things broken than fixed. Rolling back to 263
maxter
parents: 248
diff changeset
17 alias char[] string;
37eed70de029 More things broken than fixed. Rolling back to 263
maxter
parents: 248
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 }
252
37eed70de029 More things broken than fixed. Rolling back to 263
maxter
parents: 248
diff changeset
39
37eed70de029 More things broken than fixed. Rolling back to 263
maxter
parents: 248
diff changeset
40 version(Windows)
37eed70de029 More things broken than fixed. Rolling back to 263
maxter
parents: 248
diff changeset
41 {
37eed70de029 More things broken than fixed. Rolling back to 263
maxter
parents: 248
diff changeset
42 export extern(C) void _d_toUtf8(wchar* arr, uint size, string* str)
37eed70de029 More things broken than fixed. Rolling back to 263
maxter
parents: 248
diff changeset
43 {
37eed70de029 More things broken than fixed. Rolling back to 263
maxter
parents: 248
diff changeset
44 *str = toString(arr[0..size]);
37eed70de029 More things broken than fixed. Rolling back to 263
maxter
parents: 248
diff changeset
45 }
37eed70de029 More things broken than fixed. Rolling back to 263
maxter
parents: 248
diff changeset
46 }
37eed70de029 More things broken than fixed. Rolling back to 263
maxter
parents: 248
diff changeset
47 else
37eed70de029 More things broken than fixed. Rolling back to 263
maxter
parents: 248
diff changeset
48 {
37eed70de029 More things broken than fixed. Rolling back to 263
maxter
parents: 248
diff changeset
49 extern(C) void _d_toUtf8(wchar* arr, uint size, string* str)
37eed70de029 More things broken than fixed. Rolling back to 263
maxter
parents: 248
diff changeset
50 {
37eed70de029 More things broken than fixed. Rolling back to 263
maxter
parents: 248
diff changeset
51 *str = toString(arr[0..size]);
37eed70de029 More things broken than fixed. Rolling back to 263
maxter
parents: 248
diff changeset
52 }
188
7dd099050621 initial commit for D2 support
eldar
parents:
diff changeset
53 }
7dd099050621 initial commit for D2 support
eldar
parents:
diff changeset
54
7dd099050621 initial commit for D2 support
eldar
parents:
diff changeset
55