]> git.saurik.com Git - wxWidgets.git/blob - include/wx/object.h
test whether pointer is non-NULL before using it, not after, in wxAnimation::Load...
[wxWidgets.git] / include / wx / object.h
1 /////////////////////////////////////////////////////////////////////////////
2 // Name: wx/object.h
3 // Purpose: wxObject class, plus run-time type information macros
4 // Author: Julian Smart
5 // Modified by: Ron Lee
6 // Created: 01/02/97
7 // RCS-ID: $Id$
8 // Copyright: (c) 1997 Julian Smart
9 // (c) 2001 Ron Lee <ron@debian.org>
10 // Licence: wxWindows licence
11 /////////////////////////////////////////////////////////////////////////////
12
13 #ifndef _WX_OBJECTH__
14 #define _WX_OBJECTH__
15
16 // ----------------------------------------------------------------------------
17 // headers
18 // ----------------------------------------------------------------------------
19
20 #include "wx/memory.h"
21
22 class WXDLLIMPEXP_BASE wxObject;
23
24 #ifndef wxUSE_EXTENDED_RTTI
25 #define wxUSE_EXTENDED_RTTI 0
26 #endif
27
28 #if wxUSE_EXTENDED_RTTI
29 #include "wx/xti.h"
30 #else
31
32 // ----------------------------------------------------------------------------
33 // conditional compilation
34 // ----------------------------------------------------------------------------
35
36 class WXDLLIMPEXP_BASE wxClassInfo;
37 class WXDLLIMPEXP_BASE wxHashTable;
38 class WXDLLIMPEXP_BASE wxObjectRefData;
39
40 // ----------------------------------------------------------------------------
41 // wxClassInfo
42 // ----------------------------------------------------------------------------
43
44 typedef wxObject *(*wxObjectConstructorFn)(void);
45
46 class WXDLLIMPEXP_BASE wxClassInfo
47 {
48 public:
49 wxClassInfo( const wxChar *className,
50 const wxClassInfo *baseInfo1,
51 const wxClassInfo *baseInfo2,
52 int size,
53 wxObjectConstructorFn ctor )
54 : m_className(className)
55 , m_objectSize(size)
56 , m_objectConstructor(ctor)
57 , m_baseInfo1(baseInfo1)
58 , m_baseInfo2(baseInfo2)
59 , m_next(sm_first)
60 {
61 sm_first = this;
62 Register();
63 }
64
65 ~wxClassInfo();
66
67 wxObject *CreateObject() const
68 { return m_objectConstructor ? (*m_objectConstructor)() : 0; }
69 bool IsDynamic() const { return (NULL != m_objectConstructor); }
70
71 const wxChar *GetClassName() const { return m_className; }
72 const wxChar *GetBaseClassName1() const
73 { return m_baseInfo1 ? m_baseInfo1->GetClassName() : NULL; }
74 const wxChar *GetBaseClassName2() const
75 { return m_baseInfo2 ? m_baseInfo2->GetClassName() : NULL; }
76 const wxClassInfo *GetBaseClass1() const { return m_baseInfo1; }
77 const wxClassInfo *GetBaseClass2() const { return m_baseInfo2; }
78 int GetSize() const { return m_objectSize; }
79
80 wxObjectConstructorFn GetConstructor() const
81 { return m_objectConstructor; }
82 static const wxClassInfo *GetFirst() { return sm_first; }
83 const wxClassInfo *GetNext() const { return m_next; }
84 static wxClassInfo *FindClass(const wxChar *className);
85
86 // Climb upwards through inheritance hierarchy.
87 // Dual inheritance is catered for.
88
89 bool IsKindOf(const wxClassInfo *info) const
90 {
91 return info != 0 &&
92 ( info == this ||
93 ( m_baseInfo1 && m_baseInfo1->IsKindOf(info) ) ||
94 ( m_baseInfo2 && m_baseInfo2->IsKindOf(info) ) );
95 }
96
97 public:
98 const wxChar *m_className;
99 int m_objectSize;
100 wxObjectConstructorFn m_objectConstructor;
101
102 // Pointers to base wxClassInfos: set in InitializeClasses
103
104 const wxClassInfo *m_baseInfo1;
105 const wxClassInfo *m_baseInfo2;
106
107 // class info object live in a linked list:
108 // pointers to its head and the next element in it
109
110 static wxClassInfo *sm_first;
111 wxClassInfo *m_next;
112
113 // FIXME: this should be private (currently used directly by way too
114 // many clients)
115 static wxHashTable *sm_classTable;
116
117 private:
118 // InitializeClasses() helper
119 static wxClassInfo *GetBaseByName(const wxChar *name);
120
121 DECLARE_NO_COPY_CLASS(wxClassInfo)
122
123 protected:
124 // registers the class
125 void Register();
126 void Unregister();
127 };
128
129 WXDLLIMPEXP_BASE wxObject *wxCreateDynamicObject(const wxChar *name);
130
131 // ----------------------------------------------------------------------------
132 // Dynamic class macros
133 // ----------------------------------------------------------------------------
134
135 #define DECLARE_ABSTRACT_CLASS(name) \
136 public: \
137 static wxClassInfo ms_classInfo; \
138 virtual wxClassInfo *GetClassInfo() const;
139
140 #define DECLARE_DYNAMIC_CLASS_NO_ASSIGN(name) \
141 DECLARE_NO_ASSIGN_CLASS(name) \
142 DECLARE_DYNAMIC_CLASS(name)
143
144 #define DECLARE_DYNAMIC_CLASS_NO_COPY(name) \
145 DECLARE_NO_COPY_CLASS(name) \
146 DECLARE_DYNAMIC_CLASS(name)
147
148 #define DECLARE_DYNAMIC_CLASS(name) \
149 DECLARE_ABSTRACT_CLASS(name) \
150 static wxObject* wxCreateObject();
151
152 #define DECLARE_CLASS(name) DECLARE_DYNAMIC_CLASS(name)
153
154
155 // common part of the macros below
156 #define wxIMPLEMENT_CLASS_COMMON(name, basename, baseclsinfo2, func) \
157 wxClassInfo name::ms_classInfo(wxT(#name), \
158 &basename::ms_classInfo, \
159 baseclsinfo2, \
160 (int) sizeof(name), \
161 (wxObjectConstructorFn) func); \
162 \
163 wxClassInfo *name::GetClassInfo() const \
164 { return &name::ms_classInfo; }
165
166 #define wxIMPLEMENT_CLASS_COMMON1(name, basename, func) \
167 wxIMPLEMENT_CLASS_COMMON(name, basename, NULL, func)
168
169 #define wxIMPLEMENT_CLASS_COMMON2(name, basename1, basename2, func) \
170 wxIMPLEMENT_CLASS_COMMON(name, basename1, &basename2::ms_classInfo, func)
171
172 // -----------------------------------
173 // for concrete classes
174 // -----------------------------------
175
176 // Single inheritance with one base class
177 #define IMPLEMENT_DYNAMIC_CLASS(name, basename) \
178 wxIMPLEMENT_CLASS_COMMON1(name, basename, name::wxCreateObject) \
179 wxObject* name::wxCreateObject() \
180 { return new name; }
181
182 // Multiple inheritance with two base classes
183 #define IMPLEMENT_DYNAMIC_CLASS2(name, basename1, basename2) \
184 wxIMPLEMENT_CLASS_COMMON2(name, basename1, basename2, \
185 name::wxCreateObject) \
186 wxObject* name::wxCreateObject() \
187 { return new name; }
188
189 // -----------------------------------
190 // for abstract classes
191 // -----------------------------------
192
193 // Single inheritance with one base class
194
195 #define IMPLEMENT_ABSTRACT_CLASS(name, basename) \
196 wxIMPLEMENT_CLASS_COMMON1(name, basename, NULL)
197
198 // Multiple inheritance with two base classes
199
200 #define IMPLEMENT_ABSTRACT_CLASS2(name, basename1, basename2) \
201 wxIMPLEMENT_CLASS_COMMON2(name, basename1, basename2, NULL)
202
203 #define IMPLEMENT_CLASS IMPLEMENT_ABSTRACT_CLASS
204 #define IMPLEMENT_CLASS2 IMPLEMENT_ABSTRACT_CLASS2
205
206 #endif // !wxUSE_EXTENDED_RTTI
207
208
209 // -----------------------------------
210 // for pluggable classes
211 // -----------------------------------
212
213 // NOTE: this should probably be the very first statement
214 // in the class declaration so wxPluginSentinel is
215 // the first member initialised and the last destroyed.
216
217 // _DECLARE_DL_SENTINEL(name) wxPluginSentinel m_pluginsentinel;
218
219 #if wxUSE_NESTED_CLASSES
220
221 #define _DECLARE_DL_SENTINEL(name, exportdecl) \
222 class exportdecl name##PluginSentinel { \
223 private: \
224 static const wxString sm_className; \
225 public: \
226 name##PluginSentinel(); \
227 ~name##PluginSentinel(); \
228 }; \
229 name##PluginSentinel m_pluginsentinel;
230
231 #define _IMPLEMENT_DL_SENTINEL(name) \
232 const wxString name::name##PluginSentinel::sm_className(#name); \
233 name::name##PluginSentinel::name##PluginSentinel() { \
234 wxPluginLibrary *e = (wxPluginLibrary*) wxPluginLibrary::ms_classes.Get(#name); \
235 if( e != 0 ) { e->RefObj(); } \
236 } \
237 name::name##PluginSentinel::~name##PluginSentinel() { \
238 wxPluginLibrary *e = (wxPluginLibrary*) wxPluginLibrary::ms_classes.Get(#name); \
239 if( e != 0 ) { e->UnrefObj(); } \
240 }
241 #else
242
243 #define _DECLARE_DL_SENTINEL(name)
244 #define _IMPLEMENT_DL_SENTINEL(name)
245
246 #endif // wxUSE_NESTED_CLASSES
247
248 #define DECLARE_PLUGGABLE_CLASS(name) \
249 DECLARE_DYNAMIC_CLASS(name) _DECLARE_DL_SENTINEL(name, WXDLLEXPORT)
250 #define DECLARE_ABSTRACT_PLUGGABLE_CLASS(name) \
251 DECLARE_ABSTRACT_CLASS(name) _DECLARE_DL_SENTINEL(name, WXDLLEXPORT)
252
253 #define DECLARE_USER_EXPORTED_PLUGGABLE_CLASS(name, usergoo) \
254 DECLARE_DYNAMIC_CLASS(name) _DECLARE_DL_SENTINEL(name, usergoo)
255 #define DECLARE_USER_EXPORTED_ABSTRACT_PLUGGABLE_CLASS(name, usergoo) \
256 DECLARE_ABSTRACT_CLASS(name) _DECLARE_DL_SENTINEL(name, usergoo)
257
258 #define IMPLEMENT_PLUGGABLE_CLASS(name, basename) \
259 IMPLEMENT_DYNAMIC_CLASS(name, basename) _IMPLEMENT_DL_SENTINEL(name)
260 #define IMPLEMENT_PLUGGABLE_CLASS2(name, basename1, basename2) \
261 IMPLEMENT_DYNAMIC_CLASS2(name, basename1, basename2) _IMPLEMENT_DL_SENTINEL(name)
262 #define IMPLEMENT_ABSTRACT_PLUGGABLE_CLASS(name, basename) \
263 IMPLEMENT_ABSTRACT_CLASS(name, basename) _IMPLEMENT_DL_SENTINEL(name)
264 #define IMPLEMENT_ABSTRACT_PLUGGABLE_CLASS2(name, basename1, basename2) \
265 IMPLEMENT_ABSTRACT_CLASS2(name, basename1, basename2) _IMPLEMENT_DL_SENTINEL(name)
266
267 #define IMPLEMENT_USER_EXPORTED_PLUGGABLE_CLASS(name, basename) \
268 IMPLEMENT_PLUGGABLE_CLASS(name, basename)
269 #define IMPLEMENT_USER_EXPORTED_PLUGGABLE_CLASS2(name, basename1, basename2) \
270 IMPLEMENT_PLUGGABLE_CLASS2(name, basename1, basename2)
271 #define IMPLEMENT_USER_EXPORTED_ABSTRACT_PLUGGABLE_CLASS(name, basename) \
272 IMPLEMENT_ABSTRACT_PLUGGABLE_CLASS(name, basename)
273 #define IMPLEMENT_USER_EXPORTED_ABSTRACT_PLUGGABLE_CLASS2(name, basename1, basename2) \
274 IMPLEMENT_ABSTRACT_PLUGGABLE_CLASS2(name, basename1, basename2)
275
276 #define CLASSINFO(name) (&name::ms_classInfo)
277
278 #define wxIS_KIND_OF(obj, className) obj->IsKindOf(&className::ms_classInfo)
279
280 // Just seems a bit nicer-looking (pretend it's not a macro)
281 #define wxIsKindOf(obj, className) obj->IsKindOf(&className::ms_classInfo)
282
283 // this cast does some more checks at compile time as it uses static_cast
284 // internally
285 //
286 // note that it still has different semantics from dynamic_cast<> and so can't
287 // be replaced by it as long as there are any compilers not supporting it
288 #define wxDynamicCast(obj, className) \
289 ((className *) wxCheckDynamicCast( \
290 wx_const_cast(wxObject *, wx_static_cast(const wxObject *, \
291 wx_const_cast(className *, wx_static_cast(const className *, obj)))), \
292 &className::ms_classInfo))
293
294 // The 'this' pointer is always true, so use this version
295 // to cast the this pointer and avoid compiler warnings.
296 #define wxDynamicCastThis(className) \
297 (IsKindOf(&className::ms_classInfo) ? (className *)(this) : (className *)0)
298
299 #ifdef __WXDEBUG__
300 inline void* wxCheckCast(void *ptr)
301 {
302 wxASSERT_MSG( ptr, _T("wxStaticCast() used incorrectly") );
303 return ptr;
304 }
305 #define wxStaticCast(obj, className) \
306 ((className *)wxCheckCast(wxDynamicCast(obj, className)))
307
308 #else // !__WXDEBUG__
309 #define wxStaticCast(obj, className) \
310 wx_const_cast(className *, wx_static_cast(const className *, obj))
311
312 #endif // __WXDEBUG__
313
314 // ----------------------------------------------------------------------------
315 // set up memory debugging macros
316 // ----------------------------------------------------------------------------
317
318 /*
319 Which new/delete operator variants do we want?
320
321 _WX_WANT_NEW_SIZET_WXCHAR_INT = void *operator new (size_t size, wxChar *fileName = 0, int lineNum = 0)
322 _WX_WANT_DELETE_VOID = void operator delete (void * buf)
323 _WX_WANT_DELETE_VOID_CONSTCHAR_SIZET = void operator delete (void *buf, const char *_fname, size_t _line)
324 _WX_WANT_DELETE_VOID_WXCHAR_INT = void operator delete(void *buf, wxChar*, int)
325 _WX_WANT_ARRAY_NEW_SIZET_WXCHAR_INT = void *operator new[] (size_t size, wxChar *fileName , int lineNum = 0)
326 _WX_WANT_ARRAY_DELETE_VOID = void operator delete[] (void *buf)
327 _WX_WANT_ARRAY_DELETE_VOID_WXCHAR_INT = void operator delete[] (void* buf, wxChar*, int )
328 */
329
330 #if defined(__WXDEBUG__) && wxUSE_MEMORY_TRACING
331
332 // All compilers get this one
333 #define _WX_WANT_NEW_SIZET_WXCHAR_INT
334
335 // Everyone except Visage gets the next one
336 #ifndef __VISAGECPP__
337 #define _WX_WANT_DELETE_VOID
338 #endif
339
340 // Only visage gets this one under the correct circumstances
341 #if defined(__VISAGECPP__) && __DEBUG_ALLOC__
342 #define _WX_WANT_DELETE_VOID_CONSTCHAR_SIZET
343 #endif
344
345 // Only VC++ 6 and CodeWarrior get overloaded delete that matches new
346 #if (defined(__VISUALC__) && (__VISUALC__ >= 1200)) || \
347 (defined(__MWERKS__) && (__MWERKS__ >= 0x2400))
348 #define _WX_WANT_DELETE_VOID_WXCHAR_INT
349 #endif
350
351 // Now see who (if anyone) gets the array memory operators
352 #if wxUSE_ARRAY_MEMORY_OPERATORS
353
354 // Everyone except Visual C++ (cause problems for VC++ - crashes)
355 #if !defined(__VISUALC__)
356 #define _WX_WANT_ARRAY_NEW_SIZET_WXCHAR_INT
357 #endif
358
359 // Everyone except Visual C++ (cause problems for VC++ - crashes)
360 #if !defined(__VISUALC__)
361 #define _WX_WANT_ARRAY_DELETE_VOID
362 #endif
363
364 // Only CodeWarrior 6 or higher
365 #if defined(__MWERKS__) && (__MWERKS__ >= 0x2400)
366 #define _WX_WANT_ARRAY_DELETE_VOID_WXCHAR_INT
367 #endif
368
369 #endif // wxUSE_ARRAY_MEMORY_OPERATORS
370
371 #endif // __WXDEBUG__ && wxUSE_MEMORY_TRACING
372
373 // ----------------------------------------------------------------------------
374 // wxObjectRefData: ref counted data meant to be stored in wxObject
375 // ----------------------------------------------------------------------------
376
377 class WXDLLIMPEXP_BASE wxObjectRefData
378 {
379 friend class WXDLLIMPEXP_BASE wxObject;
380
381 public:
382 wxObjectRefData() : m_count(1) { }
383
384 int GetRefCount() const { return m_count; }
385
386 void IncRef() { m_count++; }
387 void DecRef();
388
389 protected:
390 // this object should never be destroyed directly but only as a
391 // result of a DecRef() call:
392 virtual ~wxObjectRefData() { }
393
394 private:
395 // our refcount:
396 int m_count;
397 };
398
399 // ----------------------------------------------------------------------------
400 // wxObjectDataPtr: helper class to avoid memleaks because of missing calls
401 // to wxObjectRefData::DecRef
402 // ----------------------------------------------------------------------------
403
404 template <class T>
405 class wxObjectDataPtr
406 {
407 public:
408 typedef T element_type;
409
410 wxEXPLICIT wxObjectDataPtr(T *ptr = NULL) : m_ptr(ptr) {}
411
412 // copy ctor
413 wxObjectDataPtr(const wxObjectDataPtr<T> &tocopy)
414 : m_ptr(tocopy.m_ptr)
415 {
416 if (m_ptr)
417 m_ptr->IncRef();
418 }
419
420 ~wxObjectDataPtr()
421 {
422 if (m_ptr)
423 m_ptr->DecRef();
424 }
425
426 T *get() const { return m_ptr; }
427 T *operator->() const { return get(); }
428
429 void reset(T *ptr)
430 {
431 if (m_ptr)
432 m_ptr->DecRef();
433 m_ptr = ptr;
434 }
435
436 wxObjectDataPtr& operator=(const wxObjectDataPtr &tocopy)
437 {
438 if (m_ptr)
439 m_ptr->DecRef();
440 m_ptr = tocopy.m_ptr;
441 if (m_ptr)
442 m_ptr->IncRef();
443 return *this;
444 }
445
446 wxObjectDataPtr& operator=(T *ptr)
447 {
448 if (m_ptr)
449 m_ptr->DecRef();
450 m_ptr = ptr;
451 if (m_ptr)
452 m_ptr->IncRef();
453 return *this;
454 }
455
456 private:
457 T *m_ptr;
458 };
459
460 // ----------------------------------------------------------------------------
461 // wxObject: the root class of wxWidgets object hierarchy
462 // ----------------------------------------------------------------------------
463
464 class WXDLLIMPEXP_BASE wxObject
465 {
466 DECLARE_ABSTRACT_CLASS(wxObject)
467
468 public:
469 wxObject() { m_refData = NULL; }
470 virtual ~wxObject() { UnRef(); }
471
472 wxObject(const wxObject& other)
473 {
474 m_refData = other.m_refData;
475 if (m_refData)
476 m_refData->m_count++;
477 }
478
479 wxObject& operator=(const wxObject& other)
480 {
481 if ( this != &other )
482 {
483 Ref(other);
484 }
485 return *this;
486 }
487
488 bool IsKindOf(wxClassInfo *info) const;
489
490
491 // Turn on the correct set of new and delete operators
492
493 #ifdef _WX_WANT_NEW_SIZET_WXCHAR_INT
494 void *operator new ( size_t size, const wxChar *fileName = NULL, int lineNum = 0 );
495 #endif
496
497 #ifdef _WX_WANT_DELETE_VOID
498 void operator delete ( void * buf );
499 #endif
500
501 #ifdef _WX_WANT_DELETE_VOID_CONSTCHAR_SIZET
502 void operator delete ( void *buf, const char *_fname, size_t _line );
503 #endif
504
505 #ifdef _WX_WANT_DELETE_VOID_WXCHAR_INT
506 void operator delete ( void *buf, const wxChar*, int );
507 #endif
508
509 #ifdef _WX_WANT_ARRAY_NEW_SIZET_WXCHAR_INT
510 void *operator new[] ( size_t size, const wxChar *fileName = NULL, int lineNum = 0 );
511 #endif
512
513 #ifdef _WX_WANT_ARRAY_DELETE_VOID
514 void operator delete[] ( void *buf );
515 #endif
516
517 #ifdef _WX_WANT_ARRAY_DELETE_VOID_WXCHAR_INT
518 void operator delete[] (void* buf, const wxChar*, int );
519 #endif
520
521 // ref counted data handling methods
522
523 // get/set
524 wxObjectRefData *GetRefData() const { return m_refData; }
525 void SetRefData(wxObjectRefData *data) { m_refData = data; }
526
527 // make a 'clone' of the object
528 void Ref(const wxObject& clone);
529
530 // destroy a reference
531 void UnRef();
532
533 // Make sure this object has only one reference
534 void UnShare() { AllocExclusive(); }
535
536 // check if this object references the same data as the other one
537 bool IsSameAs(const wxObject& o) const { return m_refData == o.m_refData; }
538
539 protected:
540 // ensure that our data is not shared with anybody else: if we have no
541 // data, it is created using CreateRefData() below, if we have shared data
542 // it is copied using CloneRefData(), otherwise nothing is done
543 void AllocExclusive();
544
545 // both methods must be implemented if AllocExclusive() is used, not pure
546 // virtual only because of the backwards compatibility reasons
547
548 // create a new m_refData
549 virtual wxObjectRefData *CreateRefData() const;
550
551 // create a new m_refData initialized with the given one
552 virtual wxObjectRefData *CloneRefData(const wxObjectRefData *data) const;
553
554 wxObjectRefData *m_refData;
555 };
556
557 inline wxObject *wxCheckDynamicCast(wxObject *obj, wxClassInfo *classInfo)
558 {
559 return obj && obj->GetClassInfo()->IsKindOf(classInfo) ? obj : NULL;
560 }
561
562 #if wxUSE_EXTENDED_RTTI
563 class WXDLLIMPEXP_BASE wxDynamicObject : public wxObject
564 {
565 friend class WXDLLIMPEXP_BASE wxDynamicClassInfo ;
566 public:
567 // instantiates this object with an instance of its superclass
568 wxDynamicObject(wxObject* superClassInstance, const wxDynamicClassInfo *info) ;
569 virtual ~wxDynamicObject();
570
571 void SetProperty (const wxChar *propertyName, const wxxVariant &value);
572 wxxVariant GetProperty (const wxChar *propertyName) const ;
573
574 // get the runtime identity of this object
575 wxClassInfo *GetClassInfo() const
576 {
577 #ifdef _MSC_VER
578 return (wxClassInfo*) m_classInfo;
579 #else
580 wxDynamicClassInfo *nonconst = wx_const_cast(wxDynamicClassInfo *, m_classInfo);
581 return wx_static_cast(wxClassInfo *, nonconst);
582 #endif
583 }
584
585 wxObject* GetSuperClassInstance() const
586 {
587 return m_superClassInstance ;
588 }
589 private :
590 // removes an existing runtime-property
591 void RemoveProperty( const wxChar *propertyName ) ;
592
593 // renames an existing runtime-property
594 void RenameProperty( const wxChar *oldPropertyName , const wxChar *newPropertyName ) ;
595
596 wxObject *m_superClassInstance ;
597 const wxDynamicClassInfo *m_classInfo;
598 struct wxDynamicObjectInternal;
599 wxDynamicObjectInternal *m_data;
600 };
601 #endif
602
603 // ----------------------------------------------------------------------------
604 // more debugging macros
605 // ----------------------------------------------------------------------------
606
607 // Redefine new to be the debugging version. This doesn't work with all
608 // compilers, in which case you need to use WXDEBUG_NEW explicitly if you wish
609 // to use the debugging version.
610
611 #ifdef __WXDEBUG__
612 #define WXDEBUG_NEW new(__TFILE__,__LINE__)
613
614 #if wxUSE_DEBUG_NEW_ALWAYS
615 #if wxUSE_GLOBAL_MEMORY_OPERATORS
616 #define new WXDEBUG_NEW
617 #elif defined(__VISUALC__)
618 // Including this file redefines new and allows leak reports to
619 // contain line numbers
620 #include "wx/msw/msvcrt.h"
621 #endif
622 #endif // wxUSE_DEBUG_NEW_ALWAYS
623 #else // !__WXDEBUG__
624 #define WXDEBUG_NEW new
625 #endif // __WXDEBUG__/!__WXDEBUG__
626
627 #endif // _WX_OBJECTH__