The following code example shows how you can check the type of an object at run-time:
void CheckType(Node* node) {
if (node->class_().isA(mimepp::MESSAGE_CLASS)) {
// ...
}
else if (node->class_().isA(mimepp::BODY_PART_CLASS)) {
// ...
}
} The enumerated type IDs are listed in the mimepp.h header file.
Public Member Functions | |
| Class (const char *name, int id, const Class *superclass) | |
| Constructor. | |
| const char * | name () const |
| Gets the class name. | |
| int | id () const |
| Gets the class ID. | |
| const bool | isA (int id) const |
| Checks the type of an object by ID. | |
| const bool | isA (const char *name) const |
| Checks the type of an object by name. | |
| const Class * | superclass () const |
| Gets a pointer to the superclass. | |
Protected Attributes | |
| const char *const | mName |
| Class name | |
| const int | mId |
| Class ID | |
| const Class *const | mSuperclass |
| Pointer to the superclass instance. | |
|
||||||||||||||||
|
Constructor.
|
|
|
Gets the class ID. The enumerated type IDs are listed in the mimepp.h header file.
|
|
|
Returns true if the object associated with this Class instance is of type name.
|
|
|
Returns true if the object associated with this Class instance is of type id.
|
|
|
Gets the class name.
|
|
|
Gets the Class instance associated with the superclass of a class. This member function returns a pointer that may be NULL. (The pointer is NULL if there is no superclass.)
|
Copyright © 2001-2007 Hunny Software, Inc. All rights reserved.