@remarks You cannot reliably test whether two wxAnys are of
same value type by simply comparing return values
- of wxAny::GetType(). Instead use
- wxAnyValueType::CheckType<T>() template function.
+ of wxAny::GetType(). Instead, use wxAny::HasSameType().
+
+ @see HasSameType()
*/
const wxAnyValueType* GetType() const
{
return m_type;
}
+ /**
+ Returns @true if this and another wxAny have the same
+ value type.
+ */
+ bool HasSameType(const wxAny& other) const
+ {
+ return GetType()->IsSameType(other.GetType());
+ }
+
/**
Tests if wxAny is null (that is, whether there is data).
*/
Returns the value type as wxAnyValueType instance.
@remarks You cannot reliably test whether two wxAnys are of
- same value type by simply comparing return values
- of wxAny::GetType(). Instead use
- wxAnyValueType::CheckType<T>() template function.
+ same value type by simply comparing return values
+ of wxAny::GetType(). Instead, use wxAny::HasSameType().
+
+ @see HasSameType()
*/
const wxAnyValueType* GetType() const;
+ /**
+ Returns @true if this and another wxAny have the same
+ value type.
+ */
+ bool HasSameType(const wxAny& other) const;
+
/**
Tests if wxAny is null (that is, whether there is data).
*/
CPPUNIT_ASSERT(wxANY_CHECK_TYPE(m_anyWcharString2, const wchar_t*));
CPPUNIT_ASSERT(!wxANY_CHECK_TYPE(m_anyWcharString2, wxString));
CPPUNIT_ASSERT(!wxANY_CHECK_TYPE(m_anyWcharString2, const char*));
+
+ // HasSameType()
+ CPPUNIT_ASSERT( m_anyWcharString1.HasSameType(m_anyWcharString2) );
+ CPPUNIT_ASSERT( !m_anyWcharString1.HasSameType(m_anyBool1) );
}
void wxAnyTestCase::Equality()