ClassIDs are now actually typeinfo name pointers.
I'll see, next, about the `instanceOf` thing, and going with more normal RTTI routes.
This commit is contained in:
@ -27,13 +27,13 @@ using namespace lout;
|
|||||||
|
|
||||||
namespace dw {
|
namespace dw {
|
||||||
|
|
||||||
int AlignedTableCell::CLASS_ID = -1;
|
std::intptr_t AlignedTableCell::CLASS_ID = -1;
|
||||||
|
|
||||||
AlignedTableCell::AlignedTableCell (AlignedTableCell *ref, bool limitTextWidth):
|
AlignedTableCell::AlignedTableCell (AlignedTableCell *ref, bool limitTextWidth):
|
||||||
AlignedTextblock (limitTextWidth)
|
AlignedTextblock (limitTextWidth)
|
||||||
{
|
{
|
||||||
DBG_OBJ_CREATE ("dw::AlignedTableCell");
|
DBG_OBJ_CREATE ("dw::AlignedTableCell");
|
||||||
registerName ("dw::AlignedTableCell", &CLASS_ID);
|
registerName ("dw::AlignedTableCell", typeid(*this), &CLASS_ID);
|
||||||
|
|
||||||
/** \bug ignoreLine1OffsetSometimes does not work? */
|
/** \bug ignoreLine1OffsetSometimes does not work? */
|
||||||
//ignoreLine1OffsetSometimes = true;
|
//ignoreLine1OffsetSometimes = true;
|
||||||
|
|||||||
@ -33,7 +33,7 @@ protected:
|
|||||||
void setMaxValue (int maxValue, int value);
|
void setMaxValue (int maxValue, int value);
|
||||||
|
|
||||||
public:
|
public:
|
||||||
static int CLASS_ID;
|
static std::intptr_t CLASS_ID;
|
||||||
|
|
||||||
AlignedTableCell(AlignedTableCell *ref, bool limitTextWidth);
|
AlignedTableCell(AlignedTableCell *ref, bool limitTextWidth);
|
||||||
~AlignedTableCell();
|
~AlignedTableCell();
|
||||||
|
|||||||
@ -58,13 +58,13 @@ void AlignedTextblock::List::unref(int pos)
|
|||||||
delete this;
|
delete this;
|
||||||
}
|
}
|
||||||
|
|
||||||
int AlignedTextblock::CLASS_ID = -1;
|
std::intptr_t AlignedTextblock::CLASS_ID = -1;
|
||||||
|
|
||||||
AlignedTextblock::AlignedTextblock (bool limitTextWidth):
|
AlignedTextblock::AlignedTextblock (bool limitTextWidth):
|
||||||
Textblock (limitTextWidth)
|
Textblock (limitTextWidth)
|
||||||
{
|
{
|
||||||
DBG_OBJ_CREATE ("dw::AlignedTextblock");
|
DBG_OBJ_CREATE ("dw::AlignedTextblock");
|
||||||
registerName ("dw::AlignedTextblock", &CLASS_ID);
|
registerName ("dw::AlignedTextblock", typeid(*this), &CLASS_ID);
|
||||||
}
|
}
|
||||||
|
|
||||||
void AlignedTextblock::setRefTextblock (AlignedTextblock *ref)
|
void AlignedTextblock::setRefTextblock (AlignedTextblock *ref)
|
||||||
|
|||||||
@ -51,7 +51,7 @@ protected:
|
|||||||
void updateValue ();
|
void updateValue ();
|
||||||
|
|
||||||
public:
|
public:
|
||||||
static int CLASS_ID;
|
static std::intptr_t CLASS_ID;
|
||||||
|
|
||||||
~AlignedTextblock();
|
~AlignedTextblock();
|
||||||
};
|
};
|
||||||
|
|||||||
@ -131,12 +131,12 @@ int ImageMapsList::link (object::Object *key, int x, int y)
|
|||||||
|
|
||||||
// ----------------------------------------------------------------------
|
// ----------------------------------------------------------------------
|
||||||
|
|
||||||
int Image::CLASS_ID = -1;
|
std::intptr_t Image::CLASS_ID = -1;
|
||||||
|
|
||||||
Image::Image(const char *altText)
|
Image::Image(const char *altText)
|
||||||
{
|
{
|
||||||
DBG_OBJ_CREATE ("dw::Image");
|
DBG_OBJ_CREATE ("dw::Image");
|
||||||
registerName ("dw::Image", &CLASS_ID);
|
registerName ("dw::Image", typeid(*this), &CLASS_ID);
|
||||||
this->altText = altText ? dStrdup (altText) : NULL;
|
this->altText = altText ? dStrdup (altText) : NULL;
|
||||||
altTextWidth = -1; // not yet calculated
|
altTextWidth = -1; // not yet calculated
|
||||||
buffer = NULL;
|
buffer = NULL;
|
||||||
|
|||||||
@ -145,7 +145,7 @@ protected:
|
|||||||
//core::Iterator *iterator (Content::Type mask, bool atEnd);
|
//core::Iterator *iterator (Content::Type mask, bool atEnd);
|
||||||
|
|
||||||
public:
|
public:
|
||||||
static int CLASS_ID;
|
static std::intptr_t CLASS_ID;
|
||||||
|
|
||||||
Image(const char *altText);
|
Image(const char *altText);
|
||||||
~Image();
|
~Image();
|
||||||
|
|||||||
@ -25,13 +25,13 @@
|
|||||||
|
|
||||||
namespace dw {
|
namespace dw {
|
||||||
|
|
||||||
int ListItem::CLASS_ID = -1;
|
std::intptr_t ListItem::CLASS_ID = -1;
|
||||||
|
|
||||||
ListItem::ListItem (ListItem *ref, bool limitTextWidth):
|
ListItem::ListItem (ListItem *ref, bool limitTextWidth):
|
||||||
AlignedTextblock (limitTextWidth)
|
AlignedTextblock (limitTextWidth)
|
||||||
{
|
{
|
||||||
DBG_OBJ_CREATE ("dw::ListItem");
|
DBG_OBJ_CREATE ("dw::ListItem");
|
||||||
registerName ("dw::ListItem", &CLASS_ID);
|
registerName ("dw::ListItem", typeid(*this), &CLASS_ID);
|
||||||
setRefTextblock (ref);
|
setRefTextblock (ref);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -13,7 +13,7 @@ protected:
|
|||||||
void setMaxValue (int maxValue, int value);
|
void setMaxValue (int maxValue, int value);
|
||||||
|
|
||||||
public:
|
public:
|
||||||
static int CLASS_ID;
|
static std::intptr_t CLASS_ID;
|
||||||
|
|
||||||
ListItem(ListItem *ref, bool limitTextWidth);
|
ListItem(ListItem *ref, bool limitTextWidth);
|
||||||
~ListItem();
|
~ListItem();
|
||||||
|
|||||||
@ -38,12 +38,12 @@ const char *OOFAwareWidget::OOFM_NAME[NUM_OOFM] = {
|
|||||||
"FLOATS", "ABSOLUTE", "RELATIVE", "FIXED"
|
"FLOATS", "ABSOLUTE", "RELATIVE", "FIXED"
|
||||||
};
|
};
|
||||||
|
|
||||||
int OOFAwareWidget::CLASS_ID = -1;
|
std::intptr_t OOFAwareWidget::CLASS_ID = -1;
|
||||||
|
|
||||||
OOFAwareWidget::OOFAwareWidget ()
|
OOFAwareWidget::OOFAwareWidget ()
|
||||||
{
|
{
|
||||||
DBG_OBJ_CREATE ("dw::oof::OOFAwareWidget");
|
DBG_OBJ_CREATE ("dw::oof::OOFAwareWidget");
|
||||||
registerName ("dw::oof::OOFAwareWidget", &CLASS_ID);
|
registerName ("dw::oof::OOFAwareWidget", typeid(*this), &CLASS_ID);
|
||||||
|
|
||||||
for (int i = 0; i < NUM_OOFM; i++) {
|
for (int i = 0; i < NUM_OOFM; i++) {
|
||||||
oofContainer[i] = NULL;
|
oofContainer[i] = NULL;
|
||||||
|
|||||||
@ -195,7 +195,7 @@ public:
|
|||||||
SL_START, SL_BACKGROUND, SL_SC_BOTTOM, SL_IN_FLOW, SL_OOF_REF,
|
SL_START, SL_BACKGROUND, SL_SC_BOTTOM, SL_IN_FLOW, SL_OOF_REF,
|
||||||
SL_OOF_CONT, SL_SC_TOP, SL_END };
|
SL_OOF_CONT, SL_SC_TOP, SL_END };
|
||||||
|
|
||||||
static int CLASS_ID;
|
static std::intptr_t CLASS_ID;
|
||||||
|
|
||||||
OOFAwareWidget ();
|
OOFAwareWidget ();
|
||||||
~OOFAwareWidget ();
|
~OOFAwareWidget ();
|
||||||
|
|||||||
@ -23,12 +23,12 @@
|
|||||||
|
|
||||||
namespace dw {
|
namespace dw {
|
||||||
|
|
||||||
int RegardingBorder::CLASS_ID = -1;
|
std::intptr_t RegardingBorder::CLASS_ID = -1;
|
||||||
|
|
||||||
RegardingBorder::RegardingBorder ()
|
RegardingBorder::RegardingBorder ()
|
||||||
{
|
{
|
||||||
DBG_OBJ_CREATE ("dw::RegardingBorder");
|
DBG_OBJ_CREATE ("dw::RegardingBorder");
|
||||||
registerName ("dw::RegardingBorder", &CLASS_ID);
|
registerName ("dw::RegardingBorder", typeid(*this), &CLASS_ID);
|
||||||
}
|
}
|
||||||
|
|
||||||
RegardingBorder::~RegardingBorder ()
|
RegardingBorder::~RegardingBorder ()
|
||||||
|
|||||||
@ -13,7 +13,7 @@ namespace dw {
|
|||||||
class RegardingBorder: public oof::OOFAwareWidget
|
class RegardingBorder: public oof::OOFAwareWidget
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
static int CLASS_ID;
|
static std::intptr_t CLASS_ID;
|
||||||
|
|
||||||
RegardingBorder ();
|
RegardingBorder ();
|
||||||
~RegardingBorder ();
|
~RegardingBorder ();
|
||||||
|
|||||||
@ -26,12 +26,12 @@
|
|||||||
|
|
||||||
namespace dw {
|
namespace dw {
|
||||||
|
|
||||||
int Ruler::CLASS_ID = -1;
|
std::intptr_t Ruler::CLASS_ID = -1;
|
||||||
|
|
||||||
Ruler::Ruler ()
|
Ruler::Ruler ()
|
||||||
{
|
{
|
||||||
DBG_OBJ_CREATE ("dw::Ruler");
|
DBG_OBJ_CREATE ("dw::Ruler");
|
||||||
registerName ("dw::Ruler", &CLASS_ID);
|
registerName ("dw::Ruler", typeid(*this), &CLASS_ID);
|
||||||
}
|
}
|
||||||
|
|
||||||
Ruler::~Ruler ()
|
Ruler::~Ruler ()
|
||||||
|
|||||||
@ -30,7 +30,7 @@ protected:
|
|||||||
core::GettingWidgetAtPointContext *context);
|
core::GettingWidgetAtPointContext *context);
|
||||||
|
|
||||||
public:
|
public:
|
||||||
static int CLASS_ID;
|
static std::intptr_t CLASS_ID;
|
||||||
|
|
||||||
Ruler ();
|
Ruler ();
|
||||||
~Ruler ();
|
~Ruler ();
|
||||||
|
|||||||
@ -27,13 +27,13 @@ using namespace lout;
|
|||||||
|
|
||||||
namespace dw {
|
namespace dw {
|
||||||
|
|
||||||
int SimpleTableCell::CLASS_ID = -1;
|
std::intptr_t SimpleTableCell::CLASS_ID = -1;
|
||||||
|
|
||||||
SimpleTableCell::SimpleTableCell (bool limitTextWidth):
|
SimpleTableCell::SimpleTableCell (bool limitTextWidth):
|
||||||
Textblock (limitTextWidth)
|
Textblock (limitTextWidth)
|
||||||
{
|
{
|
||||||
DBG_OBJ_CREATE ("dw::SimpleTableCell");
|
DBG_OBJ_CREATE ("dw::SimpleTableCell");
|
||||||
registerName ("dw::SimpleTableCell", &CLASS_ID);
|
registerName ("dw::SimpleTableCell", typeid(*this), &CLASS_ID);
|
||||||
}
|
}
|
||||||
|
|
||||||
SimpleTableCell::~SimpleTableCell()
|
SimpleTableCell::~SimpleTableCell()
|
||||||
|
|||||||
@ -24,7 +24,7 @@ protected:
|
|||||||
bool adjustExtraSpaceWhenCorrectingRequisitionByOOF ();
|
bool adjustExtraSpaceWhenCorrectingRequisitionByOOF ();
|
||||||
|
|
||||||
public:
|
public:
|
||||||
static int CLASS_ID;
|
static std::intptr_t CLASS_ID;
|
||||||
|
|
||||||
SimpleTableCell (bool limitTextWidth);
|
SimpleTableCell (bool limitTextWidth);
|
||||||
~SimpleTableCell ();
|
~SimpleTableCell ();
|
||||||
|
|||||||
@ -29,12 +29,12 @@ using namespace lout;
|
|||||||
namespace dw {
|
namespace dw {
|
||||||
|
|
||||||
bool Table::adjustTableMinWidth = true;
|
bool Table::adjustTableMinWidth = true;
|
||||||
int Table::CLASS_ID = -1;
|
std::intptr_t Table::CLASS_ID = -1;
|
||||||
|
|
||||||
Table::Table(bool limitTextWidth)
|
Table::Table(bool limitTextWidth)
|
||||||
{
|
{
|
||||||
DBG_OBJ_CREATE ("dw::Table");
|
DBG_OBJ_CREATE ("dw::Table");
|
||||||
registerName ("dw::Table", &CLASS_ID);
|
registerName ("dw::Table", typeid(*this), &CLASS_ID);
|
||||||
setButtonSensitive(false);
|
setButtonSensitive(false);
|
||||||
|
|
||||||
this->limitTextWidth = limitTextWidth;
|
this->limitTextWidth = limitTextWidth;
|
||||||
|
|||||||
@ -492,7 +492,7 @@ protected:
|
|||||||
void removeChild (Widget *child);
|
void removeChild (Widget *child);
|
||||||
|
|
||||||
public:
|
public:
|
||||||
static int CLASS_ID;
|
static std::intptr_t CLASS_ID;
|
||||||
|
|
||||||
inline static void setAdjustTableMinWidth (bool adjustTableMinWidth)
|
inline static void setAdjustTableMinWidth (bool adjustTableMinWidth)
|
||||||
{ Table::adjustTableMinWidth = adjustTableMinWidth; }
|
{ Table::adjustTableMinWidth = adjustTableMinWidth; }
|
||||||
|
|||||||
@ -43,7 +43,7 @@ using namespace lout::unicode;
|
|||||||
|
|
||||||
namespace dw {
|
namespace dw {
|
||||||
|
|
||||||
int Textblock::CLASS_ID = -1;
|
std::intptr_t Textblock::CLASS_ID = -1;
|
||||||
|
|
||||||
Textblock::WordImgRenderer::WordImgRenderer (Textblock *textblock,
|
Textblock::WordImgRenderer::WordImgRenderer (Textblock *textblock,
|
||||||
int wordNo)
|
int wordNo)
|
||||||
@ -206,7 +206,7 @@ void Textblock::setStretchabilityFactor (int stretchabilityFactor)
|
|||||||
Textblock::Textblock (bool limitTextWidth, bool treatAsInline)
|
Textblock::Textblock (bool limitTextWidth, bool treatAsInline)
|
||||||
{
|
{
|
||||||
DBG_OBJ_CREATE ("dw::Textblock");
|
DBG_OBJ_CREATE ("dw::Textblock");
|
||||||
registerName ("dw::Textblock", &CLASS_ID);
|
registerName ("dw::Textblock", typeid(*this), &CLASS_ID);
|
||||||
setButtonSensitive(true);
|
setButtonSensitive(true);
|
||||||
|
|
||||||
hasListitemValue = false;
|
hasListitemValue = false;
|
||||||
|
|||||||
@ -864,7 +864,7 @@ protected:
|
|||||||
int getGeneratorRest (int oofmIndex);
|
int getGeneratorRest (int oofmIndex);
|
||||||
|
|
||||||
public:
|
public:
|
||||||
static int CLASS_ID;
|
static std::intptr_t CLASS_ID;
|
||||||
|
|
||||||
static void setPenaltyHyphen (int penaltyHyphen);
|
static void setPenaltyHyphen (int penaltyHyphen);
|
||||||
static void setPenaltyHyphen2 (int penaltyHyphen2);
|
static void setPenaltyHyphen2 (int penaltyHyphen2);
|
||||||
|
|||||||
4
dw/ui.cc
4
dw/ui.cc
@ -32,12 +32,12 @@ namespace ui {
|
|||||||
using namespace lout;
|
using namespace lout;
|
||||||
using namespace lout::object;
|
using namespace lout::object;
|
||||||
|
|
||||||
int Embed::CLASS_ID = -1;
|
std::intptr_t Embed::CLASS_ID = -1;
|
||||||
|
|
||||||
Embed::Embed(Resource *resource)
|
Embed::Embed(Resource *resource)
|
||||||
{
|
{
|
||||||
DBG_OBJ_CREATE ("dw::core::ui::Embed");
|
DBG_OBJ_CREATE ("dw::core::ui::Embed");
|
||||||
registerName ("dw::core::ui::Embed", &CLASS_ID);
|
registerName ("dw::core::ui::Embed", typeid(*this), &CLASS_ID);
|
||||||
this->resource = resource;
|
this->resource = resource;
|
||||||
resource->setEmbed (this);
|
resource->setEmbed (this);
|
||||||
DBG_OBJ_ASSOC_CHILD (resource);
|
DBG_OBJ_ASSOC_CHILD (resource);
|
||||||
|
|||||||
2
dw/ui.hh
2
dw/ui.hh
@ -251,7 +251,7 @@ protected:
|
|||||||
bool buttonPressImpl (core::EventButton *event);
|
bool buttonPressImpl (core::EventButton *event);
|
||||||
|
|
||||||
public:
|
public:
|
||||||
static int CLASS_ID;
|
static std::intptr_t CLASS_ID;
|
||||||
|
|
||||||
Embed(Resource *resource);
|
Embed(Resource *resource);
|
||||||
~Embed();
|
~Embed();
|
||||||
|
|||||||
@ -73,12 +73,12 @@ void Widget::WidgetImgRenderer::draw (int x, int y, int width, int height)
|
|||||||
// ----------------------------------------------------------------------
|
// ----------------------------------------------------------------------
|
||||||
|
|
||||||
bool Widget::adjustMinWidth = true;
|
bool Widget::adjustMinWidth = true;
|
||||||
int Widget::CLASS_ID = -1;
|
std::intptr_t Widget::CLASS_ID = -1;
|
||||||
|
|
||||||
Widget::Widget ()
|
Widget::Widget ()
|
||||||
{
|
{
|
||||||
DBG_OBJ_CREATE ("dw::core::Widget");
|
DBG_OBJ_CREATE ("dw::core::Widget");
|
||||||
registerName ("dw::core::Widget", &CLASS_ID);
|
registerName ("dw::core::Widget", typeid(*this), &CLASS_ID);
|
||||||
|
|
||||||
DBG_OBJ_ASSOC_CHILD (&requisitionParams);
|
DBG_OBJ_ASSOC_CHILD (&requisitionParams);
|
||||||
DBG_OBJ_ASSOC_CHILD (&extremesParams);
|
DBG_OBJ_ASSOC_CHILD (&extremesParams);
|
||||||
|
|||||||
@ -458,7 +458,7 @@ private:
|
|||||||
|
|
||||||
|
|
||||||
public:
|
public:
|
||||||
static int CLASS_ID;
|
static std::intptr_t CLASS_ID;
|
||||||
|
|
||||||
inline static void setAdjustMinWidth (bool adjustMinWidth)
|
inline static void setAdjustMinWidth (bool adjustMinWidth)
|
||||||
{ Widget::adjustMinWidth = adjustMinWidth; }
|
{ Widget::adjustMinWidth = adjustMinWidth; }
|
||||||
|
|||||||
@ -31,11 +31,11 @@ namespace identity {
|
|||||||
using namespace object;
|
using namespace object;
|
||||||
using namespace container::typed;
|
using namespace container::typed;
|
||||||
|
|
||||||
IdentifiableObject::Class::Class (IdentifiableObject::Class *parent, int id,
|
IdentifiableObject::Class::Class (IdentifiableObject::Class *parent, const std::type_index id,
|
||||||
const char *className)
|
const char *className)
|
||||||
|
: id( (std::intptr_t) id.name() )
|
||||||
{
|
{
|
||||||
this->parent = parent;
|
this->parent = parent;
|
||||||
this->id = id;
|
|
||||||
this->className = className;
|
this->className = className;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -57,7 +57,7 @@ void IdentifiableObject::Class::intoStringBuffer(misc::StringBuffer *sb)
|
|||||||
|
|
||||||
std::map< std::string, std::unique_ptr< IdentifiableObject::Class > > IdentifiableObject::classesByName;
|
std::map< std::string, std::unique_ptr< IdentifiableObject::Class > > IdentifiableObject::classesByName;
|
||||||
|
|
||||||
std::vector< IdentifiableObject::Class * > IdentifiableObject::classesById;
|
std::map< std::intptr_t, IdentifiableObject::Class * > IdentifiableObject::classesById;
|
||||||
|
|
||||||
IdentifiableObject::Class *IdentifiableObject::currentlyConstructedClass;
|
IdentifiableObject::Class *IdentifiableObject::currentlyConstructedClass;
|
||||||
|
|
||||||
@ -79,13 +79,13 @@ void IdentifiableObject::intoStringBuffer(misc::StringBuffer *sb)
|
|||||||
* \brief This method must be called in the constructor for the sub class.
|
* \brief This method must be called in the constructor for the sub class.
|
||||||
* See class comment for details.
|
* See class comment for details.
|
||||||
*/
|
*/
|
||||||
void IdentifiableObject::registerName (const char *className, int *classId)
|
void IdentifiableObject::registerName (const char *className, const std::type_index index, std::intptr_t *classId)
|
||||||
{
|
{
|
||||||
if (not classesByName.contains( className )) {
|
if (not classesByName.contains( className )) {
|
||||||
classesByName.emplace( className,
|
classesByName.emplace( className,
|
||||||
std::make_unique< Class >( currentlyConstructedClass, classesById.size(), className ) );
|
std::make_unique< Class >( currentlyConstructedClass, index, className ) );
|
||||||
auto *const klass= classesByName.at( className ).get();
|
auto *const klass= classesByName.at( className ).get();
|
||||||
classesById.push_back( klass );
|
classesById[ klass->id ]= klass;
|
||||||
*classId = klass->id;
|
*classId = klass->id;
|
||||||
}
|
}
|
||||||
Class *const klass = classesByName.at( className ).get();
|
Class *const klass = classesByName.at( className ).get();
|
||||||
@ -99,7 +99,7 @@ void IdentifiableObject::registerName (const char *className, int *classId)
|
|||||||
* \brief Returns, whether this class is an instance of the class, given by
|
* \brief Returns, whether this class is an instance of the class, given by
|
||||||
* \em otherClassId, or of a sub class of this class.
|
* \em otherClassId, or of a sub class of this class.
|
||||||
*/
|
*/
|
||||||
bool IdentifiableObject::instanceOf (int otherClassId)
|
bool IdentifiableObject::instanceOf (std::intptr_t otherClassId)
|
||||||
{
|
{
|
||||||
if (otherClassId == -1)
|
if (otherClassId == -1)
|
||||||
// Other class has not been registered yet, while it should have been,
|
// Other class has not been registered yet, while it should have been,
|
||||||
|
|||||||
@ -2,6 +2,7 @@
|
|||||||
#define __LOUT_OBJECTX_HH__
|
#define __LOUT_OBJECTX_HH__
|
||||||
|
|
||||||
#include <memory>
|
#include <memory>
|
||||||
|
#include <typeindex>
|
||||||
#include <vector>
|
#include <vector>
|
||||||
#include <map>
|
#include <map>
|
||||||
|
|
||||||
@ -106,22 +107,22 @@ private:
|
|||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
Class *parent;
|
Class *parent;
|
||||||
int id;
|
std::intptr_t id;
|
||||||
const char *className;
|
const char *className;
|
||||||
|
|
||||||
Class (Class *parent, int id, const char *className);
|
Class (Class *parent, std::type_index id, const char *className);
|
||||||
|
|
||||||
void intoStringBuffer(misc::StringBuffer *sb);
|
void intoStringBuffer(misc::StringBuffer *sb);
|
||||||
};
|
};
|
||||||
|
|
||||||
static std::map< std::string, std::unique_ptr< Class > > classesByName;
|
static std::map< std::string, std::unique_ptr< Class > > classesByName;
|
||||||
static std::vector< Class * > classesById;
|
static std::map< std::intptr_t, Class * > classesById;
|
||||||
static Class *currentlyConstructedClass;
|
static Class *currentlyConstructedClass;
|
||||||
|
|
||||||
int classId;
|
std::intptr_t classId;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
void registerName (const char *className, int *classId);
|
void registerName (const char *className, std::type_index index, std::intptr_t *classId);
|
||||||
|
|
||||||
public:
|
public:
|
||||||
IdentifiableObject ();
|
IdentifiableObject ();
|
||||||
@ -134,7 +135,7 @@ public:
|
|||||||
* This is rarely used, rather, tests with
|
* This is rarely used, rather, tests with
|
||||||
* identity::IdentifiableObject::instanceOf are done.
|
* identity::IdentifiableObject::instanceOf are done.
|
||||||
*/
|
*/
|
||||||
int getClassId () { return classId; }
|
std::intptr_t getClassId () { return classId; }
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* \brief Return the name, under which the class of this object was
|
* \brief Return the name, under which the class of this object was
|
||||||
@ -142,7 +143,7 @@ public:
|
|||||||
*/
|
*/
|
||||||
const char *getClassName() { return classesById.at( classId )->className; }
|
const char *getClassName() { return classesById.at( classId )->className; }
|
||||||
|
|
||||||
bool instanceOf (int otherClassId);
|
bool instanceOf (std::intptr_t otherClassId);
|
||||||
};
|
};
|
||||||
|
|
||||||
} // namespace identity
|
} // namespace identity
|
||||||
|
|||||||
Reference in New Issue
Block a user