Mercurial > projects > dstep
diff dstep/objc/bridge/Type.d @ 1:033d260cfc9b
First upload of the bridge
author | Jacob Carlborg <doob@me.com> |
---|---|
date | Thu, 18 Jun 2009 22:00:13 +0200 |
parents | |
children | 9fd439a28ce3 |
line wrap: on
line diff
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/dstep/objc/bridge/Type.d Thu Jun 18 22:00:13 2009 +0200 @@ -0,0 +1,36 @@ +/** + * Copyright: Copyright (c) 2009 Jacob Carlborg. + * Authors: Jacob Carlborg + * Version: Initial created: May 16, 2009 + * License: $(LINK2 http://www.boost.org/LICENSE_1_0.txt, Boost Software License 1.0) + */ +module dstep.objc.bridge.Type; + +version (Tango) + import tango.core.Tuple; + +else + import std.typetuple; + +import dstep.objc.objc; + +template ObjcTypeTuple (TList...) +{ + alias replaceClasses!(TList).types ObjcTypeTuple; +} + +private struct Wrap (TList...) +{ + TList types; +} + +private Wrap!(TList) replaceClasses (TList...) () +{ + alias Tuple!(TList) Types; + + foreach (ref type ; Types) + static if (is(type == class)) + type = id; + + return Wrap!(Types); +} \ No newline at end of file