summaryrefslogtreecommitdiff
path: root/libs/lua
diff options
context:
space:
mode:
authorRobin Gareus <robin@gareus.org>2016-05-31 23:32:12 +0200
committerRobin Gareus <robin@gareus.org>2016-05-31 23:51:22 +0200
commitf87cd4435dbe20470b46ad9a7510da97435c0c73 (patch)
tree47bbcca385fb8dcaf15182c281e5a47c791ee956 /libs/lua
parent14b4bac7f21d5dfd0d88887d34008aec646c086d (diff)
allow lua binding functions with up to 9 parameters
e.g new_midi_track()
Diffstat (limited to 'libs/lua')
-rw-r--r--libs/lua/LuaBridge/detail/FuncTraits.h91
1 files changed, 91 insertions, 0 deletions
diff --git a/libs/lua/LuaBridge/detail/FuncTraits.h b/libs/lua/LuaBridge/detail/FuncTraits.h
index c99d028e86..5cece7b15c 100644
--- a/libs/lua/LuaBridge/detail/FuncTraits.h
+++ b/libs/lua/LuaBridge/detail/FuncTraits.h
@@ -178,6 +178,20 @@ struct FuncTraits <R (*) (P1, P2, P3, P4, P5, P6, P7, P8), D>
}
};
+template <class R, class P1, class P2, class P3, class P4, class P5, class P6, class P7, class P8, class P9, class D>
+struct FuncTraits <R (*) (P1, P2, P3, P4, P5, P6, P7, P8, P9), D>
+{
+ static bool const isMemberFunction = false;
+ typedef D DeclType;
+ typedef R ReturnType;
+ typedef TypeList <P1, TypeList <P2, TypeList <P3, TypeList <P4, TypeList <P5, TypeList <P6, TypeList <P7, TypeList <P8, TypeList <P9> > > > > > > > > Params;
+ static R call (D fp, TypeListValues <Params>& tvl)
+ {
+ return fp (tvl.hd, tvl.tl.hd, tvl.tl.tl.hd, tvl.tl.tl.tl.hd, tvl.tl.tl.tl.tl.hd, tvl.tl.tl.tl.tl.tl.hd, tvl.tl.tl.tl.tl.tl.tl.hd, tvl.tl.tl.tl.tl.tl.tl.tl.hd, tvl.tl.tl.tl.tl.tl.tl.tl.tl.hd);
+ }
+};
+
+
/* Non-const member function pointers. */
template <class T, class R, class D>
@@ -315,6 +329,22 @@ struct FuncTraits <R (T::*) (P1, P2, P3, P4, P5, P6, P7, P8), D>
}
};
+template <class T, class R, class P1, class P2, class P3, class P4, class P5, class P6, class P7, class P8, class P9, class D>
+struct FuncTraits <R (T::*) (P1, P2, P3, P4, P5, P6, P7, P8, P9), D>
+{
+ static bool const isMemberFunction = true;
+ static bool const isConstMemberFunction = false;
+ typedef D DeclType;
+ typedef T ClassType;
+ typedef R ReturnType;
+ typedef TypeList <P1, TypeList <P2, TypeList <P3, TypeList <P4, TypeList <P5, TypeList <P6, TypeList <P7, TypeList <P8, TypeList <P9> > > > > > > > > Params;
+ static R call (T* obj, D fp, TypeListValues <Params>& tvl)
+ {
+ return (obj->*fp)(tvl.hd, tvl.tl.hd, tvl.tl.tl.hd, tvl.tl.tl.tl.hd, tvl.tl.tl.tl.tl.hd, tvl.tl.tl.tl.tl.tl.hd, tvl.tl.tl.tl.tl.tl.tl.hd, tvl.tl.tl.tl.tl.tl.tl.tl.hd, tvl.tl.tl.tl.tl.tl.tl.tl.tl.hd);
+ }
+};
+
+
/* Const member function pointers. */
template <class T, class R, class D>
@@ -453,6 +483,22 @@ struct FuncTraits <R (T::*) (P1, P2, P3, P4, P5, P6, P7, P8) const, D>
}
};
+template <class T, class R, class P1, class P2, class P3, class P4, class P5, class P6, class P7, class P8, class P9, class D>
+struct FuncTraits <R (T::*) (P1, P2, P3, P4, P5, P6, P7, P8, P9) const, D>
+{
+ static bool const isMemberFunction = true;
+ static bool const isConstMemberFunction = true;
+ typedef D DeclType;
+ typedef T ClassType;
+ typedef R ReturnType;
+ typedef TypeList <P1, TypeList <P2, TypeList <P3, TypeList <P4, TypeList <P5, TypeList <P6, TypeList <P7, TypeList <P8, TypeList <P9> > > > > > > > > Params;
+ static R call (T const* obj, D fp, TypeListValues <Params>& tvl)
+ {
+ return (obj->*fp)(tvl.hd, tvl.tl.hd, tvl.tl.tl.hd, tvl.tl.tl.tl.hd, tvl.tl.tl.tl.tl.hd, tvl.tl.tl.tl.tl.tl.hd, tvl.tl.tl.tl.tl.tl.tl.hd, tvl.tl.tl.tl.tl.tl.tl.tl.hd, tvl.tl.tl.tl.tl.tl.tl.tl.tl.hd);
+ }
+};
+
+
#if defined (LUABRIDGE_THROWSPEC)
/* Ordinary function pointers. */
@@ -574,6 +620,19 @@ struct FuncTraits <R (*) (P1, P2, P3, P4, P5, P6, P7, P8) LUABRIDGE_THROWSPEC, D
}
};
+template <class R, class P1, class P2, class P3, class P4, class P5, class P6, class P7, class P8, class P9, class D>
+struct FuncTraits <R (*) (P1, P2, P3, P4, P5, P6, P7, P8, P9) LUABRIDGE_THROWSPEC, D>
+{
+ static bool const isMemberFunction = false;
+ typedef D DeclType;
+ typedef R ReturnType;
+ typedef TypeList <P1, TypeList <P2, TypeList <P3, TypeList <P4, TypeList <P5, TypeList <P6, TypeList <P7, TypeList <P8, TypeList <P9> > > > > > > > > Params;
+ static R call (D fp, TypeListValues <Params>& tvl)
+ {
+ return fp (tvl.hd, tvl.tl.hd, tvl.tl.tl.hd, tvl.tl.tl.tl.hd, tvl.tl.tl.tl.tl.hd, tvl.tl.tl.tl.tl.tl.hd, tvl.tl.tl.tl.tl.tl.tl.hd, tvl.tl.tl.tl.tl.tl.tl.tl.hd, tvl.tl.tl.tl.tl.tl.tl.tl.tl.hd);
+ }
+};
+
/* Non-const member function pointers with THROWSPEC. */
template <class T, class R, class D>
@@ -711,6 +770,22 @@ struct FuncTraits <R (T::*) (P1, P2, P3, P4, P5, P6, P7, P8) LUABRIDGE_THROWSPEC
}
};
+template <class T, class R, class P1, class P2, class P3, class P4, class P5, class P6, class P7, class P8, class P9, class D>
+struct FuncTraits <R (T::*) (P1, P2, P3, P4, P5, P6, P7, P8, P9) LUABRIDGE_THROWSPEC, D>
+{
+ static bool const isMemberFunction = true;
+ static bool const isConstMemberFunction = false;
+ typedef D DeclType;
+ typedef T ClassType;
+ typedef R ReturnType;
+ typedef TypeList <P1, TypeList <P2, TypeList <P3, TypeList <P4, TypeList <P5, TypeList <P6, TypeList <P7, TypeList <P8, TypeList <P9> > > > > > > > > Params;
+ static R call (T* obj, D fp, TypeListValues <Params>& tvl)
+ {
+ return (obj->*fp)(tvl.hd, tvl.tl.hd, tvl.tl.tl.hd, tvl.tl.tl.tl.hd, tvl.tl.tl.tl.tl.hd, tvl.tl.tl.tl.tl.tl.hd, tvl.tl.tl.tl.tl.tl.tl.hd, tvl.tl.tl.tl.tl.tl.tl.tl.hd, tvl.tl.tl.tl.tl.tl.tl.tl.tl.hd);
+ }
+};
+
+
/* Const member function pointers with THROWSPEC. */
template <class T, class R, class D>
@@ -849,4 +924,20 @@ struct FuncTraits <R (T::*) (P1, P2, P3, P4, P5, P6, P7, P8) const LUABRIDGE_THR
}
};
+template <class T, class R, class P1, class P2, class P3, class P4, class P5, class P6, class P7, class P8, class P9, class D>
+struct FuncTraits <R (T::*) (P1, P2, P3, P4, P5, P6, P7, P8, P9) const LUABRIDGE_THROWSPEC, D>
+{
+ static bool const isMemberFunction = true;
+ static bool const isConstMemberFunction = true;
+ typedef D DeclType;
+ typedef T ClassType;
+ typedef R ReturnType;
+ typedef TypeList <P1, TypeList <P2, TypeList <P3, TypeList <P4, TypeList <P5, TypeList <P6, TypeList <P7, TypeList <P8, TypeList <P9> > > > > > > > > Params;
+ static R call (T const* obj, D fp, TypeListValues <Params>& tvl)
+ {
+ return (obj->*fp)(tvl.hd, tvl.tl.hd, tvl.tl.tl.hd, tvl.tl.tl.tl.hd, tvl.tl.tl.tl.tl.hd, tvl.tl.tl.tl.tl.tl.hd, tvl.tl.tl.tl.tl.tl.tl.hd, tvl.tl.tl.tl.tl.tl.tl.tl.hd, tvl.tl.tl.tl.tl.tl.tl.tl.tl.hd);
+ }
+};
+
+
#endif