// Author: Jaakko Salli
// Modified by:
// Created: 07/05/2009
-// RCS-ID: $Id$
// Copyright: (c) wxWidgets team
// Licence: wxWindows licence
/////////////////////////////////////////////////////////////////////////////
// FIXME-VC6: remove this hack when VC6 is no longer supported
template <typename T>
bool CheckType(T* reserved = NULL) const;
+
+#if wxUSE_EXTENDED_RTTI
+ virtual const wxTypeInfo* GetTypeInfo() const = 0;
+#endif
private:
};
{
return Ops::GetValue(buf);
}
+#if wxUSE_EXTENDED_RTTI
+ virtual const wxTypeInfo* GetTypeInfo() const
+ {
+ return wxGetTypeInfo((T*)NULL);
+ }
+#endif
};
// 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<T> : public wxAnyValueTypeImpl##CLSTYPE \
{ \
const UseDataType* sptr = \
reinterpret_cast<const UseDataType*>(voidPtr); \
return static_cast<T>(*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
WXANY_IMPLEMENT_INT_EQ_OP(wxLongLong_t, wxULongLong_t)
#endif
+ wxGCC_WARNING_SUPPRESS(float-equal)
+
bool operator==(float value) const
{
if ( !wxAnyValueTypeImpl<float>::IsSameClass(m_type) )
(wxAnyValueTypeImpl<double>::GetValue(m_buffer));
}
+ wxGCC_WARNING_RESTORE(float-equal)
+
bool operator==(bool value) const
{
if ( !wxAnyValueTypeImpl<bool>::IsSameClass(m_type) )
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.
// Assignment functions
void AssignAny(const wxAny& any)
{
- if ( m_type != wxAnyNullValueType )
- {
- // Must delete value - CopyBuffer() never does that
- m_type->DeleteValue(m_buffer);
- }
+ // Must delete value - CopyBuffer() never does that
+ m_type->DeleteValue(m_buffer);
wxAnyValueType* newType = any.m_type;
- if ( m_type == wxAnyNullValueType || !newType->IsSameType(m_type) )
+ if ( !newType->IsSameType(m_type) )
m_type = newType;
newType->CopyBuffer(any.m_buffer, m_buffer);