view 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
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;
}
extern(C) void qtd_toUtf8(wchar* arr, uint size, string* str){
    *str = toString(arr[0..size]);
}