Mercurial > projects > qtd
diff qt/QGlobal.d @ 247:27497bbe62a1
Implemented qVersion, qSharedBuild. Fixes #31
author | maxter |
---|---|
date | Fri, 31 Jul 2009 11:05:22 +0000 |
parents | ba7abb5c9e03 |
children | 7664de4a55e5 |
line wrap: on
line diff
--- 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...) {