Questions tagged [rtti]

RTTI stands for Run-Time Type Information, it is also known as reflection; it allows access to compile-time data at run-time.

RTTI refers to the ability of the system to report on the dynamic type of an object and to provide information about that type at runtime (as opposed to at compile time). When utilized consistently, it can be a powerful tool to ease the work of the programmer in managing resources, or as the basis for writing reflective code. Further explanation can be found on Wikipedia

824 questions
-1
votes
1 answer

Finding out if a std::type_info object is a subtype of another std::type_info object in C++

I have two pointers std::type_info t1 and std::type_info t2. How can I find out if t1 is a subtype of t2? I have no other information available.
SHolz
  • 1
-1
votes
2 answers

C++Type inspection

I have a c++ class: Class farm { ... protected: vector workers; }; //ff_node an abstract method representing a single thread class ff_node { protected: //svc is the method to encapsulate a sequential function void* svc(void…
nosmaS
  • 23
  • 4
-1
votes
1 answer

RTTI, general solution , reuse code from other so thread

This function should convert a solution given at: eval fields of a record into a reuseable function. Actually this code below does not compile and I have no idea how to get it functional ... procedure EnumerateFieldandValues(const m: TObject;…
user1769184
  • 1,571
  • 1
  • 19
  • 44
-2
votes
1 answer

-frtti has no effect to "undefined reference to typeinfo" but -fno-rtti does

In my code, I implements a class inherits a derived class (class QualityOfBrightness in ) from a third library.(https://github.com/SeetaFace6Open/index) If my code is compiled with -frtti or no options, it will throw…
sixsixqaq
  • 39
  • 6
-2
votes
2 answers

Why doesn't C++ destruct the object by run-time type?

As I know C++ can get the accurate information of object's dynamic type when base class has a virtual function. class Base { public: Base() {} ~Base() { std::cout << "Base Destructed" << std::endl; } virtual void f() {} }; class…
Rhysol
  • 481
  • 1
  • 3
  • 12
-2
votes
2 answers

Access violation RTTI dumping record containing record pointers

uses RTTI; type TMyRecord = packed record name : String[20]; age : Integer; end; type TMasterCtrl = packed record MyRecord: ^TMyRecord; // Error can be avoided by changing to `MyRecord: Pointer;` end; procedure RTTIDump(Instance,…
wittrup
  • 1,535
  • 1
  • 13
  • 23
-2
votes
1 answer

RTTI and DevExpress

I'm trying to get and set some property values on VCL components. Some are DevExpress and some are not. I have wrtiten a small helper class: type RttiHelper = class strict private public class function GetPropertyValue(const aObject:…
Jens Borrisholt
  • 6,174
  • 1
  • 33
  • 67
-2
votes
1 answer

Checking if object is instanceof Class in function, which takes Class as parameter

I am learning RTTI in Java and I wrote a function like that: static void select(Shape s, Class c) { if(s instanceof c) s.setSelected(true); } //Calling function: select(shape0, Circle); The problem is, I have no idea if passing Class as…
Bouncer00
  • 123
  • 1
  • 4
  • 12
-2
votes
1 answer

Lazarus. How to invoke inherited method of dynamically created instance?

I've searched this and that and didn't find my situation. I have some variable of a type TCustomControl: var fcontrol:TCustomControl; Then I use some RTTI magic to create instance of different classes-descendants of TCustomControl: constructor…
-2
votes
1 answer

Delphi Making Component From a TForm object

I have a added components on a form object dynamically Edit1 := TEdit.Create(form3); I have got the object form3 of Tform class. Now what i want to do is I want to create a component template of form3 so that I can just drag and drop that…
-3
votes
1 answer

Transform a string to an object pointer?

I have a string 'MyButton'. How can I get the OBJECT MyButton from the STRING 'MyButton', so that I could write: MyButton.Caption := 'My new Caption'; This would change the caption of the TButton MyButton object instance.
user1580348
  • 5,721
  • 4
  • 43
  • 105
-3
votes
1 answer

Get a list of all TStrings properties

I'm trying to find all Properties with a TStrings descendant type on an Object. Here is what I've tried sofar: Place a Memo and a Chart on a form and then this code. procedure TForm1.FormCreate(Sender: TObject); var aObject: TObject; begin for…
Jens Borrisholt
  • 6,174
  • 1
  • 33
  • 67
-4
votes
1 answer

Effort to emulate Rtti.pas to Delphi versions prior to D2009 resource needed

I'm looking for Delphi resources related to any effort to emulate hopefully a substantive subset of the new Rtti.pas unit like ThorRtti. Edit: I edited the initial post (header,body and tag) because using backport is misleading and not appropriate…
menjaraz
  • 7,551
  • 4
  • 41
  • 81
-4
votes
2 answers

How to detect whether a TWinControl has a FONT property?

I need to change the FONT property of controls collected via the Controls property of a container control: for i := 0 to ContainerControl.ControlCount - 1 do begin ContainerControl.Controls[i].Font.Size := 8; // error end; For this, I would…
user1580348
  • 5,721
  • 4
  • 43
  • 105
1 2 3
54
55