Unified meaning of wxTypeIdentifier in RTTI and RTTI-less type info systems; Fixed and added some comments

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@62693 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Jaakko Salli
2009-11-21 09:28:00 +00:00
parent 14ba694c26
commit c81aea0739

View File

@@ -14,10 +14,14 @@
// //
// This file defines wxTypeId macro that should be used internally in // This file defines wxTypeId macro that should be used internally in
// wxWidgets instead of typeid(), for compatibility with builds that do // wxWidgets instead of typeid(), for compatibility with builds that do
// not implement C++ RTTI. Also, type defining macros in this file are also // not implement C++ RTTI. Also, type defining macros in this file are
// intended for internal use only at this time and may change in future // intended for internal use only at this time and may change in future
// versions. // versions.
// //
// The reason why we need this simple RTTI system in addition to the older
// wxObject-based one is that the latter does not work in template
// classes.
//
#include "wx/defs.h" #include "wx/defs.h"
@@ -40,20 +44,20 @@
// wxTypeId could of course simply be defined as typeid. // wxTypeId could of course simply be defined as typeid.
// //
class wxTypeInfo class wxTypeIdentifier
{ {
public: public:
wxTypeInfo(const char* className) wxTypeIdentifier(const char* className)
{ {
m_className = className; m_className = className;
} }
bool operator==(const wxTypeInfo& other) bool operator==(const wxTypeIdentifier& other)
{ {
return strcmp(m_className, other.m_className) == 0; return strcmp(m_className, other.m_className) == 0;
} }
bool operator!=(const wxTypeInfo& other) bool operator!=(const wxTypeIdentifier& other)
{ {
return strcmp(m_className, other.m_className) != 0; return strcmp(m_className, other.m_className) != 0;
} }
@@ -61,7 +65,7 @@ private:
const char* m_className; const char* m_className;
}; };
#define wxTypeId(OBJ) wxTypeInfo(typeid(OBJ).name()) #define wxTypeId(OBJ) wxTypeIdentifier(typeid(OBJ).name())
#else // if !wxNO_RTTI #else // if !wxNO_RTTI