X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/e90c1d2a19361551eb07778280f22be3e759cf64..da052901fda49803ddf9b666d227cdab40bafa30:/include/wx/object.h diff --git a/include/wx/object.h b/include/wx/object.h index 6dc59bf649..458f5e78e6 100644 --- a/include/wx/object.h +++ b/include/wx/object.h @@ -117,13 +117,13 @@ WXDLLEXPORT wxObject* wxCreateStoredObject( wxInputStream& stream ); #define IMPLEMENT_DYNAMIC_CLASS(name, basename) \ wxObject* WXDLLEXPORT_CTORFN wxConstructorFor##name(void) \ { return new name; }\ - wxClassInfo name::sm_class##name((wxChar *) T(#name), (wxChar *) T(#basename), (wxChar *) NULL, (int) sizeof(name), (wxObjectConstructorFn) wxConstructorFor##name); + wxClassInfo name::sm_class##name((wxChar *) wxT(#name), (wxChar *) wxT(#basename), (wxChar *) NULL, (int) sizeof(name), (wxObjectConstructorFn) wxConstructorFor##name); // Multiple inheritance with two base classes #define IMPLEMENT_DYNAMIC_CLASS2(name, basename1, basename2) \ wxObject* WXDLLEXPORT_CTORFN wxConstructorFor##name(void) \ { return new name; }\ - wxClassInfo name::sm_class##name((wxChar *) T(#name), (wxChar *) T(#basename1), (wxChar *) T(#basename2), (int) sizeof(name), (wxObjectConstructorFn) wxConstructorFor##name); + wxClassInfo name::sm_class##name((wxChar *) wxT(#name), (wxChar *) wxT(#basename1), (wxChar *) wxT(#basename2), (int) sizeof(name), (wxObjectConstructorFn) wxConstructorFor##name); ////// ////// for abstract classes @@ -131,13 +131,13 @@ wxObject* WXDLLEXPORT_CTORFN wxConstructorFor##name(void) \ // Single inheritance with one base class #define IMPLEMENT_ABSTRACT_CLASS(name, basename) \ - wxClassInfo name::sm_class##name((wxChar *) T(#name), (wxChar *) T(#basename), \ + wxClassInfo name::sm_class##name((wxChar *) wxT(#name), (wxChar *) wxT(#basename), \ (wxChar *) NULL, (int) sizeof(name), (wxObjectConstructorFn) NULL); // Multiple inheritance with two base classes #define IMPLEMENT_ABSTRACT_CLASS2(name, basename1, basename2) \ - wxClassInfo name::sm_class##name((wxChar *) T(#name), (wxChar *) T(#basename1), \ - (wxChar *) T(#basename2), (int) sizeof(name), (wxObjectConstructorFn) NULL); + wxClassInfo name::sm_class##name((wxChar *) wxT(#name), (wxChar *) wxT(#basename1), \ + (wxChar *) wxT(#basename2), (int) sizeof(name), (wxObjectConstructorFn) NULL); #define IMPLEMENT_CLASS IMPLEMENT_ABSTRACT_CLASS #define IMPLEMENT_CLASS2 IMPLEMENT_ABSTRACT_CLASS2 @@ -170,6 +170,21 @@ wxObject* WXDLLEXPORT_CTORFN wxConstructorFor##name(void) \ ? (className *)(obj) \ : (className *)0) +#define wxConstCast(obj, className) ((className *)(obj)) + +#ifdef __WXDEBUG__ + inline void wxCheckCast(void *ptr) + { + wxASSERT_MSG( ptr, _T("wxStaticCast() used incorrectly") ); + } + + #define wxStaticCast(obj, className) \ + (wxCheckCast(wxDynamicCast(obj, className)), ((className *)(obj))) + +#else // !Debug + #define wxStaticCast(obj, className) ((className *)(obj)) +#endif // Debug/!Debug + // Unfortunately Borland seems to need this include. #ifdef __BORLANDC__ #if wxUSE_IOSTREAMH @@ -199,11 +214,19 @@ class WXDLLEXPORT wxObject #if defined(__WXDEBUG__) && wxUSE_MEMORY_TRACING void * operator new (size_t size, wxChar * fileName = NULL, int lineNum = 0); + +#if defined(__VISAGECPP__) + #if __DEBUG_ALLOC__ + void operator delete (void * buf,const char * _fname, size_t _line); + #endif //__DEBUG_ALLOC__ +#else void operator delete (void * buf); +#endif + // defined(__VISAGECPP__) // VC++ 6.0 #if defined(__VISUALC__) && (__VISUALC__ >= 1200) - void operator delete(void *buf, char*, int); + void operator delete(void *buf, wxChar*, int); #endif // Causes problems for VC++ @@ -213,7 +236,8 @@ class WXDLLEXPORT wxObject #endif #ifdef __MWERKS__ - void * operator new[] (size_t size, wxChar * fileName , int lineNum = 0); + 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 @@ -237,6 +261,14 @@ class WXDLLEXPORT wxObject inline wxObjectRefData *GetRefData(void) const { return m_refData; } inline void SetRefData(wxObjectRefData *data) { m_refData = data; } +//EK +#if defined(__WXDEBUG__) && defined(__VISAGECPP__) +public: + static int N; + static int Nid; // total number of objects and serial counter + int id; // serial number for current object +#endif // __WXDEBUG__ + protected: wxObjectRefData* m_refData; #if wxUSE_SERIAL