// to be replaced by dynamic_cast<> in the future
#define wxDynamicCast(obj, className) \
- ((obj) && ((obj)->IsKindOf(&className::sm_class##className)) \
- ? (className *)(obj) \
+ (className *) wxCheckDynamicCast((wxObject*)(obj), &className::sm_class##className)
+
+// The 'this' pointer is always true, so use this version to cast the this
+// pointer and avoid compiler warnings.
+#define wxDynamicCastThis(className) \
+ (IsKindOf(&className::sm_class##className) \
+ ? (className *)(this) \
: (className *)0)
#define wxConstCast(obj, className) ((className *)(obj))
#endif // Debug/!Debug
// Unfortunately Borland seems to need this include.
+#if wxUSE_STD_IOSTREAM && (defined(__WXDEBUG__) || wxUSE_DEBUG_CONTEXT)
#ifdef __BORLANDC__
#if wxUSE_IOSTREAMH
#include <iostream.h>
#include <iostream>
#endif
#endif
+#endif
class WXDLLEXPORT wxObjectRefData;
virtual ~wxObject(void);
virtual wxClassInfo *GetClassInfo(void) const { return &sm_classwxObject; }
- wxObject *Clone(void) const;
- virtual void CopyObject(wxObject& object_dest) const;
bool IsKindOf(wxClassInfo *info) const;
#if defined(__WXDEBUG__) && wxUSE_MEMORY_TRACING
void * operator new (size_t size, wxChar * fileName = NULL, int lineNum = 0);
- void operator delete (void * buf);
+# if defined(__VISAGECPP__)
+# if __DEBUG_ALLOC__
+ void operator delete (void * buf,const char * _fname, size_t _line);
+# endif //__DEBUG_ALLOC__
+# else // Everybody else
+ void operator delete (void * buf);
+# endif // end of VISAGECPP
// VC++ 6.0
-#if defined(__VISUALC__) && (__VISUALC__ >= 1200)
- void operator delete(void *buf, wxChar*, int);
-#endif
+# if defined(__VISUALC__) && (__VISUALC__ >= 1200)
+ void operator delete(void *buf, wxChar*, int);
+# endif
// Causes problems for VC++
-#if wxUSE_ARRAY_MEMORY_OPERATORS && !defined(__VISUALC__) && !defined( __MWERKS__)
- void * operator new[] (size_t size, wxChar * fileName = NULL, int lineNum = 0);
- void operator delete[] (void * buf);
-#endif
+# if wxUSE_ARRAY_MEMORY_OPERATORS && !defined(__VISUALC__) && !defined( __MWERKS__)
+ void * operator new[] (size_t size, wxChar * fileName = NULL, int lineNum = 0);
+ void operator delete[] (void * buf);
+# endif
-#ifdef __MWERKS__
- void * operator new[] (size_t size, wxChar * fileName , int lineNum = 0);
- void * operator new[] (size_t size) { return operator new[] ( size , NULL , 0 ) ; }
- void operator delete[] (void * buf);
-#endif
+# ifdef __MWERKS__
+ void * operator new[] (size_t size, wxChar * fileName , int lineNum = 0);
+ void * operator new[] (size_t size) { return operator new[] ( size , NULL , 0 ) ; }
+ void operator delete[] (void * buf);
+# endif
#endif // Debug & memory tracing
#if wxUSE_STD_IOSTREAM && (defined(__WXDEBUG__) || wxUSE_DEBUG_CONTEXT)
- virtual void Dump(ostream& str);
+ virtual void Dump(wxSTD ostream& str);
#endif
#if wxUSE_SERIAL
int m_count;
};
+inline wxObject *wxCheckDynamicCast(wxObject *obj, wxClassInfo *classInfo)
+{
+ return obj && obj->GetClassInfo()->IsKindOf(classInfo) ? obj : 0;
+}
+
#ifdef __WXDEBUG__
#ifndef WXDEBUG_NEW
#define WXDEBUG_NEW new(__TFILE__,__LINE__)