// Author: Julian Smart
// Modified by: Ron Lee
// Created: 04/01/98
-// RCS-ID: $Id$
// Copyright: (c) 1998 Julian Smart
// (c) 2001 Ron Lee <ron@debian.org>
// Licence: wxWindows licence
#if wxUSE_EXTENDED_RTTI
const wxClassInfo* wxObject::ms_classParents[] = { NULL } ;
- wxObject* wxVariantToObjectConverterwxObject ( wxxVariant &data )
-{ return data.wxTEMPLATED_MEMBER_CALL(Get , wxObject*) ; }
- wxObject* wxVariantOfPtrToObjectConverterwxObject ( wxxVariant &data )
-{ return &data.wxTEMPLATED_MEMBER_CALL(Get , wxObject) ; }
- wxxVariant wxObjectToVariantConverterwxObject ( wxObject *data )
- { return wxxVariant( dynamic_cast<wxObject*> (data) ) ; }
+wxObject* wxVariantOfPtrToObjectConverterwxObject ( const wxAny &data )
+{ return wxANY_AS(data, wxObject*); }
+ wxAny wxObjectToVariantConverterwxObject ( wxObject *data )
+ { return wxAny( dynamic_cast<wxObject*> (data) ) ; }
+
wxClassInfo wxObject::ms_classInfo(ms_classParents , wxEmptyString , wxT("wxObject"),
(int) sizeof(wxObject), \
(wxObjectConstructorFn) 0 ,
NULL,NULL,0 , 0 ,
- 0 , wxVariantOfPtrToObjectConverterwxObject , wxVariantToObjectConverterwxObject , wxObjectToVariantConverterwxObject);
- template<> void wxStringReadValue(const wxString & , wxObject * & ){assert(0) ;}
- template<> void wxStringWriteValue(wxString & , wxObject* const & ){assert(0) ;}
- template<> void wxStringReadValue(const wxString & , wxObject & ){assert(0) ;}
- template<> void wxStringWriteValue(wxString & , wxObject const & ){assert(0) ;}
+ 0 , wxVariantOfPtrToObjectConverterwxObject , 0 , wxObjectToVariantConverterwxObject);
+
+ template<> void wxStringWriteValue(wxString & , wxObject* const & ){ wxFAIL_MSG("unreachable"); }
+ template<> void wxStringWriteValue(wxString & , wxObject const & ){ wxFAIL_MSG("unreachable"); }
+
wxClassTypeInfo s_typeInfo(wxT_OBJECT_PTR , &wxObject::ms_classInfo , NULL , NULL , typeid(wxObject*).name() ) ;
wxClassTypeInfo s_typeInfowxObject(wxT_OBJECT , &wxObject::ms_classInfo , NULL , NULL , typeid(wxObject).name() ) ;
#else
else
{
// guard againt reentrance once the global has been created
- wxASSERT_MSG(++entry == 1, _T("wxClassInfo::Register() reentrance"));
+ wxASSERT_MSG(++entry == 1, wxT("wxClassInfo::Register() reentrance"));
classTable = sm_classTable;
}
wxASSERT_MSG( classTable->Get(m_className) == NULL,
wxString::Format
(
- _T("Class \"%s\" already in RTTI table - have you used IMPLEMENT_DYNAMIC_CLASS() multiple times or linked some object file twice)?"),
+ wxT("Class \"%s\" already in RTTI table - have you used IMPLEMENT_DYNAMIC_CLASS() multiple times or linked some object file twice)?"),
m_className
)
);
sm_classTable->Delete(m_className);
if ( sm_classTable->GetCount() == 0 )
{
- delete sm_classTable;
- sm_classTable = NULL;
+ wxDELETE(sm_classTable);
}
}
}
// wxObjectRefData
// ----------------------------------------------------------------------------
-void wxObjectRefData::DecRef()
+void wxRefCounter::DecRef()
{
+ wxASSERT_MSG( m_count > 0, "invalid ref data count" );
+
if ( --m_count == 0 )
delete this;
}
{
if ( m_refData )
{
- wxASSERT_MSG( m_refData->m_count > 0, _T("invalid ref data count") );
-
m_refData->DecRef();
m_refData = NULL;
}
//else: ref count is 1, we are exclusive owners of m_refData anyhow
wxASSERT_MSG( m_refData && m_refData->GetRefCount() == 1,
- _T("wxObject::AllocExclusive() failed.") );
+ wxT("wxObject::AllocExclusive() failed.") );
}
wxObjectRefData *wxObject::CreateRefData() const
{
// if you use AllocExclusive() you must override this method
- wxFAIL_MSG( _T("CreateRefData() must be overridden if called!") );
+ wxFAIL_MSG( wxT("CreateRefData() must be overridden if called!") );
return NULL;
}
wxObject::CloneRefData(const wxObjectRefData * WXUNUSED(data)) const
{
// if you use AllocExclusive() you must override this method
- wxFAIL_MSG( _T("CloneRefData() must be overridden if called!") );
+ wxFAIL_MSG( wxT("CloneRefData() must be overridden if called!") );
return NULL;
}