diff options
author | Pavel Labath <pavelo@centrum.sk> | 2011-05-03 10:49:05 (GMT) |
---|---|---|
committer | Pavel Labath <pavelo@centrum.sk> | 2011-05-10 11:00:45 (GMT) |
commit | 0775350fee345e37fb59835dda4d85664346b606 (patch) | |
tree | 390af82593f92e11033ca2a2590a5ec7b7a3d14c /src/tests | |
parent | bef2039d2c5a31ab9f974059d991557276647af1 (diff) | |
download | fluxbox-0775350fee345e37fb59835dda4d85664346b606.zip fluxbox-0775350fee345e37fb59835dda4d85664346b606.tar.bz2 |
Last round of simplification of Signal/Slot classes
- merged all the common stuff from 0,1,2,3 argument versions into one common base class
- removed ReturnType template parameter as it was instantiated with "void" everywhere and the
current ignores the return value of the callbacks anyway
Diffstat (limited to 'src/tests')
-rw-r--r-- | src/tests/testSignals.cc | 18 |
1 files changed, 9 insertions, 9 deletions
diff --git a/src/tests/testSignals.cc b/src/tests/testSignals.cc index 75f046e..9b9d151 100644 --- a/src/tests/testSignals.cc +++ b/src/tests/testSignals.cc | |||
@@ -80,16 +80,16 @@ int main() { | |||
80 | using FbTk::Signal; | 80 | using FbTk::Signal; |
81 | using FbTk::SignalTracker; | 81 | using FbTk::SignalTracker; |
82 | 82 | ||
83 | Signal<void> no_arg; | 83 | Signal<> no_arg; |
84 | no_arg.connect( NoArgument() ); | 84 | no_arg.connect( NoArgument() ); |
85 | 85 | ||
86 | Signal<void, int> one_arg; | 86 | Signal<int> one_arg; |
87 | one_arg.connect( OneArgument() ); | 87 | one_arg.connect( OneArgument() ); |
88 | 88 | ||
89 | Signal<void, int, const string&> two_args; | 89 | Signal<int, const string&> two_args; |
90 | two_args.connect( TwoArguments() ); | 90 | two_args.connect( TwoArguments() ); |
91 | 91 | ||
92 | Signal<void, int, const string&, double> three_args; | 92 | Signal<int, const string&, double> three_args; |
93 | three_args.connect( ThreeArguments() ); | 93 | three_args.connect( ThreeArguments() ); |
94 | 94 | ||
95 | // emit test | 95 | // emit test |
@@ -127,7 +127,7 @@ int main() { | |||
127 | no_arg.emit(); | 127 | no_arg.emit(); |
128 | 128 | ||
129 | string takeThis("Take this"); | 129 | string takeThis("Take this"); |
130 | Signal<void, string&> ref_arg; | 130 | Signal<string&> ref_arg; |
131 | ref_arg.connect(MemFun(obj, &FunctionClass::takeIt)); | 131 | ref_arg.connect(MemFun(obj, &FunctionClass::takeIt)); |
132 | ref_arg.emit( takeThis ); | 132 | ref_arg.emit( takeThis ); |
133 | 133 | ||
@@ -145,7 +145,7 @@ int main() { | |||
145 | using FbTk::MemFunIgnoreArgs; | 145 | using FbTk::MemFunIgnoreArgs; |
146 | // Create a signal that emits with three arguments, and connect | 146 | // Create a signal that emits with three arguments, and connect |
147 | // sinks that takes less than three arguments. | 147 | // sinks that takes less than three arguments. |
148 | Signal<void, string, string, float> more_args; | 148 | Signal<string, string, float> more_args; |
149 | more_args.connect(MemFunIgnoreArgs(obj, &FunctionClass::print)); | 149 | more_args.connect(MemFunIgnoreArgs(obj, &FunctionClass::print)); |
150 | more_args.connect(MemFunIgnoreArgs(obj, &FunctionClass::takeIt)); | 150 | more_args.connect(MemFunIgnoreArgs(obj, &FunctionClass::takeIt)); |
151 | more_args.connect(MemFunIgnoreArgs(obj, &FunctionClass::showMessage2)); | 151 | more_args.connect(MemFunIgnoreArgs(obj, &FunctionClass::showMessage2)); |
@@ -168,7 +168,7 @@ int main() { | |||
168 | destination.attach(&obs); | 168 | destination.attach(&obs); |
169 | // create a new signal and relay it to the | 169 | // create a new signal and relay it to the |
170 | // old subject | 170 | // old subject |
171 | FbTk::Signal<void, string> source; | 171 | FbTk::Signal<string> source; |
172 | FbTk::relaySignal(source, destination); | 172 | FbTk::relaySignal(source, destination); |
173 | // the new signal should now make the old | 173 | // the new signal should now make the old |
174 | // subject notify its observers | 174 | // subject notify its observers |
@@ -178,7 +178,7 @@ int main() { | |||
178 | // Test argument selector | 178 | // Test argument selector |
179 | { | 179 | { |
180 | using namespace FbTk; | 180 | using namespace FbTk; |
181 | Signal<void, int, string, float> source; | 181 | Signal<int, string, float> source; |
182 | 182 | ||
183 | Printer printer; | 183 | Printer printer; |
184 | source.connect(MemFunSelectArg0(printer, &Printer::printInt)); | 184 | source.connect(MemFunSelectArg0(printer, &Printer::printInt)); |
@@ -187,7 +187,7 @@ int main() { | |||
187 | 187 | ||
188 | source.emit(10, "hello", 3.141592); | 188 | source.emit(10, "hello", 3.141592); |
189 | 189 | ||
190 | Signal<void, string, int> source2; | 190 | Signal<string, int> source2; |
191 | source2.connect(MemFunSelectArg0(printer, &Printer::printString)); | 191 | source2.connect(MemFunSelectArg0(printer, &Printer::printString)); |
192 | source2.connect(MemFunSelectArg1(printer, &Printer::printInt)); | 192 | source2.connect(MemFunSelectArg1(printer, &Printer::printInt)); |
193 | source2.emit("world", 37); | 193 | source2.emit("world", 37); |