Metaclass provides type inspection mechanism for Kanzi classes. More...
#include <kanzi/core/metadata/metaclass.hpp>
Public Types | |
typedef MetaclassContainer::const_iterator | MetaclassIterator |
typedef PropertyTypeContainer::const_iterator | PropertyTypeIterator |
typedef MessageTypeContainer::const_iterator | MessageTypeIterator |
typedef MetaMethodContainer::const_iterator | MetaMethodIterator |
Iterator for MetaMethod container. More... | |
Public Member Functions | |
virtual bool | isMetaclassOf (const MetaObject &object) const =0 |
Checks whether this metaclass describes the class of an object instance. More... | |
virtual shared_ptr< MetaObject > | create (Domain *domain, string_view name) const =0 |
template<typename Type > | |
shared_ptr< Type > | create (Domain *domain, string_view name) const |
Creates an instance of a class this metaclass describes. More... | |
bool | isAbstract () const |
Returns true if the class described by the metaclass is abstract, false otherwise. More... | |
bool | isSealed () const |
Internal function. More... | |
void | seal () |
Internal function. More... | |
const Metaclass * | getBase () const |
Returns the metaclass of the base class. More... | |
bool | isDerivedFrom (const Metaclass *metaclass) const |
Determines whether the class this metaclass describes derives from a class described by specified metaclass. More... | |
void | addPropertyType (AbstractPropertyType propertyType) |
void | addMessageType (AbstractMessageType messageType) |
void | addNestedMetaclass (const Metaclass *metaclass) |
void | addMixin (const Metaclass *metaclass) |
void | addMethod (const MetaMethod *method) |
Registers a method to the metaclass. More... | |
MetaclassIterator | beginNestedMetaclasses () const |
MetaclassIterator | endNestedMetaclasses () const |
MetaclassIterator | beginMixinMetaclasses () const |
MetaclassIterator | endMixinMetaclasses () const |
PropertyTypeIterator | beginPropertyTypes () const |
PropertyTypeIterator | endPropertyTypes () const |
MessageTypeIterator | beginMessageTypes () const |
MessageTypeIterator | endMessageTypes () const |
MetaMethodIterator | beginMethod () const |
Creates a const_iterator pointing to the top of the metamethod container. More... | |
MetaMethodIterator | endMethod () const |
Creates a const_iterator pointing to the end of the metamethod container. More... | |
const MetaMethod * | findMethod (string_view name) const |
Returns the metamethod registered in the metaclass with the given name. More... | |
FixedString | getName () const |
void | setEditorInfo (PropertyTypeEditorInfoSharedPtr editorInfo) |
PropertyTypeEditorInfoSharedPtr | getEditorInfo () const |
Protected Member Functions | |
Metaclass (const Metaclass *baseClass, FixedString name) | |
~Metaclass () | |
void | checkSealed () const |
void | setAbstract () |
Metaclass provides type inspection mechanism for Kanzi classes.
Classes deriving from Object can register information about their type, properties, methods, messages by using Metaclass and accompanying macros. Such information is used by serialization, scripting and to display friendly type information in Kanzi Studio.
Use KZ_METACLASS_BEGIN and KZ_METACLASS_END inside your class body to declare a metaclass. Serialization and functions instantiating objects use metaclass name to identify types. Use KZ_METACLASS_PROPERTY_TYPE to register a property type of your class to the metaclass. Use KZ_METACLASS_MESSAGE_TYPE to register a message type of your class to the metaclass. Use KZ_METACLASS_METHOD to register a MetaMethod of your class to the metaclass.
typedef MetaclassContainer::const_iterator kanzi::Metaclass::MetaclassIterator |
typedef PropertyTypeContainer::const_iterator kanzi::Metaclass::PropertyTypeIterator |
typedef MessageTypeContainer::const_iterator kanzi::Metaclass::MessageTypeIterator |
typedef MetaMethodContainer::const_iterator kanzi::Metaclass::MetaMethodIterator |
Iterator for MetaMethod container.
|
inlineexplicitprotected |
|
inlineprotected |
|
pure virtual |
Checks whether this metaclass describes the class of an object instance.
Implemented in kanzi::MetaclassStaticBase, kanzi::MetaclassAbstractImpl< TClass >, and kanzi::MetaclassImpl< TClass >.
|
pure virtual |
Implemented in kanzi::MetaclassStaticBase, kanzi::MetaclassAbstractBase, and kanzi::MetaclassImpl< TClass >.
|
inline |
Creates an instance of a class this metaclass describes.
|
inline |
Returns true if the class described by the metaclass is abstract, false otherwise.
|
inline |
Internal function.
|
inline |
Internal function.
|
inline |
Returns the metaclass of the base class.
|
inline |
Determines whether the class this metaclass describes derives from a class described by specified metaclass.
|
inline |
|
inline |
|
inline |
|
inline |
void kanzi::Metaclass::addMethod | ( | const MetaMethod * | method | ) |
Registers a method to the metaclass.
For convenience use KZ_METACLASS_METHOD macro to declare the metamethods.
method | The address of the MetaMethod instance to be registered. |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
MetaMethodIterator kanzi::Metaclass::beginMethod | ( | ) | const |
Creates a const_iterator pointing to the top of the metamethod container.
MetaMethodIterator kanzi::Metaclass::endMethod | ( | ) | const |
Creates a const_iterator pointing to the end of the metamethod container.
const MetaMethod* kanzi::Metaclass::findMethod | ( | string_view | name | ) | const |
Returns the metamethod registered in the metaclass with the given name.
name | The name of the metamethod. |
|
inline |
|
inline |
|
inline |
|
protected |
|
inlineprotected |