X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/986a59561ab32013ae67a243a02099e64f0a4ae1..91270d2d17374f24a4de5108ea1a332190b827a6:/include/wx/any.h diff --git a/include/wx/any.h b/include/wx/any.h index 511239f111..2651ce219c 100644 --- a/include/wx/any.h +++ b/include/wx/any.h @@ -113,6 +113,10 @@ public: // FIXME-VC6: remove this hack when VC6 is no longer supported template bool CheckType(T* reserved = NULL) const; + +#if wxUSE_EXTENDED_RTTI + virtual const wxTypeInfo* GetTypeInfo() const = 0; +#endif private: }; @@ -314,6 +318,12 @@ public: { return Ops::GetValue(buf); } +#if wxUSE_EXTENDED_RTTI + virtual const wxTypeInfo* GetTypeInfo() const + { + return wxGetTypeInfo((T*)NULL); + } +#endif }; @@ -348,7 +358,7 @@ wxAnyValueTypeScopedPtr wxAnyValueTypeImpl::sm_instance = new wxAnyValueTypeI // Helper macro for using same base value type implementation for multiple // actual C++ data types. // -#define WX_ANY_DEFINE_SUB_TYPE(T, CLSTYPE) \ +#define _WX_ANY_DEFINE_SUB_TYPE(T, CLSTYPE) \ template<> \ class wxAnyValueTypeImpl : public wxAnyValueTypeImpl##CLSTYPE \ { \ @@ -369,9 +379,21 @@ public: \ const UseDataType* sptr = \ reinterpret_cast(voidPtr); \ return static_cast(*sptr); \ + } + +#if wxUSE_EXTENDED_RTTI +#define WX_ANY_DEFINE_SUB_TYPE(T, CLSTYPE) \ +_WX_ANY_DEFINE_SUB_TYPE(T, CLSTYPE)\ + virtual const wxTypeInfo* GetTypeInfo() const \ + { \ + return wxGetTypeInfo((T*)NULL); \ } \ }; - +#else +#define WX_ANY_DEFINE_SUB_TYPE(T, CLSTYPE) \ +_WX_ANY_DEFINE_SUB_TYPE(T, CLSTYPE)\ +}; +#endif // // Integer value types @@ -890,6 +912,8 @@ public: WXANY_IMPLEMENT_INT_EQ_OP(wxLongLong_t, wxULongLong_t) #endif + wxGCC_WARNING_SUPPRESS(float-equal) + bool operator==(float value) const { if ( !wxAnyValueTypeImpl::IsSameClass(m_type) ) @@ -910,6 +934,8 @@ public: (wxAnyValueTypeImpl::GetValue(m_buffer)); } + wxGCC_WARNING_RESTORE(float-equal) + bool operator==(bool value) const { if ( !wxAnyValueTypeImpl::IsSameClass(m_type) ) @@ -967,6 +993,12 @@ public: return value; } +#if wxUSE_EXTENDED_RTTI + const wxTypeInfo* GetTypeInfo() const + { + return m_type->GetTypeInfo(); + } +#endif /** Template function that retrieves and converts the value of this variant to the type that T* value is.