Restore wxObject::ms_classInfo public access
This undoes accidental change of ms_classInfo from public to protected
in 95c98a0b5f
(Work around -Wuggest-override for event table macros from
gcc 11, 2021-04-25).
Also add a unit test checking that using wxCLASSINFO(wxObject) compiles
and works as expected.
This commit is contained in:
parent
a3b7244efe
commit
0585c96a3b
@ -436,6 +436,11 @@ public:
|
|||||||
// check if this object references the same data as the other one
|
// check if this object references the same data as the other one
|
||||||
bool IsSameAs(const wxObject& o) const { return m_refData == o.m_refData; }
|
bool IsSameAs(const wxObject& o) const { return m_refData == o.m_refData; }
|
||||||
|
|
||||||
|
// RTTI information, usually declared by wxDECLARE_DYNAMIC_CLASS() or
|
||||||
|
// similar, but done manually for the hierarchy root. Note that it's public
|
||||||
|
// for compatibility reasons, but shouldn't be accessed directly.
|
||||||
|
static wxClassInfo ms_classInfo;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
// ensure that our data is not shared with anybody else: if we have no
|
// ensure that our data is not shared with anybody else: if we have no
|
||||||
// data, it is created using CreateRefData() below, if we have shared data
|
// data, it is created using CreateRefData() below, if we have shared data
|
||||||
@ -452,8 +457,6 @@ protected:
|
|||||||
virtual wxObjectRefData *CloneRefData(const wxObjectRefData *data) const;
|
virtual wxObjectRefData *CloneRefData(const wxObjectRefData *data) const;
|
||||||
|
|
||||||
wxObjectRefData *m_refData;
|
wxObjectRefData *m_refData;
|
||||||
|
|
||||||
static wxClassInfo ms_classInfo;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
inline wxObject *wxCheckDynamicCast(wxObject *obj, wxClassInfo *classInfo)
|
inline wxObject *wxCheckDynamicCast(wxObject *obj, wxClassInfo *classInfo)
|
||||||
|
@ -149,6 +149,18 @@ void MiscTestCase::StaticCast()
|
|||||||
#endif // wxUSE_TARSTREAM
|
#endif // wxUSE_TARSTREAM
|
||||||
}
|
}
|
||||||
|
|
||||||
|
TEST_CASE("RTTI::ClassInfo", "[rtti]")
|
||||||
|
{
|
||||||
|
wxObject obj;
|
||||||
|
CHECK( obj.GetClassInfo()->IsKindOf(wxCLASSINFO(wxObject)) );
|
||||||
|
CHECK( !obj.GetClassInfo()->IsKindOf(wxCLASSINFO(wxArchiveEntry)) );
|
||||||
|
|
||||||
|
#if wxUSE_ZIPSTREAM
|
||||||
|
wxZipEntry zipEntry;
|
||||||
|
CHECK( zipEntry.GetClassInfo()->IsKindOf(wxCLASSINFO(wxArchiveEntry)) );
|
||||||
|
#endif // wxUSE_ZIPSTREAM
|
||||||
|
}
|
||||||
|
|
||||||
TEST_CASE("wxCTZ", "[math]")
|
TEST_CASE("wxCTZ", "[math]")
|
||||||
{
|
{
|
||||||
CHECK( wxCTZ(1) == 0 );
|
CHECK( wxCTZ(1) == 0 );
|
||||||
|
Loading…
Reference in New Issue
Block a user