/ : no; . , , , , . , . .
Delphi. , :
void testing()
{
__classid(Mixin<Stdctrls::TLabel>);
}
...
" E2242 test.cpp 53: __classid Delphi ( , __declspec (delphiclass) System:: TObject) ()"
, / Delphi- [. , TObject]. , , delphi- . , delphi-style, . , , . , :
void testing()
{
typedef Mixin<Stdctrls::TLabel> __ttype;
std::auto_ptr<__ttype> c2(new __ttype(0));
__classid(Mixin<Stdctrls::TLabel>);
}
__declspec (delphiclass) , :
template <class T>
class __declspec(delphiclass) Mixin : public T {
private:
int i;
typedef T inherited;
public:
__fastcall Mixin(TComponent *owner) : inherited(owner) {};
};
, , delphi- , , , , : Delphi TTypeData.PropCount - http://docwiki.embarcadero.com/VCL/en/TypInfo.TTypeData - , . - , , "0" : (
, PropCount, :
class TCppComp : public Classes::TComponent {
int i;
public:
__fastcall TCppComp(TComponent* owner): Classes::TComponent(owner) {};
__published:
__property int AAAA = {read=i, write=i};
};
template <class T>
class __declspec(delphiclass) Mixin : public T {
private:
int i;
typedef T inherited;
public:
__fastcall Mixin(TComponent *owner) : inherited(owner) {};
};
typedef Mixin<TCppComp> TMixinComp;
void showProps(TClass meta) {
PTypeInfo pInfo = PTypeInfo(meta->ClassInfo());
int Count = GetPropList(pInfo, tkAny, NULL);
TAPtr<PPropInfo> List(new PPropInfo[Count]);
std::printf("Class: %s - Total Props:%d\n",
AnsiString(pInfo->Name).c_str(), Count);
GetPropList(pInfo, tkAny, *(reinterpret_cast<PPropList*>(&List)));
for (int i = 0; i < Count; i++) {
AnsiString propName(List[i]->Name);
std::printf("\t%s\n", propName.c_str());
}
}
void test() {
showProps(__classid(TCppComp));
showProps(__classid(TMixinComp));
}
int main() {
test();
return 0;
}
:
Class: TCppComp - Total Props:3
AAAA
Name
Tag
Class: @%Mixin$8TCppComp% - Total Props:0
IOW, Mixin "0", 3: (
, .
, _TEXT, DEP.
, PropCount, , . , , QC : , , , , , .
,
PS: , Mixin , ; , .