#endif
#ifndef WX_PRECOMP
-#include "wx/hash.h"
+ #include "wx/hash.h"
+ #include "wx/object.h"
#endif
#include <string.h>
#endif
#endif // __WXDEBUG__ || wxUSE_DEBUG_CONTEXT
+// we must disable optimizations for VC.NET because otherwise its too eager
+// linker discards wxClassInfo objects in release build thus breaking many,
+// many things
+#if defined __VISUALC__ && __VISUALC__ >= 1300
+ #pragma optimize("", off)
+#endif
+#if wxUSE_EXTENDED_RTTI
+const wxClassInfo* wxObject::sm_classParentswxObject[] = { NULL } ;
+ wxObject* wxVariantToObjectConverterwxObject ( const wxxVariant &data )
+{ return data.Get<wxObject*>() ; }
+ wxxVariant wxObjectToVariantConverterwxObject ( wxObject *data )
+ { return wxxVariant( dynamic_cast<wxObject*> (data) ) ; }
+ wxClassInfo wxObject::sm_classwxObject(sm_classParentswxObject , wxT("") , wxT("wxObject"),
+ (int) sizeof(wxObject), \
+ (wxObjectConstructorFn) 0 ,
+ (wxPropertyInfo*) NULL,(wxHandlerInfo*) NULL,0 , 0 ,
+ 0 , wxVariantToObjectConverterwxObject , wxObjectToVariantConverterwxObject);
+ template<> void wxStringReadValue(const wxString & , wxObject * & ){assert(0) ;}
+ template<> void wxStringWriteValue(wxString & , wxObject* const & ){assert(0) ;}
+ template<> const wxTypeInfo* wxGetTypeInfo( wxObject ** )
+ { static wxClassTypeInfo s_typeInfo(&wxObject::sm_classwxObject) ; return &s_typeInfo ; }
+#else
wxClassInfo wxObject::sm_classwxObject( wxT("wxObject"), 0, 0,
(int) sizeof(wxObject),
(wxObjectConstructorFn) 0 );
+#endif
+
+// restore optimizations
+#if defined __VISUALC__ && __VISUALC__ >= 1300
+ #pragma optimize("", on)
+#endif
wxClassInfo* wxClassInfo::sm_first = NULL;
wxHashTable* wxClassInfo::sm_classTable = NULL;
info = info->m_next;
}
}
+#if wxUSE_EXTENDED_RTTI
+ Unregister( m_className ) ;
+#endif
}
wxClassInfo *wxClassInfo::FindClass(const wxChar *className)
wxClassInfo *classInfo = (wxClassInfo *)sm_classTable->Get(name);
- // this must be fixed, other things risk work wrongly later if you get this
- wxASSERT_MSG( classInfo,
- wxString::Format
- (
- _T("base class '%s' is unknown to wxWindows RTTI"),
- name
- ) );
+#ifdef __WXDEBUG__
+ // this must be fixed, other things will work wrongly later if you get this
+ if ( !classInfo )
+ {
+ wxFAIL_MSG( wxString::Format
+ (
+ _T("base class '%s' is unknown to wxWindows RTTI"),
+ name
+ ) );
+ }
+#endif // __WXDEBUG__
return classInfo;
}
}
}
+#if wxUSE_EXTENDED_RTTI == 0
// Set base pointers for each wxClassInfo
for(info = sm_first; info; info = info->m_next)
info->m_baseInfo1 = GetBaseByName(info->GetBaseClassName1());
info->m_baseInfo2 = GetBaseByName(info->GetBaseClassName2());
}
+#endif
}
void wxClassInfo::CleanUpClasses()
wxClassInfo::sm_classTable = NULL;
}
-
wxObject *wxCreateDynamicObject(const wxChar *name)
{
#if defined(__WXDEBUG__) || wxUSE_DEBUG_CONTEXT