]>
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 | ||
7fa7088e | 9 | /** @ingroup group_funcmacro_misc */ |
7c913512 | 10 | //@{ |
23324ae1 | 11 | /** |
7fa7088e BP |
12 | This macro ensures that the global @a function with 0, 1, 2 or more |
13 | parameters (up to some implementaton-defined limit) is executed on scope | |
14 | exit, whether due to a normal function return or because an exception has | |
15 | been thrown. A typical example of its usage: | |
7c913512 | 16 | |
23324ae1 FM |
17 | @code |
18 | void *buf = malloc(size); | |
7fa7088e | 19 | wxON_BLOCK_EXIT1(free, buf); |
23324ae1 | 20 | @endcode |
7c913512 | 21 | |
23324ae1 | 22 | Please see the original article by Andrei Alexandrescu and Petru Marginean |
7fa7088e BP |
23 | published in December 2000 issue of C/C++ Users Journal for more details. |
24 | ||
25 | @see wxON_BLOCK_EXIT_OBJ0() | |
26 | ||
27 | @header{wx/scopeguard.h} | |
28 | */ | |
29 | #define wxON_BLOCK_EXIT0(function) | |
30 | #define wxON_BLOCK_EXIT1(function, p1) | |
31 | #define wxON_BLOCK_EXIT2(function, p1, p2) | |
32 | //@} | |
33 | ||
34 | /** @ingroup group_funcmacro_misc */ | |
35 | //@{ | |
36 | /** | |
37 | This family of macros is similar to wxON_BLOCK_EXIT0(), but calls a method | |
38 | of the given object instead of a free function. | |
7c913512 | 39 | |
7fa7088e | 40 | @header{wx/scopeguard.h} |
23324ae1 | 41 | */ |
7fa7088e BP |
42 | #define wxON_BLOCK_EXIT_OBJ0(object, method) |
43 | #define wxON_BLOCK_EXIT_OBJ1(object, method, p1) | |
44 | #define wxON_BLOCK_EXIT_OBJ2(object, method, p1, p2) | |
23324ae1 FM |
45 | //@} |
46 |