From 8642fe0ba100dee5a66265b07e21e043887a4a92 Mon Sep 17 00:00:00 2001 From: Mike Buland Date: Fri, 21 Dec 2012 00:06:20 +0000 Subject: Signals (slots really) are now comperable. Building two slots for the same function or same object and method will compare as expected. Also added a -= function to Bu::List which works just like erase. --- gensigs.bld | 26 +++++++++++++++++++++++++- 1 file changed, 25 insertions(+), 1 deletion(-) (limited to 'gensigs.bld') diff --git a/gensigs.bld b/gensigs.bld index 6cdd5d5..6bb1e55 100644 --- a/gensigs.bld +++ b/gensigs.bld @@ -16,6 +16,7 @@ function genSigs( outName ) "#ifndef BU_SIGNALS_H\n" "#define BU_SIGNALS_H\n" "\n" + "#include \n" "#include \"bu/util.h\"\n" "#include \"bu/exceptionbase.h\"\n" "#include \"bu/list.h\"\n" @@ -69,6 +70,7 @@ function genSigs( outName ) " virtual ~_Slot${i}() { }\n" " virtual ret operator()( ${funcParams} )=0;\n" " virtual _Slot${i}<${templCallParams}> *clone() const=0;\n" + " virtual bool operator==( const _Slot${i}<${templCallParams}> &rhs ) const=0;\n" " };\n" " \n" " template\n" @@ -89,6 +91,12 @@ function genSigs( outName ) " return new __Slot${i}( pCls, pFnc );\n" " }\n" " \n" + " virtual bool operator==( const _Slot${i}<${templCallParams}> &rhs ) const\n" + " {\n" + " const __Slot${i} &rrhs = (const __Slot${i} &)rhs;\n" + " return pCls == rrhs.pCls && pFnc == rrhs.pFnc;\n" + " }\n" + " \n" " private:\n" " cls *pCls;\n" " ret (cls::*pFnc)( ${funcAnonParams} );\n" @@ -112,6 +120,11 @@ function genSigs( outName ) " return new __Slot${i}F<${templCallParams}>( pFnc );\n" " }\n" " \n" + " virtual bool operator==( const _Slot${i}<${templCallParams}> &rhs ) const\n" + " {\n" + " return pFnc == ((const __Slot${i}F<${templCallParams}> &)rhs).pFnc;\n" + " }\n" + " \n" " private:\n" " ret (*pFnc)( ${funcAnonParams} );\n" " };\n" @@ -141,6 +154,17 @@ function genSigs( outName ) " return *this;\n" " }\n" " \n" + " bool operator==( const Signal${i}<${templCallParams}> &rhs ) const\n" + " {\n" + " if( pCb == rhs.pCb )\n" + " return true;\n" + " if( pCb == NULL || rhs.pCb == NULL )\n" + " return false;\n" + " if( typeid(pCb) != typeid(rhs.pCb) )\n" + " return false;\n" + " return *pCb == *rhs.pCb;\n" + " }\n" + " \n" " private:\n" " _Slot${i}<${templCallParams}> *pCb;\n" " };\n" @@ -187,7 +211,7 @@ function genSigs( outName ) " else\n" " return (*i)( ${funcCallParams} );\n" " }\n" - " throw Bu::ExceptionBase(\"Empty SignalList with non-void return value called.\");\n" + " throw Bu::SignalException(\"Empty SignalList with non-void return value called.\");\n" " }\n" " };\n" " \n" -- cgit v1.2.3