Meta capabilities

Top  Previous  Next

User interface > Translation options > Type options > Meta capabilities

 

 

 

Meta_capabilities

 

 

Create meta classes

 

If the option Create meta classes is enabled at the type options, Delphi2Cpp creates for each class an additional meta class (= class reference type).These class reference instances can be used for factory functions, to create different class types in dependence of the class reference parameters. These class reference instances also are needed if overridden virtual class methods have to be used.

 

To enable this option has drawbacks however. More manual post-processing will be necessary. One reason for that is, that

a creation of class instances from class references is possible only, if the class has a standard constructor.

 

 

Declare classes as dynamic

 

This feature from the first version of Delphi2Cpp hasn't been re-implemented in Delphi2Cpp 2 yet. If you need this feature please contact me.

 

 

Alternatively you can use MFC-like macros. In the Microsoft Foundation Classes (MFC) the macros DECLARE_DYNAMIC and IMPLEMENT_DYNAMIC give access to runtime class information, similar to the  runtime information that is provided in the VCL by the accordingly overwritten functions of TObject.

 

 

The macros can be renamed by means of the substitution table of the translator. An obvious alternative would be to use the macros "DECLARE_DYNCREATE" and "IMPLEMENT_DYNCREATE" also defined for the MFC in the file "afx.h".

 

 

The following table compares the class names and functions of the MFC and Delphi:

 

 

class CObject

class TObject

struct CRuntimeClass

class TMetaClass

CObject::GetRuntimeClass

TObject::ClassType

CRuntimeClass::IsDerivedFrom

TMetaClass::InheritsFrom

CObject::IsKindOf

TObject::InheritsFrom

CRuntimeClass::CreateObject

     TMetaClass::Create

CObject::CreateObject

TObject::Create

 

 

 

 

 



This page belongs to the Delphi2Cpp Documentation

Delphi2Cpp home  Content