comparison qt/d1/qt/qtd/Str.d @ 188:7dd099050621

initial commit for D2 support
author eldar
date Sun, 12 Jul 2009 18:58:03 +0000
parents
children 27497bbe62a1
comparison
equal deleted inserted replaced
187:34fe79a9915b 188:7dd099050621
1 /**
2 *
3 * Copyright: Copyright QtD Team, 2008-2009
4 * License: <a href="http://www.boost.org/LICENSE_1_0.txt>Boost License 1.0</a>
5 *
6 * Copyright QtD Team, 2008-2009
7 * Distributed under the Boost Software License, Version 1.0.
8 * (See accompanying file boost-license-1.0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
9 *
10 */
11
12 module qt.qtd.Str;
13
14 version (Tango)
15 {
16 import tango.text.convert.Utf : toString;
17 alias char[] string;
18 alias wchar[] wstring;
19 }
20 else
21 {
22 import std.utf : toString = toUTF8;
23 }
24
25 public static char** toStringzArray(char[][] args)
26 {
27 if ( args is null )
28 {
29 return null;
30 }
31 char** argv = (new char*[args.length]).ptr;
32 int argc = 0;
33 foreach (char[] p; args)
34 {
35 argv[argc++] = cast(char*)(p.dup~'\0');
36 }
37 argv[argc] = null;
38
39 return argv;
40 }
41 version(Windows)
42 {
43 export extern(C) void _d_toUtf8(wchar* arr, uint size, string* str)
44 {
45 *str = toString(arr[0..size]);
46 }
47 }
48 else
49 {
50 extern(C) void _d_toUtf8(wchar* arr, uint size, string* str)
51 {
52 *str = toString(arr[0..size]);
53 }
54 }
55
56