X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/34636400a0018eba4a1f63dda18cf32e944b959e..fb20fa43a07ce52feb43a4b26514fc7a6a11a6f5:/include/wx/object.h diff --git a/include/wx/object.h b/include/wx/object.h index 3f7faec6b2..3ce6e27bc3 100644 --- a/include/wx/object.h +++ b/include/wx/object.h @@ -40,14 +40,8 @@ class WXDLLEXPORT wxObjectOutputStream; class WXDLLEXPORT wxHashTable; class WXDLLEXPORT wxObject_Serialize; -#if wxUSE_IOSTREAMH - // N.B. BC++ doesn't have istream.h, ostream.h -# include -#else -# include -# if defined(__VISUALC__) || defined(__MWERKS__) - using namespace std; -# endif +#if wxUSE_STD_IOSTREAM && (defined(__WXDEBUG__) || wxUSE_DEBUG_CONTEXT) + #include "wx/ioswrap.h" #endif /* @@ -123,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 @@ -137,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 @@ -176,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 @@ -209,7 +218,7 @@ class WXDLLEXPORT wxObject // 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++ @@ -219,13 +228,14 @@ 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 #endif // Debug & memory tracing -#if defined(__WXDEBUG__) || wxUSE_DEBUG_CONTEXT +#if wxUSE_STD_IOSTREAM && (defined(__WXDEBUG__) || wxUSE_DEBUG_CONTEXT) virtual void Dump(ostream& str); #endif