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. | |
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.
Constructor.
| name | name of the class | |
| id | ID of the class | |
| superclass | pointer to the superclass of the class |
| int id | ( | ) | const [inline] |
Gets the class ID.
The enumerated type IDs are listed in the mimepp.h header file.
| const bool isA | ( | const char * | name | ) | const |
Returns true if the object associated with this Class instance is of type name.
| name | name of a class |
| const bool isA | ( | int | id | ) | const |
Returns true if the object associated with this Class instance is of type id.
| id | ID of a class |
| const char * name | ( | ) | const [inline] |
Gets the class name.
| const Class * superclass | ( | ) | const [inline] |
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-2009 Hunny Software, Inc. All rights reserved.