aboutsummaryrefslogtreecommitdiff
path: root/gensigs.bld
diff options
context:
space:
mode:
authorMike Buland <eichlan@xagasoft.com>2012-12-21 00:06:20 +0000
committerMike Buland <eichlan@xagasoft.com>2012-12-21 00:06:20 +0000
commit8642fe0ba100dee5a66265b07e21e043887a4a92 (patch)
tree25a0a32061a53d730d4af102c26e858b9a5344f4 /gensigs.bld
parent6af2989d3abbe9ff64631df33f9f9e135274d90c (diff)
downloadlibbu++-8642fe0ba100dee5a66265b07e21e043887a4a92.tar.gz
libbu++-8642fe0ba100dee5a66265b07e21e043887a4a92.tar.bz2
libbu++-8642fe0ba100dee5a66265b07e21e043887a4a92.tar.xz
libbu++-8642fe0ba100dee5a66265b07e21e043887a4a92.zip
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.
Diffstat (limited to 'gensigs.bld')
-rw-r--r--gensigs.bld26
1 files changed, 25 insertions, 1 deletions
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 )
16 "#ifndef BU_SIGNALS_H\n" 16 "#ifndef BU_SIGNALS_H\n"
17 "#define BU_SIGNALS_H\n" 17 "#define BU_SIGNALS_H\n"
18 "\n" 18 "\n"
19 "#include <typeinfo>\n"
19 "#include \"bu/util.h\"\n" 20 "#include \"bu/util.h\"\n"
20 "#include \"bu/exceptionbase.h\"\n" 21 "#include \"bu/exceptionbase.h\"\n"
21 "#include \"bu/list.h\"\n" 22 "#include \"bu/list.h\"\n"
@@ -69,6 +70,7 @@ function genSigs( outName )
69 " virtual ~_Slot${i}() { }\n" 70 " virtual ~_Slot${i}() { }\n"
70 " virtual ret operator()( ${funcParams} )=0;\n" 71 " virtual ret operator()( ${funcParams} )=0;\n"
71 " virtual _Slot${i}<${templCallParams}> *clone() const=0;\n" 72 " virtual _Slot${i}<${templCallParams}> *clone() const=0;\n"
73 " virtual bool operator==( const _Slot${i}<${templCallParams}> &rhs ) const=0;\n"
72 " };\n" 74 " };\n"
73 " \n" 75 " \n"
74 " template<typename cls, ${templParams}>\n" 76 " template<typename cls, ${templParams}>\n"
@@ -89,6 +91,12 @@ function genSigs( outName )
89 " return new __Slot${i}<cls, ${templCallParams}>( pCls, pFnc );\n" 91 " return new __Slot${i}<cls, ${templCallParams}>( pCls, pFnc );\n"
90 " }\n" 92 " }\n"
91 " \n" 93 " \n"
94 " virtual bool operator==( const _Slot${i}<${templCallParams}> &rhs ) const\n"
95 " {\n"
96 " const __Slot${i}<cls, ${templCallParams}> &rrhs = (const __Slot${i}<cls, ${templCallParams}> &)rhs;\n"
97 " return pCls == rrhs.pCls && pFnc == rrhs.pFnc;\n"
98 " }\n"
99 " \n"
92 " private:\n" 100 " private:\n"
93 " cls *pCls;\n" 101 " cls *pCls;\n"
94 " ret (cls::*pFnc)( ${funcAnonParams} );\n" 102 " ret (cls::*pFnc)( ${funcAnonParams} );\n"
@@ -112,6 +120,11 @@ function genSigs( outName )
112 " return new __Slot${i}F<${templCallParams}>( pFnc );\n" 120 " return new __Slot${i}F<${templCallParams}>( pFnc );\n"
113 " }\n" 121 " }\n"
114 " \n" 122 " \n"
123 " virtual bool operator==( const _Slot${i}<${templCallParams}> &rhs ) const\n"
124 " {\n"
125 " return pFnc == ((const __Slot${i}F<${templCallParams}> &)rhs).pFnc;\n"
126 " }\n"
127 " \n"
115 " private:\n" 128 " private:\n"
116 " ret (*pFnc)( ${funcAnonParams} );\n" 129 " ret (*pFnc)( ${funcAnonParams} );\n"
117 " };\n" 130 " };\n"
@@ -141,6 +154,17 @@ function genSigs( outName )
141 " return *this;\n" 154 " return *this;\n"
142 " }\n" 155 " }\n"
143 " \n" 156 " \n"
157 " bool operator==( const Signal${i}<${templCallParams}> &rhs ) const\n"
158 " {\n"
159 " if( pCb == rhs.pCb )\n"
160 " return true;\n"
161 " if( pCb == NULL || rhs.pCb == NULL )\n"
162 " return false;\n"
163 " if( typeid(pCb) != typeid(rhs.pCb) )\n"
164 " return false;\n"
165 " return *pCb == *rhs.pCb;\n"
166 " }\n"
167 " \n"
144 " private:\n" 168 " private:\n"
145 " _Slot${i}<${templCallParams}> *pCb;\n" 169 " _Slot${i}<${templCallParams}> *pCb;\n"
146 " };\n" 170 " };\n"
@@ -187,7 +211,7 @@ function genSigs( outName )
187 " else\n" 211 " else\n"
188 " return (*i)( ${funcCallParams} );\n" 212 " return (*i)( ${funcCallParams} );\n"
189 " }\n" 213 " }\n"
190 " throw Bu::ExceptionBase(\"Empty SignalList with non-void return value called.\");\n" 214 " throw Bu::SignalException(\"Empty SignalList with non-void return value called.\");\n"
191 " }\n" 215 " }\n"
192 " };\n" 216 " };\n"
193 " \n" 217 " \n"