Mercurial > projects > qtd
view qt/d1/qt/qtd/Str.d @ 253:073b9153ed8a
Rev. 264 done right.
Problems:
- classwizard segfaults on exit due to a bug in signals/slots or runtime.
- hellogl doesn't compile with dmd2 due to a bug in the compiler backend
author | maxter |
---|---|
date | Sun, 30 Aug 2009 09:59:12 +0000 |
parents | 37eed70de029 |
children | 34a37904ff77 |
line wrap: on
line source
/** * * Copyright: Copyright QtD Team, 2008-2009 * License: <a href="http://www.boost.org/LICENSE_1_0.txt>Boost License 1.0</a> * * Copyright QtD Team, 2008-2009 * Distributed under the Boost Software License, Version 1.0. * (See accompanying file boost-license-1.0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) * */ module qt.qtd.Str; import tango.text.convert.Utf : toString; public import tango.stdc.stringz : fromStringz; alias char[] string; alias wchar[] wstring; alias char* stringz; alias char* cstringz; public static char** toStringzArray(char[][] args) { if ( args is null ) { return null; } char** argv = (new char*[args.length]).ptr; int argc = 0; foreach (char[] p; args) { argv[argc++] = cast(char*)(p.dup~'\0'); } argv[argc] = null; return argv; } version(Windows) { export extern(C) void _d_toUtf8(wchar* arr, uint size, string* str) { *str = toString(arr[0..size]); } } else { extern(C) void _d_toUtf8(wchar* arr, uint size, string* str) { *str = toString(arr[0..size]); } }