comparison qt/qtd/Str.d @ 1:e78566595089

initial import
author mandel
date Mon, 11 May 2009 16:01:50 +0000
parents
children
comparison
equal deleted inserted replaced
0:36fb74dc547d 1:e78566595089
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 }
19 else
20 {
21 import std.utf : toString = toUTF8;
22 }
23
24 public static char** toStringzArray(char[][] args)
25 {
26 if ( args is null )
27 {
28 return null;
29 }
30 char** argv = (new char*[args.length]).ptr;
31 int argc = 0;
32 foreach (char[] p; args)
33 {
34 argv[argc++] = cast(char*)(p.dup~'\0');
35 }
36 argv[argc] = null;
37
38 return argv;
39 }
40 version(Windows)
41 {
42 export extern(C) void _d_toUtf8(wchar* arr, uint size, string* str)
43 {
44 *str = toString(arr[0..size]);
45 }
46 }
47 else
48 {
49 extern(C) void _d_toUtf8(wchar* arr, uint size, string* str)
50 {
51 *str = toString(arr[0..size]);
52 }
53 }
54
55