rttimacros.h
来自「这是VCF框架的代码」· C头文件 代码 · 共 502 行 · 第 1/2 页
H
502 行
#ifndef _VCF_RTTIMACROS_H__#define _VCF_RTTIMACROS_H__//RTTIMacros.h/*Copyright 2000-2004 The VCF Builder Project.Please see License.txt in the top level directorywhere you installed the VCF.*/#if _MSC_VER > 1000# pragma once#endif#include "vcf/FoundationKit/VCFRTTIImpl.h"#include "vcf/FoundationKit/ClassInfo.h"/**These are the new RTTI macros - don't use the ones defined in ClassInfo.h any more.*/#ifdef VCF_RTTI/**When defining your classes RTTI info in the VCF you will always startwith either this macro or the _class_abstract_rtti_ macro.This will begin the declaration of a nested class derived fromClassInfo.@param classType the class type to use. If you class is called Foo,then you will pass in Foo here.@param superClassName the name of the super class for this class. This must be a fully qualified classname (see above). If your classwas called Foo and derived from VCF::Object, then you would passin "VCF::Object" here.@param classID a string that represents a unique id. Preferably a UUIDthat has been converted into a string representation.This macro must be paired with the _class_rtti_end_ macro onceyou are finished defining your RTTI.*/#define _class_rtti_(classType,superClassName,classID) \ class classType##_rtti_ClassInfo : public VCF::ClassInfo<classType> { \ public: \ typedef classType RttiClassType;\ classType##_rtti_ClassInfo(): \ VCF::ClassInfo<RttiClassType>( VCF::StringUtils::getClassNameFromTypeInfo(typeid(classType)), superClassName, classID ){ \ VCF::String tmpClassName = VCF::StringUtils::getClassNameFromTypeInfo(typeid(classType)); \ if ( isClassRegistered() ){ \ \#define _class_rtti_end_ \ }\ }\ };\ \/**When defining your classes RTTI info in the VCF you will always startwith either this macro or the _class_rtti_ macro.This will begin the declaration of a nested class derived fromAbstractClassInfo.@param ClassType the class type to use. If you class is called Foo,then you will pass in Foo here.@param superClassName the name of the super class for this class. This must be a fully qualified classname (see above). If your classwas called Foo and derived from VCF::Object, then you would passin "VCF::Object" here.@param classID a string that represents a unique id. Preferably a UUIDthat has been converted into a string representation.This macro must be paired with the _class_rtti_end_ macro onceyou are finished defining your RTTI.*/#define _class_abstract_rtti_(classType,superClassName,classID) \ class classType##_rtti_ClassInfo : public VCF::AbstractClassInfo<classType> { \ public: \ typedef classType RttiClassType;\ classType##_rtti_ClassInfo(): \ VCF::AbstractClassInfo<RttiClassType>( VCF::StringUtils::getClassNameFromTypeInfo(typeid(classType)), superClassName, classID ){ \ VCF::String tmpClassName = VCF::StringUtils::getClassNameFromTypeInfo(typeid(classType)); \ if ( isClassRegistered() ){ \ \/**When defining your interfaces RTTI info in the VCF you will always startwith this macro. This will begin the declaration of a nested classderived from InterfaceInfo.@param InterfaceType the class type to use for your interface. If yourinterface is called FooInterface, then you will pass in FooInterface here.@param SuperInterfaceName the name of the interface that this interface derivesfrom. This must be a fully qualified classname. If your classwas called FooInterface and derived from VCF::Interface, then you would passin "VCF::Interface" here (this will be the case most of the time).@param InterfaceID a string that represents a unique id. Preferably a UUIDthat has been converted into a string representation.This macro must be paired with the _interface_rtti_end_ macro onceyou are finished defining your RTTI.*/#define _interface_rtti_(InterfaceType,SuperInterfaceName,InterfaceID)\ class InterfaceType##_rtti_InterfaceInfo : public VCF::InterfaceInfo<InterfaceType> {\ public:\ typedef InterfaceType RttiClassType;\ InterfaceType##_rtti_InterfaceInfo():\ VCF::InterfaceInfo<InterfaceType>( VCF::StringUtils::getClassNameFromTypeInfo(typeid(InterfaceType)),InterfaceID,SuperInterfaceName){\ VCF::String tmpClassName = VCF::StringUtils::getClassNameFromTypeInfo(typeid(InterfaceType));\ if ( true == isInterfaceRegistered_ ) {\ \#define _interface_rtti_end_ \ }\ };\ };\ \/***This macro is used within a _class_rtti_/_class_rtti_end_ block*to indicate that this class fully implements the specified*interface.*/#define _implements_( InterfaceType, interfaceID, superInterfaceClassName ) \ VCF::registerImplementedInterface<InterfaceType,RttiClassType>( NULL, tmpClassName, VCF::StringUtils::getClassNameFromTypeInfo(typeid(InterfaceType)), VCF::String(interfaceID), VCF::String(superInterfaceClassName) ); \ \#define _field_(FieldType,Field)\ VCF::registerFieldType<FieldType>( tmpClassName, VCF::String(#Field), offsetof(RttiClassType,Field) );\ \#define _field_obj_(FieldType,Field)\ VCF::registerObjectFieldType<FieldType>( tmpClassName, VCF::String(#Field), offsetof(RttiClassType,Field) );\ \/***Registers that the class fires an event. By declaring this it is expected that*there are methods for adding event handler of the specified type that fire*events of the specified event type.*@param handlerClassName the name of the EventHandler derived class. This class*will contain a method pointer to some source object that wants to get notified*for the event.*@param eventClassName the class name of the Event type that is fired*by this class.*@param eventMethod the method name that is used in the supporting*event methods. So you might pass in "StreamExhausted". You could then*expect to find methods as follows declared in the class:*<pre>* void addStreamExhaustedHandler( EventHandler* handler ) ;* void removeStreamExhaustedHandler( EventHandler* handler ) ;* void fireOnStreamExhausted( eventClassName* event ) ;*</pre>*/#define _event_(handlerClassName,EventType,DelegateID) \ VCF::registerEvent<RttiClassType,EventType>( NULL, NULL, tmpClassName, \ VCF::String(handlerClassName), VCF::String(#EventType), \ VCF::String(#DelegateID), \ (VCF::EventProperty::DelegateMethod)&RttiClassType::get##DelegateID); \ \#define _abstract_event_(handlerClassName,EventType,DelegateID) \ VCF::registerEvent<RttiClassType,EventType>( NULL, NULL, tmpClassName, \ VCF::String(handlerClassName), VCF::String(#EventType), \ VCF::String(#DelegateID), \ NULL); \ \#define _property_( type, propName, getFunc, setFunc, description ) \ VCF::registerPrimitiveProperty<type>( tmpClassName, VCF::String(propName), \ (VCF::TypedProperty<type>::GetFunction)&RttiClassType::getFunc, \ (VCF::TypedProperty<type>::SetFunction)&RttiClassType::setFunc, \ description ); \ \#define _property_ro_( type, propName, getFunc, description ) \ VCF::registerPrimitiveReadOnlyProperty<type>( tmpClassName, VCF::String(propName), \ (VCF::TypedProperty<type>::GetFunction)&RttiClassType::getFunc, \ description ); \ \#define _property_typedef_( type, propName, getFunc, setFunc, typeName, description ) \ VCF::registerTypeDefProperty<type>( tmpClassName, VCF::String(propName), \ (VCF::TypedProperty<type>::GetFunction)&RttiClassType::getFunc, \ (VCF::TypedProperty<type>::SetFunction)&RttiClassType::setFunc, \ VCF::String(typeName),description ); \ \#define _property_typef_ro_( type, propName, getFunc, typeName, description ) \ VCF::registerTypeDefReadOnlyProperty<type>( tmpClassName, VCF::String(propName), \ (VCF::TypedProperty<type>::GetFunction)&RttiClassType::getFunc, \ VCF::String(typeName),description ); \ \#define _property_object_( type, propName, getFunc, setFunc, description ) \ VCF::registerObjectProperty<type>( tmpClassName, VCF::String(propName), \ (VCF::TypedObjectProperty<type>::GetFunction)&RttiClassType::getFunc, \ (VCF::TypedObjectProperty<type>::SetFunction)&RttiClassType::setFunc,description ); \ \#define _property_object_ro_( type, propName, getFunc, description ) \ VCF::registerObjectReadOnlyProperty<type>( tmpClassName, VCF::String(propName), \ (VCF::TypedObjectProperty<type>::GetFunction)&RttiClassType::getFunc,description ); \ \#define _property_object_ref_( type, propName, getFunc, setFunc, description ) \ VCF::registerObjectPropertyRef<type>( tmpClassName, VCF::String(propName), \ (VCF::TypedObjectRefProperty<type>::GetFunction)&RttiClassType::getFunc, \ (VCF::TypedObjectRefProperty<type>::SetFunction)&RttiClassType::setFunc,description ); \ \#define _property_object_ref_ro_( type, propName, getFunc, description ) \ VCF::registerObjectReadOnlyPropertyRef<type>( tmpClassName, VCF::String(propName), \ (VCF::TypedObjectRefProperty<type>::GetFunction)&RttiClassType::getFunc,description ); \ \#define _property_enum_(type,propName,getFunc,setFunc, lower, upper, description) \ VCF::registerEnumProperty<type>( tmpClassName, VCF::String(propName), \ (VCF::TypedEnumProperty<type>::GetFunction)&RttiClassType::getFunc, \ (VCF::TypedEnumProperty<type>::SetFunction)&RttiClassType::setFunc, \ lower, \ upper,description); \ \#define _property_enumset_( type, propName,getFunc,setFunc, count, values, enumNames, description) \ VCF::registerEnumSetPropertyWithLabels( #type, tmpClassName, VCF::String(propName), \ (EnumSetProperty::GetFunction)&RttiClassType::getFunc, \ (EnumSetProperty::SetFunction)&RttiClassType::setFunc, \ count, \ values, \ enumNames,description ); \ \#define _property_enumset_ro_(type, propName,getFunc, count, values, enumNames, description) \ VCF::registerEnumSetReadOnlyPropertyWithLabels( #type, tmpClassName, VCF::String(propName), \ (EnumSetProperty::GetFunction)&RttiClassType::getFunc, \ count, \
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?