2 Copyright (C) 2001-2006, William Joseph.
5 This file is part of GtkRadiant.
7 GtkRadiant is free software; you can redistribute it and/or modify
8 it under the terms of the GNU General Public License as published by
9 the Free Software Foundation; either version 2 of the License, or
10 (at your option) any later version.
12 GtkRadiant is distributed in the hope that it will be useful,
13 but WITHOUT ANY WARRANTY; without even the implied warranty of
14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 GNU General Public License for more details.
17 You should have received a copy of the GNU General Public License
18 along with GtkRadiant; if not, write to the Free Software
19 Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
24 #if defined(_DEBUG) || defined(DOXYGEN)
26 namespace ExampleMemberCaller
28 // MemberCaller example
34 void printValue() const
36 // print this->value here;
43 // a typedef to make things more readable
44 typedef MemberCaller<Integer, &Integer::setValue> SetValueCaller;
52 Callback bar = ConstMemberCaller<Integer, &Integer::printValue>(foo);
54 // invoke the callback
55 bar(); // foo.printValue()
60 // use the typedef to improve readability
61 Callback bar = Integer::SetValueCaller(foo);
63 // invoke the callback
64 bar(); // foo.setValue()
70 namespace ExampleReferenceCaller
72 // ReferenceCaller example
73 void Int_printValue(const int& value)
78 void Int_setValue(int& value)
83 // a typedef to make things more readable
84 typedef ReferenceCaller<int, Int_setValue> IntSetValueCaller;
91 Callback bar = ConstReferenceCaller<int, Int_printValue>(foo);
93 // invoke the callback
94 bar(); // Int_printValue(foo)
99 // use the typedef to improve readability
100 Callback bar = IntSetValueCaller(foo);
102 // invoke the callback
103 bar(); // Int_setValue(foo)