changeset 247:27497bbe62a1

Implemented qVersion, qSharedBuild. Fixes #31
author maxter
date Fri, 31 Jul 2009 11:05:22 +0000
parents 7e589f525254
children 7664de4a55e5
files cpp/qt_qtd/qtd_core.cpp qt/QGlobal.d qt/d1/qt/qtd/Str.d qt/d2/qt/qtd/Str.d
diffstat 4 files changed, 50 insertions(+), 23 deletions(-) [+]
line wrap: on
line diff
--- a/cpp/qt_qtd/qtd_core.cpp	Sun Jul 26 16:15:42 2009 +0000
+++ b/cpp/qt_qtd/qtd_core.cpp	Fri Jul 31 11:05:22 2009 +0000
@@ -29,6 +29,16 @@
     return mia;
 }
 
+extern "C" DLL_PUBLIC const char* qtd_qVersion()
+{
+    return qVersion();
+}
+
+extern "C" DLL_PUBLIC bool qtd_qSharedBuild()
+{
+    return qSharedBuild();
+}
+
 #ifdef CPP_SHARED
 QTD_EXPORT_VAR(_d_toUtf8)
 QTD_EXPORT_VAR(__qtd_dummy)
--- a/qt/QGlobal.d	Sun Jul 26 16:15:42 2009 +0000
+++ b/qt/QGlobal.d	Fri Jul 31 11:05:22 2009 +0000
@@ -182,12 +182,27 @@
     static const MacVersion MacintoshVersion;
 };
 
-char[] qVersion();
-bool qSharedBuild();
+
+extern(C) stringz qtd_qVersion();
+///
+string qVersion()
+{
+    return fromStringz(qtd_qVersion);
+}
 
+extern(C) bool qtd_qSharedBuild();
+///
+bool qSharedBuild()
+{
+    return qtd_qSharedBuild;
+}
+
+///
 int qMacVersion() { return QSysInfo.MacintoshVersion; }
 
+///
 void qUnused(T)(T x) { cast(void) x; }
+///
 void Q_UNUSED(T)(T x) { qUnused(x); }
 
 /*
@@ -592,10 +607,10 @@
     ubyte a;
     void* b;
 }
- 
+
 private
 const PTR_ALIGN = Align.tupleof[1].alignof;
- 
+
 private
 template AlignPad(size_t base, size_t aligned)
 {
@@ -605,7 +620,7 @@
         const AlignPad = ((base+PTR_ALIGN-1)/PTR_ALIGN)*PTR_ALIGN
             + aligned;
 }
- 
+
 template InstanceSize(T)
 {
     static if( is( T == Object ) )
@@ -615,12 +630,12 @@
             AlignPad!(
                 InstanceSize!(Super!(T)),
                 InterfaceCount!(T)*(void*).sizeof),
- 
+
             AlignPad!(
                 InstanceSizeImpl!(T, 0),
                 + InterfaceCount!(T)*(void*).sizeof));
 }
- 
+
 private
 template Super(T)
 {
@@ -629,19 +644,19 @@
     else
         static assert(false, "Can't get super of "~T.mangleof);
 }
- 
+
 private
 template First(T)
 {
     alias T First;
 }
- 
+
 private
 template First(T, Ts...)
 {
     alias T First;
 }
- 
+
 private
 template InstanceSizeImpl(T, size_t i)
 {
@@ -654,7 +669,7 @@
         // variables.
         const InstanceSizeImpl = 2*(void*).sizeof;
 }
- 
+
 private
 template Max(size_t a, size_t b)
 {
@@ -663,7 +678,7 @@
     else
         const Max = b;
 }
- 
+
 private
 template InterfaceCount(T)
 {
@@ -672,7 +687,7 @@
     else static if( is( T S == super ) )
         const InterfaceCount = InterfaceCountImpl!(S);
 }
- 
+
 private
 template InterfaceCountImpl(TBase, TInterfaces...)
 {
--- a/qt/d1/qt/qtd/Str.d	Sun Jul 26 16:15:42 2009 +0000
+++ b/qt/d1/qt/qtd/Str.d	Fri Jul 31 11:05:22 2009 +0000
@@ -11,16 +11,14 @@
 
 module qt.qtd.Str;
 
-version (Tango)
-{
-    import tango.text.convert.Utf : toString;
-    alias char[] string;
-    alias wchar[] wstring;
-}
-else
-{
-    import std.utf : toString = toUTF8;
-}
+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)
 {
@@ -38,6 +36,7 @@
 
 	return argv;
 }
+
 version(Windows)
 {
     export extern(C) void _d_toUtf8(wchar* arr, uint size, string* str)
--- a/qt/d2/qt/qtd/Str.d	Sun Jul 26 16:15:42 2009 +0000
+++ b/qt/d2/qt/qtd/Str.d	Fri Jul 31 11:05:22 2009 +0000
@@ -20,6 +20,9 @@
     version = druntime;
 }
 
+alias immutable(char)* stringz;
+alias const(char)* cstringz;
+
 public static char** toStringzArray(string[] args)
 {
     if ( args is null )