X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/c801d85f158c4cba50b588807daabdcbd0ed3853..7b124d5404c31d9462da3ea587a7f4d3d0dce41e:/src/common/object.cpp diff --git a/src/common/object.cpp b/src/common/object.cpp index 4dc8b093b3..272e88a21f 100644 --- a/src/common/object.cpp +++ b/src/common/object.cpp @@ -20,16 +20,19 @@ #pragma hdrstop #endif +#ifndef WX_PRECOMP #include "wx/hash.h" +#include "wx/objstrm.h" +#endif #include #include -#if (DEBUG && USE_MEMORY_TRACING) || USE_DEBUG_CONTEXT +#if (WXDEBUG && USE_MEMORY_TRACING) || USE_DEBUG_CONTEXT #include "wx/memory.h" #endif -#if DEBUG || USE_DEBUG_CONTEXT +#if WXDEBUG || USE_DEBUG_CONTEXT // for wxObject::Dump #include #endif @@ -69,7 +72,7 @@ bool wxObject::IsKindOf(wxClassInfo *info) return FALSE; } -#if DEBUG || USE_DEBUG_CONTEXT +#if WXDEBUG || USE_DEBUG_CONTEXT void wxObject::Dump(ostream& str) { if (GetClassInfo() && GetClassInfo()->GetClassName()) @@ -79,7 +82,7 @@ void wxObject::Dump(ostream& str) } #endif -#if DEBUG && USE_MEMORY_TRACING +#if WXDEBUG && USE_MEMORY_TRACING #ifdef new #undef new @@ -114,36 +117,6 @@ void wxObject::operator delete[] (void * buf) * Class info: provides run-time class type information. */ -#ifdef USE_STORABLE_CLASSES - -wxClassInfo::wxClassInfo(char *cName, char *baseName1, char *baseName2, int sz, wxObjectConstructorFn fn, - wxStorableConstructorFn stoFn ) -{ - className = cName; - baseClassName1 = baseName1; - baseClassName2 = baseName2; - - objectSize = sz; - objectConstructor = fn; - storableConstructor = stoFn; - - next = first; - first = this; - - baseInfo1 = NULL; - baseInfo2 = NULL; -} - -wxObject* wxClassInfo::CreateObject( istream &stream, char *data ) -{ - if (storableConstructor) - return (wxObject *)(*storableConstructor)( stream, data ); - else - return NULL; -} - -#else - wxClassInfo::wxClassInfo(char *cName, char *baseName1, char *baseName2, int sz, wxObjectConstructorFn constr) { className = cName; @@ -160,8 +133,6 @@ wxClassInfo::wxClassInfo(char *cName, char *baseName1, char *baseName2, int sz, baseInfo2 = NULL; } -#endif - wxObject *wxClassInfo::CreateObject(void) { if (objectConstructor) @@ -250,16 +221,10 @@ wxObject *wxCreateDynamicObject(char *name) #ifdef USE_STORABLE_CLASSES -wxObject* wxCreateStoredObject( char *name, istream &stream, char *data ) +wxObject* wxCreateStoredObject( wxInputStream &stream ) { - wxClassInfo *info = wxClassInfo::first; - while (info) - { - if (info->className && strcmp(info->className, name) == 0) - return info->CreateObject( stream, data ); - info = info->next; - } - return NULL; + wxObjectInputStream obj_s(stream); + return obj_s.LoadObject(); }; #endif