]>
Commit | Line | Data |
---|---|---|
23324ae1 | 1 | ///////////////////////////////////////////////////////////////////////////// |
7c913512 | 2 | // Name: scopeguard.h |
e54c96f1 | 3 | // Purpose: interface of global functions |
7c913512 FM |
4 | // Author: wxWidgets team |
5 | // RCS-ID: $Id$ | |
6 | // Licence: wxWindows license | |
7 | ///////////////////////////////////////////////////////////////////////////// | |
8 | ||
9 | //@{ | |
23324ae1 | 10 | /** |
e54c96f1 | 11 | This family of macros is similar to wxON_BLOCK_EXIT() |
23324ae1 FM |
12 | but calls a method of the given object instead of a free function. |
13 | */ | |
4cc4bfaf FM |
14 | wxON_BLOCK_EXIT_OBJ0(obj, method); |
15 | wxON_BLOCK_EXIT_OBJ1(obj, method, p1); | |
16 | wxON_BLOCK_EXIT_OBJ2(obj, method, p1, p2); | |
23324ae1 FM |
17 | //@} |
18 | ||
19 | ||
7c913512 | 20 | //@{ |
23324ae1 FM |
21 | /** |
22 | This family of macros allows to ensure that the global function @e func | |
23 | with 0, 1, 2 or more parameters (up to some implementaton-defined limit) is | |
24 | executed on scope exit, whether due to a normal function return or because an | |
25 | exception has been thrown. A typical example of its usage: | |
7c913512 | 26 | |
23324ae1 FM |
27 | @code |
28 | void *buf = malloc(size); | |
29 | wxON_BLOCK_EXIT1(free, buf); | |
30 | @endcode | |
7c913512 | 31 | |
23324ae1 FM |
32 | Please see the original article by Andrei Alexandrescu and Petru Marginean |
33 | published in December 2000 issue of C/C++ Users Journal for more | |
34 | details. | |
7c913512 | 35 | |
e54c96f1 | 36 | @see wxON_BLOCK_EXIT_OBJ() |
23324ae1 | 37 | */ |
7c913512 | 38 | wxON_BLOCK_EXIT0(func); |
4cc4bfaf FM |
39 | wxON_BLOCK_EXIT1(func, p1); |
40 | wxON_BLOCK_EXIT2(func, p1, p2); | |
23324ae1 FM |
41 | //@} |
42 |