rtti

How to set event handlers via new RTTI? [D2010]

╄→гoц情女王★ 提交于 2021-02-19 03:19:29
问题 Playing with new RTTI module, I couldn't find a way to set an event handler with the new utilities. Trying something like this: LProp := TRttiContext.Create.GetType(Form1.ClassInfo).AsInstance.GetProperty('OnClick'); LProp.SetValue(Form1, {a TValue!}); SetValue needs a TValue passed but I've yet to find a way to represent a TMethod via a TValue. Any comments? ps. And a side question.. It seems prefixing RTTI variables with "L" is a convention (and a good one IMO, meta code turns into a puzzle

How to set event handlers via new RTTI? [D2010]

巧了我就是萌 提交于 2021-02-19 03:19:19
问题 Playing with new RTTI module, I couldn't find a way to set an event handler with the new utilities. Trying something like this: LProp := TRttiContext.Create.GetType(Form1.ClassInfo).AsInstance.GetProperty('OnClick'); LProp.SetValue(Form1, {a TValue!}); SetValue needs a TValue passed but I've yet to find a way to represent a TMethod via a TValue. Any comments? ps. And a side question.. It seems prefixing RTTI variables with "L" is a convention (and a good one IMO, meta code turns into a puzzle

How to set event handlers via new RTTI? [D2010]

*爱你&永不变心* 提交于 2021-02-19 03:18:56
问题 Playing with new RTTI module, I couldn't find a way to set an event handler with the new utilities. Trying something like this: LProp := TRttiContext.Create.GetType(Form1.ClassInfo).AsInstance.GetProperty('OnClick'); LProp.SetValue(Form1, {a TValue!}); SetValue needs a TValue passed but I've yet to find a way to represent a TMethod via a TValue. Any comments? ps. And a side question.. It seems prefixing RTTI variables with "L" is a convention (and a good one IMO, meta code turns into a puzzle

Can I disable RTTI selectively in my code base to reduce the binary size?

淺唱寂寞╮ 提交于 2021-02-10 07:43:45
问题 I'm working on an iPhone app that uses C++ and is almost at the 100 MB mark (the point at which Apple won't let people download it via WWAN). I've taken many steps to reduce the binary size, such as removing unneeded third-party dependencies. However, the app, and in particular the binary, is still large because it has a lot of features. I've heard that disabling RTTI can reduce the binary size. Would it be possible to turn off RTTI for some files, e.g. all files without the strings "typeid"

Can I disable RTTI selectively in my code base to reduce the binary size?

六眼飞鱼酱① 提交于 2021-02-10 07:43:17
问题 I'm working on an iPhone app that uses C++ and is almost at the 100 MB mark (the point at which Apple won't let people download it via WWAN). I've taken many steps to reduce the binary size, such as removing unneeded third-party dependencies. However, the app, and in particular the binary, is still large because it has a lot of features. I've heard that disabling RTTI can reduce the binary size. Would it be possible to turn off RTTI for some files, e.g. all files without the strings "typeid"

Can I disable RTTI selectively in my code base to reduce the binary size?

此生再无相见时 提交于 2021-02-10 07:43:09
问题 I'm working on an iPhone app that uses C++ and is almost at the 100 MB mark (the point at which Apple won't let people download it via WWAN). I've taken many steps to reduce the binary size, such as removing unneeded third-party dependencies. However, the app, and in particular the binary, is still large because it has a lot of features. I've heard that disabling RTTI can reduce the binary size. Would it be possible to turn off RTTI for some files, e.g. all files without the strings "typeid"

Why are some properties repeated when TRttiContext.GetType is called on a VCL Control?

ぃ、小莉子 提交于 2021-02-08 14:15:44
问题 Why are some properties repeated (such as Action and Align ) where others are not ( AlignWithMargins ) when TRttiContext.GetType is called on a VCL Control? uses System.RTTI, System.Generics.Collections, System.Generics.Defaults; //.... procedure TForm11.btnShowPropertiesClick(Sender: TObject); var R: TRttiContext; Props: TArray<TRttiProperty>; Prop : TRttiProperty; begin memo1.Clear; R := TRttiContext.Create; Props := R.GetType(Sender.ClassType).GetProperties; //Sort properties by name

Why are some properties repeated when TRttiContext.GetType is called on a VCL Control?

穿精又带淫゛_ 提交于 2021-02-08 14:15:15
问题 Why are some properties repeated (such as Action and Align ) where others are not ( AlignWithMargins ) when TRttiContext.GetType is called on a VCL Control? uses System.RTTI, System.Generics.Collections, System.Generics.Defaults; //.... procedure TForm11.btnShowPropertiesClick(Sender: TObject); var R: TRttiContext; Props: TArray<TRttiProperty>; Prop : TRttiProperty; begin memo1.Clear; R := TRttiContext.Create; Props := R.GetType(Sender.ClassType).GetProperties; //Sort properties by name

Why are some properties repeated when TRttiContext.GetType is called on a VCL Control?

﹥>﹥吖頭↗ 提交于 2021-02-08 14:14:28
问题 Why are some properties repeated (such as Action and Align ) where others are not ( AlignWithMargins ) when TRttiContext.GetType is called on a VCL Control? uses System.RTTI, System.Generics.Collections, System.Generics.Defaults; //.... procedure TForm11.btnShowPropertiesClick(Sender: TObject); var R: TRttiContext; Props: TArray<TRttiProperty>; Prop : TRttiProperty; begin memo1.Clear; R := TRttiContext.Create; Props := R.GetType(Sender.ClassType).GetProperties; //Sort properties by name

Create a compile time key-to-type map which is filled by calls to a variadic function

懵懂的女人 提交于 2021-02-08 11:20:44
问题 Is it possible to create a key->type map at compile time, with each key-value being added when an instance of a variadic function is called? template <typename T, typename ... Args> void writeToQueue(Args... args) { //Do something with args. // Insert to map. something akin to: // CODEMAP[T] = Args... // T -> Args... mapped when foo<T,Args...> is called. } Or template <int code, typename ... Args> void writeToQueue(Args... args) { //Do something with args. // Insert to map. something akin to: