summaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorbrain <brain@e03df62e-2008-0410-955e-edbf42e46eb7>2007-07-25 17:41:06 +0000
committerbrain <brain@e03df62e-2008-0410-955e-edbf42e46eb7>2007-07-25 17:41:06 +0000
commitc39ccd1fdaef9ac6fd62888badc0240e8a88c55a (patch)
tree7ef34f56ce1386ddc4321981927c8b874dec70b6 /include
parent529f16e84b4ba1328a13be32e40a71156c4725f8 (diff)
Add macros up to 8 parameters
git-svn-id: http://svn.inspircd.org/repository/trunk/inspircd@7570 e03df62e-2008-0410-955e-edbf42e46eb7
Diffstat (limited to 'include')
-rw-r--r--include/caller.h28
1 files changed, 27 insertions, 1 deletions
diff --git a/include/caller.h b/include/caller.h
index 396a5ba5a..4b4651b33 100644
--- a/include/caller.h
+++ b/include/caller.h
@@ -237,6 +237,14 @@ template <typename ReturnType, typename Param1, typename Param2, typename Param3
}
};
+/** These shorthand macros are used to define a functor class which only implements Call(). Most functors are like this.
+ * If you want something more complex, define them by hand.
+ *
+ * The first parameter to each macro is the class name to define, the second parameter is the return value of Call().
+ * The following parameters are the parameter types for Call(), and again, the macro is numbered to match the number of
+ * parameters, to prevent mistakes.
+ */
+
#define DEFINE_HANDLER0(NAME, RETURN) \
class CoreExport NAME : public HandlerBase0<RETURN> { InspIRCd* Server; public: NAME(InspIRCd* Srv) : Server(Srv) { } virtual ~NAME() { } virtual RETURN Call(); };
@@ -244,7 +252,25 @@ template <typename ReturnType, typename Param1, typename Param2, typename Param3
class CoreExport NAME : public HandlerBase1<RETURN, V1> { InspIRCd* Server; public: NAME(InspIRCd* Srv) : Server(Srv) { } virtual ~NAME() { } virtual RETURN Call(V1); };
#define DEFINE_HANDLER2(NAME, RETURN, V1, V2) \
- class CoreExport NAME : public HandlerBase2<RETURN, V1, V2> { InspIRCd* Server; public: NAME(InspIRCd* Srv) : Server(Srv) { } virtual ~NAME() { } virtual RETURN Call(V2); };
+ class CoreExport NAME : public HandlerBase2<RETURN, V1, V2> { InspIRCd* Server; public: NAME(InspIRCd* Srv) : Server(Srv) { } virtual ~NAME() { } virtual RETURN Call(V1, V2); };
+
+#define DEFINE_HANDLER3(NAME, RETURN, V1, V2, V3) \
+ class CoreExport NAME : public HandlerBase3<RETURN, V1, V2, V3> { InspIRCd* Server; public: NAME(InspIRCd* Srv) : Server(Srv) { } virtual ~NAME() { } virtual RETURN Call(V1, V2, V3); };
+
+#define DEFINE_HANDLER4(NAME, RETURN, V1, V2, V3, V4) \
+ class CoreExport NAME : public HandlerBase4<RETURN, V1, V2, V3, V4> { InspIRCd* Server; public: NAME(InspIRCd* Srv) : Server(Srv) { } virtual ~NAME() { } virtual RETURN Call(V1, V2, V3, V4); };
+
+#define DEFINE_HANDLER5(NAME, RETURN, V1, V2, V3, V4, V5) \
+ class CoreExport NAME : public HandlerBase5<RETURN, V1, V2, V3, V4, V5> { InspIRCd* Server; public: NAME(InspIRCd* Srv) : Server(Srv) { } virtual ~NAME() { } virtual RETURN Call(V1, V2, V3, V4, V5); };
+
+#define DEFINE_HANDLER6(NAME, RETURN, V1, V2, V3, V4, V5, V6) \
+ class CoreExport NAME : public HandlerBase6<RETURN, V1, V2, V3, V4, V5, V6> { InspIRCd* Server; public: NAME(InspIRCd* Srv) : Server(Srv) { } virtual ~NAME() { } virtual RETURN Call(V1, V2, V3, V4, V5, V6); };
+
+#define DEFINE_HANDLER7(NAME, RETURN, V1, V2, V3, V4, V5, V6, V7) \
+ class CoreExport NAME : public HandlerBase7<RETURN, V1, V2, V3, V4, V5, V6, V7> { InspIRCd* Server; public: NAME(InspIRCd* Srv) : Server(Srv) { } virtual ~NAME() { } virtual RETURN Call(V1, V2, V3, V4, V5, V6, V7); };
+
+#define DEFINE_HANDLER8(NAME, RETURN, V1, V2, V3, V4, V5, V6, V7, V8) \
+ class CoreExport NAME : public HandlerBase8<RETURN, V1, V2, V3, V4, V5, V6, V7, V8> { InspIRCd* Server; public: NAME(InspIRCd* Srv) : Server(Srv) { } virtual ~NAME() { } virtual RETURN Call(V1, V2, V3, V4, V5, V6, V7, V8); };
#endif