]> git.saurik.com Git - wxWidgets.git/blame - include/wx/scopeguard.h
Define wxUSE_CAIRO in wx/chkconf.h to ensure that it's always defined.
[wxWidgets.git] / include / wx / scopeguard.h
CommitLineData
c66cca2a
VZ
1///////////////////////////////////////////////////////////////////////////////
2// Name: wx/scopeguard.h
3// Purpose: declares wxwxScopeGuard and related macros
4// Author: Vadim Zeitlin
5// Modified by:
6// Created: 03.07.2003
7// RCS-ID: $Id$
77ffb593 8// Copyright: (c) 2003 Vadim Zeitlin <vadim@wxwidgets.org>
65571936 9// Licence: wxWindows licence
c66cca2a
VZ
10///////////////////////////////////////////////////////////////////////////////
11
12/*
13 Acknowledgements: this header is heavily based on (well, almost the exact
822fc19e 14 copy of) ScopeGuard.h by Andrei Alexandrescu and Petru Marginean published
c66cca2a 15 in December 2000 issue of C/C++ Users Journal.
822fc19e 16 http://www.cuj.com/documents/cujcexp1812alexandr/
c66cca2a
VZ
17 */
18
19#ifndef _WX_SCOPEGUARD_H_
20#define _WX_SCOPEGUARD_H_
21
22#include "wx/defs.h"
23
5800b5be
VZ
24#include "wx/except.h"
25
c66cca2a
VZ
26// ----------------------------------------------------------------------------
27// helpers
28// ----------------------------------------------------------------------------
29
822fc19e
WS
30#ifdef __WATCOMC__
31
32// WATCOM-FIXME: C++ of Open Watcom 1.3 doesn't like OnScopeExit() created
33// through template so it must be workarounded with dedicated inlined macro.
34// For compatibility with Watcom compilers wxPrivate::OnScopeExit must be
35// replaced with wxPrivateOnScopeExit but in user code (for everyone who
36// doesn't care about OW compatibility) wxPrivate::OnScopeExit still works.
37
38#define wxPrivateOnScopeExit(guard) \
39 { \
40 if ( !(guard).WasDismissed() ) \
41 { \
42 wxTRY \
43 { \
44 (guard).Execute(); \
45 } \
46 wxCATCH_ALL(;) \
47 } \
48 }
49
50#define wxPrivateUse(n) wxUnusedVar(n)
51
52#else
53
e196c0a2
SN
54// namespace support was first implemented in gcc-2.95,
55// so avoid using it for older versions.
d2a48d5c
VZ
56#if !defined(__GNUC__) || wxCHECK_GCC_VERSION(2, 95)
57
58#define wxHAS_NAMESPACES
59
c66cca2a
VZ
60namespace wxPrivate
61{
e196c0a2
SN
62#else
63#define wxPrivate
64#endif
c66cca2a
VZ
65 // in the original implementation this was a member template function of
66 // ScopeGuardImplBase but gcc 2.8 which is still used for OS/2 doesn't
67 // support member templates and so we must make it global
17e22c50 68 template <class ScopeGuardImpl>
d775fa82 69 void OnScopeExit(ScopeGuardImpl& guard)
c66cca2a
VZ
70 {
71 if ( !guard.WasDismissed() )
72 {
73 // we're called from ScopeGuardImpl dtor and so we must not throw
5800b5be 74 wxTRY
c66cca2a
VZ
75 {
76 guard.Execute();
77 }
f0658b1e 78 wxCATCH_ALL(;) // do nothing, just eat the exception
c66cca2a
VZ
79 }
80 }
81
82 // just to avoid the warning about unused variables
17e22c50 83 template <class T>
c66cca2a
VZ
84 void Use(const T& WXUNUSED(t))
85 {
86 }
e196c0a2 87#if !defined(__GNUC__) || wxCHECK_GCC_VERSION(2, 95)
c66cca2a 88} // namespace wxPrivate
e196c0a2 89#endif
d775fa82 90
822fc19e
WS
91#define wxPrivateOnScopeExit(n) wxPrivate::OnScopeExit(n)
92#define wxPrivateUse(n) wxPrivate::Use(n)
93
94#endif
95
c66cca2a
VZ
96// ============================================================================
97// wxScopeGuard for functions and functors
98// ============================================================================
99
100// ----------------------------------------------------------------------------
101// wxScopeGuardImplBase: used by wxScopeGuardImpl[0..N] below
102// ----------------------------------------------------------------------------
103
104class wxScopeGuardImplBase
105{
106public:
107 wxScopeGuardImplBase() : m_wasDismissed(false) { }
108
f7e81ed1
VZ
109 wxScopeGuardImplBase(const wxScopeGuardImplBase& other)
110 : m_wasDismissed(other.m_wasDismissed)
111 {
112 other.Dismiss();
113 }
114
c66cca2a
VZ
115 void Dismiss() const { m_wasDismissed = true; }
116
426a63a3 117 // for OnScopeExit() only (we can't make it friend, unfortunately)!
c66cca2a
VZ
118 bool WasDismissed() const { return m_wasDismissed; }
119
120protected:
121 ~wxScopeGuardImplBase() { }
122
c66cca2a
VZ
123 // must be mutable for copy ctor to work
124 mutable bool m_wasDismissed;
125
126private:
127 wxScopeGuardImplBase& operator=(const wxScopeGuardImplBase&);
128};
129
d2a48d5c
VZ
130// wxScopeGuard is just a reference, see the explanation in CUJ article
131typedef const wxScopeGuardImplBase& wxScopeGuard;
132
c66cca2a
VZ
133// ----------------------------------------------------------------------------
134// wxScopeGuardImpl0: scope guard for actions without parameters
135// ----------------------------------------------------------------------------
136
17e22c50 137template <class F>
c66cca2a
VZ
138class wxScopeGuardImpl0 : public wxScopeGuardImplBase
139{
140public:
141 static wxScopeGuardImpl0<F> MakeGuard(F fun)
142 {
143 return wxScopeGuardImpl0<F>(fun);
144 }
145
822fc19e 146 ~wxScopeGuardImpl0() { wxPrivateOnScopeExit(*this); }
c66cca2a
VZ
147
148 void Execute() { m_fun(); }
149
150protected:
151 wxScopeGuardImpl0(F fun) : m_fun(fun) { }
152
153 F m_fun;
154
155 wxScopeGuardImpl0& operator=(const wxScopeGuardImpl0&);
156};
157
17e22c50 158template <class F>
c66cca2a
VZ
159inline wxScopeGuardImpl0<F> wxMakeGuard(F fun)
160{
161 return wxScopeGuardImpl0<F>::MakeGuard(fun);
162}
163
164// ----------------------------------------------------------------------------
165// wxScopeGuardImpl1: scope guard for actions with 1 parameter
166// ----------------------------------------------------------------------------
167
17e22c50 168template <class F, class P1>
c66cca2a
VZ
169class wxScopeGuardImpl1 : public wxScopeGuardImplBase
170{
171public:
172 static wxScopeGuardImpl1<F, P1> MakeGuard(F fun, P1 p1)
173 {
174 return wxScopeGuardImpl1<F, P1>(fun, p1);
175 }
176
822fc19e 177 ~wxScopeGuardImpl1() { wxPrivateOnScopeExit(* this); }
c66cca2a
VZ
178
179 void Execute() { m_fun(m_p1); }
180
181protected:
182 wxScopeGuardImpl1(F fun, P1 p1) : m_fun(fun), m_p1(p1) { }
183
184 F m_fun;
185 const P1 m_p1;
186
187 wxScopeGuardImpl1& operator=(const wxScopeGuardImpl1&);
188};
189
17e22c50 190template <class F, class P1>
c66cca2a
VZ
191inline wxScopeGuardImpl1<F, P1> wxMakeGuard(F fun, P1 p1)
192{
193 return wxScopeGuardImpl1<F, P1>::MakeGuard(fun, p1);
194}
195
196// ----------------------------------------------------------------------------
197// wxScopeGuardImpl2: scope guard for actions with 2 parameters
198// ----------------------------------------------------------------------------
199
17e22c50 200template <class F, class P1, class P2>
c66cca2a
VZ
201class wxScopeGuardImpl2 : public wxScopeGuardImplBase
202{
203public:
204 static wxScopeGuardImpl2<F, P1, P2> MakeGuard(F fun, P1 p1, P2 p2)
205 {
206 return wxScopeGuardImpl2<F, P1, P2>(fun, p1, p2);
207 }
208
822fc19e 209 ~wxScopeGuardImpl2() { wxPrivateOnScopeExit(*this); }
c66cca2a
VZ
210
211 void Execute() { m_fun(m_p1, m_p2); }
212
213protected:
214 wxScopeGuardImpl2(F fun, P1 p1, P2 p2) : m_fun(fun), m_p1(p1), m_p2(p2) { }
215
216 F m_fun;
217 const P1 m_p1;
218 const P2 m_p2;
219
220 wxScopeGuardImpl2& operator=(const wxScopeGuardImpl2&);
221};
222
17e22c50 223template <class F, class P1, class P2>
c66cca2a
VZ
224inline wxScopeGuardImpl2<F, P1, P2> wxMakeGuard(F fun, P1 p1, P2 p2)
225{
226 return wxScopeGuardImpl2<F, P1, P2>::MakeGuard(fun, p1, p2);
227}
228
bcffb4d1
VZ
229// ----------------------------------------------------------------------------
230// wxScopeGuardImpl3: scope guard for actions with 3 parameters
231// ----------------------------------------------------------------------------
232
233template <class F, class P1, class P2, class P3>
234class wxScopeGuardImpl3 : public wxScopeGuardImplBase
235{
236public:
237 static wxScopeGuardImpl3<F, P1, P2, P3> MakeGuard(F fun, P1 p1, P2 p2, P3 p3)
238 {
239 return wxScopeGuardImpl3<F, P1, P2, P3>(fun, p1, p2, p3);
240 }
241
242 ~wxScopeGuardImpl3() { wxPrivateOnScopeExit(*this); }
243
244 void Execute() { m_fun(m_p1, m_p2, m_p3); }
245
246protected:
247 wxScopeGuardImpl3(F fun, P1 p1, P2 p2, P3 p3)
248 : m_fun(fun), m_p1(p1), m_p2(p2), m_p3(p3) { }
249
250 F m_fun;
251 const P1 m_p1;
252 const P2 m_p2;
253 const P3 m_p3;
254
255 wxScopeGuardImpl3& operator=(const wxScopeGuardImpl3&);
256};
257
258template <class F, class P1, class P2, class P3>
259inline wxScopeGuardImpl3<F, P1, P2, P3> wxMakeGuard(F fun, P1 p1, P2 p2, P3 p3)
260{
261 return wxScopeGuardImpl3<F, P1, P2, P3>::MakeGuard(fun, p1, p2, p3);
262}
263
c66cca2a
VZ
264// ============================================================================
265// wxScopeGuards for object methods
266// ============================================================================
267
268// ----------------------------------------------------------------------------
269// wxObjScopeGuardImpl0
270// ----------------------------------------------------------------------------
271
17e22c50 272template <class Obj, class MemFun>
c66cca2a
VZ
273class wxObjScopeGuardImpl0 : public wxScopeGuardImplBase
274{
275public:
276 static wxObjScopeGuardImpl0<Obj, MemFun>
277 MakeObjGuard(Obj& obj, MemFun memFun)
278 {
279 return wxObjScopeGuardImpl0<Obj, MemFun>(obj, memFun);
280 }
281
822fc19e 282 ~wxObjScopeGuardImpl0() { wxPrivateOnScopeExit(*this); }
c66cca2a
VZ
283
284 void Execute() { (m_obj.*m_memfun)(); }
285
286protected:
287 wxObjScopeGuardImpl0(Obj& obj, MemFun memFun)
288 : m_obj(obj), m_memfun(memFun) { }
289
290 Obj& m_obj;
291 MemFun m_memfun;
292};
293
17e22c50 294template <class Obj, class MemFun>
c66cca2a
VZ
295inline wxObjScopeGuardImpl0<Obj, MemFun> wxMakeObjGuard(Obj& obj, MemFun memFun)
296{
297 return wxObjScopeGuardImpl0<Obj, MemFun>::MakeObjGuard(obj, memFun);
298}
299
17e22c50 300template <class Obj, class MemFun, class P1>
c66cca2a
VZ
301class wxObjScopeGuardImpl1 : public wxScopeGuardImplBase
302{
303public:
304 static wxObjScopeGuardImpl1<Obj, MemFun, P1>
305 MakeObjGuard(Obj& obj, MemFun memFun, P1 p1)
306 {
307 return wxObjScopeGuardImpl1<Obj, MemFun, P1>(obj, memFun, p1);
308 }
309
822fc19e 310 ~wxObjScopeGuardImpl1() { wxPrivateOnScopeExit(*this); }
c66cca2a
VZ
311
312 void Execute() { (m_obj.*m_memfun)(m_p1); }
313
314protected:
d775fa82 315 wxObjScopeGuardImpl1(Obj& obj, MemFun memFun, P1 p1)
c66cca2a
VZ
316 : m_obj(obj), m_memfun(memFun), m_p1(p1) { }
317
318 Obj& m_obj;
319 MemFun m_memfun;
320 const P1 m_p1;
321};
322
17e22c50 323template <class Obj, class MemFun, class P1>
c66cca2a
VZ
324inline wxObjScopeGuardImpl1<Obj, MemFun, P1>
325wxMakeObjGuard(Obj& obj, MemFun memFun, P1 p1)
326{
327 return wxObjScopeGuardImpl1<Obj, MemFun, P1>::MakeObjGuard(obj, memFun, p1);
328}
329
17e22c50 330template <class Obj, class MemFun, class P1, class P2>
c66cca2a
VZ
331class wxObjScopeGuardImpl2 : public wxScopeGuardImplBase
332{
333public:
334 static wxObjScopeGuardImpl2<Obj, MemFun, P1, P2>
335 MakeObjGuard(Obj& obj, MemFun memFun, P1 p1, P2 p2)
336 {
337 return wxObjScopeGuardImpl2<Obj, MemFun, P1, P2>(obj, memFun, p1, p2);
338 }
339
822fc19e 340 ~wxObjScopeGuardImpl2() { wxPrivateOnScopeExit(*this); }
c66cca2a
VZ
341
342 void Execute() { (m_obj.*m_memfun)(m_p1, m_p2); }
343
344protected:
d775fa82 345 wxObjScopeGuardImpl2(Obj& obj, MemFun memFun, P1 p1, P2 p2)
c66cca2a
VZ
346 : m_obj(obj), m_memfun(memFun), m_p1(p1), m_p2(p2) { }
347
348 Obj& m_obj;
349 MemFun m_memfun;
350 const P1 m_p1;
351 const P2 m_p2;
352};
353
17e22c50 354template <class Obj, class MemFun, class P1, class P2>
c66cca2a
VZ
355inline wxObjScopeGuardImpl2<Obj, MemFun, P1, P2>
356wxMakeObjGuard(Obj& obj, MemFun memFun, P1 p1, P2 p2)
357{
358 return wxObjScopeGuardImpl2<Obj, MemFun, P1, P2>::
359 MakeObjGuard(obj, memFun, p1, p2);
360}
361
bcffb4d1
VZ
362template <class Obj, class MemFun, class P1, class P2, class P3>
363class wxObjScopeGuardImpl3 : public wxScopeGuardImplBase
364{
365public:
366 static wxObjScopeGuardImpl3<Obj, MemFun, P1, P2, P3>
367 MakeObjGuard(Obj& obj, MemFun memFun, P1 p1, P2 p2, P3 p3)
368 {
22c5cac6 369 return wxObjScopeGuardImpl3<Obj, MemFun, P1, P2, P3>(obj, memFun, p1, p2, p3);
bcffb4d1
VZ
370 }
371
372 ~wxObjScopeGuardImpl3() { wxPrivateOnScopeExit(*this); }
373
374 void Execute() { (m_obj.*m_memfun)(m_p1, m_p2, m_p3); }
375
376protected:
377 wxObjScopeGuardImpl3(Obj& obj, MemFun memFun, P1 p1, P2 p2, P3 p3)
378 : m_obj(obj), m_memfun(memFun), m_p1(p1), m_p2(p2), m_p3(p3) { }
379
380 Obj& m_obj;
381 MemFun m_memfun;
382 const P1 m_p1;
383 const P2 m_p2;
384 const P3 m_p3;
385};
386
387template <class Obj, class MemFun, class P1, class P2, class P3>
388inline wxObjScopeGuardImpl3<Obj, MemFun, P1, P2, P3>
389wxMakeObjGuard(Obj& obj, MemFun memFun, P1 p1, P2 p2, P3 p3)
390{
391 return wxObjScopeGuardImpl3<Obj, MemFun, P1, P2, P3>::
392 MakeObjGuard(obj, memFun, p1, p2, p3);
393}
394
d2a48d5c
VZ
395// ----------------------------------------------------------------------------
396// wxVariableSetter: use the same technique as for wxScopeGuard to allow
397// setting a variable to some value on block exit
398// ----------------------------------------------------------------------------
399
400#ifdef wxHAS_NAMESPACES
401
402namespace wxPrivate
403{
404
405// empty class just to be able to define a reference to it
406class VariableSetterBase { };
407
408typedef const VariableSetterBase& VariableSetter;
409
410template <typename T, typename U>
411class VariableSetterImpl : public VariableSetterBase
412{
413public:
e196e523 414 VariableSetterImpl(T& var, U value)
d2a48d5c
VZ
415 : m_var(var),
416 m_value(value)
417 {
418 }
419
420 ~VariableSetterImpl()
421 {
422 m_var = m_value;
423 }
424
425private:
426 T& m_var;
e196e523 427 const U m_value;
d2a48d5c
VZ
428
429 // suppress the warning about assignment operator not being generated
430 VariableSetterImpl<T, U>& operator=(const VariableSetterImpl<T, U>&);
431};
432
433template <typename T>
434class VariableNullerImpl : public VariableSetterBase
435{
436public:
437 VariableNullerImpl(T& var)
438 : m_var(var)
439 {
440 }
441
442 ~VariableNullerImpl()
443 {
444 m_var = NULL;
445 }
446
447private:
448 T& m_var;
449
450 VariableNullerImpl<T>& operator=(const VariableNullerImpl<T>&);
451};
452
453} // namespace wxPrivate
454
455template <typename T, typename U>
456inline
e196e523 457wxPrivate::VariableSetterImpl<T, U> wxMakeVarSetter(T& var, U value)
d2a48d5c
VZ
458{
459 return wxPrivate::VariableSetterImpl<T, U>(var, value);
460}
461
462// calling wxMakeVarSetter(ptr, NULL) doesn't work because U is deduced to be
463// "int" and subsequent assignment of "U" to "T *" fails, so provide a special
464// function for this special case
465template <typename T>
466inline
467wxPrivate::VariableNullerImpl<T> wxMakeVarNuller(T& var)
468{
469 return wxPrivate::VariableNullerImpl<T>(var);
470}
471
472#endif // wxHAS_NAMESPACES
473
c66cca2a 474// ============================================================================
d2a48d5c 475// macros for declaring unnamed scoped guards (which can't be dismissed)
c66cca2a
VZ
476// ============================================================================
477
c66cca2a
VZ
478// NB: the original code has a single (and much nicer) ON_BLOCK_EXIT macro
479// but this results in compiler warnings about unused variables and I
480// didn't find a way to work around this other than by having different
d2a48d5c
VZ
481// macros with different names or using a less natural syntax for passing
482// the arguments (e.g. as Boost preprocessor sequences, which would mean
483// having to write wxON_BLOCK_EXIT(fwrite, (buf)(size)(n)(fp)) instead of
484// wxON_BLOCK_EXIT4(fwrite, buf, size, n, fp)).
426a63a3 485
d2a48d5c 486#define wxGuardName wxMAKE_UNIQUE_NAME(wxScopeGuard)
426a63a3
VZ
487
488#define wxON_BLOCK_EXIT0_IMPL(n, f) \
489 wxScopeGuard n = wxMakeGuard(f); \
822fc19e 490 wxPrivateUse(n)
5800b5be 491#define wxON_BLOCK_EXIT0(f) \
426a63a3 492 wxON_BLOCK_EXIT0_IMPL(wxGuardName, f)
c66cca2a 493
426a63a3
VZ
494#define wxON_BLOCK_EXIT_OBJ0_IMPL(n, o, m) \
495 wxScopeGuard n = wxMakeObjGuard(o, m); \
822fc19e 496 wxPrivateUse(n)
5800b5be 497#define wxON_BLOCK_EXIT_OBJ0(o, m) \
2bb3c0c0 498 wxON_BLOCK_EXIT_OBJ0_IMPL(wxGuardName, o, &m)
c66cca2a 499
51c679d5
VZ
500#define wxON_BLOCK_EXIT_THIS0(m) \
501 wxON_BLOCK_EXIT_OBJ0(*this, m)
502
503
426a63a3
VZ
504#define wxON_BLOCK_EXIT1_IMPL(n, f, p1) \
505 wxScopeGuard n = wxMakeGuard(f, p1); \
822fc19e 506 wxPrivateUse(n)
5800b5be 507#define wxON_BLOCK_EXIT1(f, p1) \
426a63a3 508 wxON_BLOCK_EXIT1_IMPL(wxGuardName, f, p1)
c66cca2a 509
426a63a3
VZ
510#define wxON_BLOCK_EXIT_OBJ1_IMPL(n, o, m, p1) \
511 wxScopeGuard n = wxMakeObjGuard(o, m, p1); \
822fc19e 512 wxPrivateUse(n)
5800b5be 513#define wxON_BLOCK_EXIT_OBJ1(o, m, p1) \
2bb3c0c0 514 wxON_BLOCK_EXIT_OBJ1_IMPL(wxGuardName, o, &m, p1)
c66cca2a 515
51c679d5
VZ
516#define wxON_BLOCK_EXIT_THIS1(m, p1) \
517 wxON_BLOCK_EXIT_OBJ1(*this, m, p1)
518
519
426a63a3
VZ
520#define wxON_BLOCK_EXIT2_IMPL(n, f, p1, p2) \
521 wxScopeGuard n = wxMakeGuard(f, p1, p2); \
822fc19e 522 wxPrivateUse(n)
5800b5be 523#define wxON_BLOCK_EXIT2(f, p1, p2) \
426a63a3 524 wxON_BLOCK_EXIT2_IMPL(wxGuardName, f, p1, p2)
c66cca2a 525
426a63a3
VZ
526#define wxON_BLOCK_EXIT_OBJ2_IMPL(n, o, m, p1, p2) \
527 wxScopeGuard n = wxMakeObjGuard(o, m, p1, p2); \
822fc19e 528 wxPrivateUse(n)
5800b5be 529#define wxON_BLOCK_EXIT_OBJ2(o, m, p1, p2) \
2bb3c0c0 530 wxON_BLOCK_EXIT_OBJ2_IMPL(wxGuardName, o, &m, p1, p2)
c66cca2a 531
51c679d5
VZ
532#define wxON_BLOCK_EXIT_THIS2(m, p1, p2) \
533 wxON_BLOCK_EXIT_OBJ2(*this, m, p1, p2)
534
d2a48d5c 535
bcffb4d1
VZ
536#define wxON_BLOCK_EXIT3_IMPL(n, f, p1, p2, p3) \
537 wxScopeGuard n = wxMakeGuard(f, p1, p2, p3); \
538 wxPrivateUse(n)
539#define wxON_BLOCK_EXIT3(f, p1, p2, p3) \
540 wxON_BLOCK_EXIT3_IMPL(wxGuardName, f, p1, p2, p3)
541
542#define wxON_BLOCK_EXIT_OBJ3_IMPL(n, o, m, p1, p2, p3) \
543 wxScopeGuard n = wxMakeObjGuard(o, m, p1, p2, p3); \
544 wxPrivateUse(n)
545#define wxON_BLOCK_EXIT_OBJ3(o, m, p1, p2, p3) \
546 wxON_BLOCK_EXIT_OBJ3_IMPL(wxGuardName, o, &m, p1, p2, p3)
547
548#define wxON_BLOCK_EXIT_THIS3(m, p1, p2, p3) \
549 wxON_BLOCK_EXIT_OBJ3(*this, m, p1, p2, p3)
550
551
d2a48d5c
VZ
552#define wxSetterName wxMAKE_UNIQUE_NAME(wxVarSetter)
553
554#define wxON_BLOCK_EXIT_SET_IMPL(n, var, value) \
555 wxPrivate::VariableSetter n = wxMakeVarSetter(var, value); \
556 wxPrivateUse(n)
557
558#define wxON_BLOCK_EXIT_SET(var, value) \
559 wxON_BLOCK_EXIT_SET_IMPL(wxSetterName, var, value)
560
561#define wxON_BLOCK_EXIT_NULL_IMPL(n, var) \
562 wxPrivate::VariableSetter n = wxMakeVarNuller(var); \
563 wxPrivateUse(n)
564
565#define wxON_BLOCK_EXIT_NULL(ptr) \
566 wxON_BLOCK_EXIT_NULL_IMPL(wxSetterName, ptr)
567
c66cca2a 568#endif // _WX_SCOPEGUARD_H_