Questions tagged as 'rtti'

1
answer

How to traverse a property of type TObjectList via Rtti?

My class has a property of type TObjectList: TBaseModelo = class(TInterfacedPersistent) public property ListaCamposValidacao: TObjectList<TCampoValidacao> read FListaCamposValidacao write FListaCamposValidacao; end; I need, throug...
asked by 26.11.2014 / 18:12
1
answer

How to get the value of a property and how to get the property where the attribute is declared?

Let's say I'm creating an Attribute like this: TCompareAttribute = class(TCustomAttribute) private FPropertyToCompare: string; public constructor Create(APropertyToCompare: string); function IsValid: boolean; end; implementation ... fu...
asked by 25.02.2015 / 15:18
1
answer

Delphi RTTI get the property value of an object that is owned by another

I am wondering how to get, via RTTIT, the value of a property of an object that is owned by another. Below are two objects and their relationships. In this example I would like to get the value of S of P1 . TPropriedade = class st...
asked by 30.06.2017 / 21:53
0
answers

Execute a method via typeInfo

I'm studying RTTI in Lazarus and ran into a problem, trying to run procedure Clear; . I used the GetMethodProp function, as recommended in the Lazarus documentation, but the strange thing is that this method has as parameters an obj...
asked by 14.03.2018 / 13:10
1
answer

How to remove the executable class name without losing dynamic_cast?

My goal is to just remove the executable classes name, but still continue with the ability to use dynamic_cast . The problem is that if RTTI is removed, and thus the class names, there is no substitute for dynamic_cast . I have tr...
asked by 10.01.2017 / 16:30
1
answer

RTTI Free on an object created by Invoke

I am creating a routine to instantiate a class via RTTI and validate if this class implements a interface . I have a test class implemented as follows: unit teste.classeTeste.uclasseTeste; interface uses validador; type Cla...
asked by 26.01.2016 / 11:47
3
answers

How a class can inherit from one interface and another class in Delphi

I am creating a small persistence class using RTTI. I created the attributes of the fields separated by type Ex: FieldString [], FieldInteger [], and so on. At some point I need to go through the attributes to find a particular field, and that's...
asked by 27.07.2015 / 18:53