]> git.saurik.com Git - wxWidgets.git/blob - interface/scopeguard.h
Finished review/fixes of GDI category of functions and macros.
[wxWidgets.git] / interface / scopeguard.h
1 /////////////////////////////////////////////////////////////////////////////
2 // Name: scopeguard.h
3 // Purpose: interface of global functions
4 // Author: wxWidgets team
5 // RCS-ID: $Id$
6 // Licence: wxWindows license
7 /////////////////////////////////////////////////////////////////////////////
8
9 //@{
10 /**
11 This family of macros is similar to wxON_BLOCK_EXIT()
12 but calls a method of the given object instead of a free function.
13 */
14 wxON_BLOCK_EXIT_OBJ0(obj, method);
15 wxON_BLOCK_EXIT_OBJ1(obj, method, p1);
16 wxON_BLOCK_EXIT_OBJ2(obj, method, p1, p2);
17 //@}
18
19
20 //@{
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:
26
27 @code
28 void *buf = malloc(size);
29 wxON_BLOCK_EXIT1(free, buf);
30 @endcode
31
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.
35
36 @see wxON_BLOCK_EXIT_OBJ()
37 */
38 wxON_BLOCK_EXIT0(func);
39 wxON_BLOCK_EXIT1(func, p1);
40 wxON_BLOCK_EXIT2(func, p1, p2);
41 //@}
42