rtti

trying to count instances of deriving classes, type_id doesnt work

first of all i think its a crapy design , but im trying to prove a point. i want to count all the instances of derivers from my class, im trying to do it like so: .h file: #ifndef _Parant #define _Parant #include<map> class Parant { public: Parant(); virtual ~Parant(); static void PrintInstances(); private: static v...

Delphi: At runtime find classes that descend from a given base class?

Is there at way, at runtime, to find all classes that descend from a particular base class? For example, pretend there is a class: TLocalization = class(TObject) ... public function GetLanguageName: string; end; or pretend there is a class: TTestCase = class(TObject) ... public procedure Run; virtual; end; or pretend there i...

Getting the Unit Name wich belongs to any type (TRttiType)

I need to get the name of the unit (namespace) of any TRttiType. so far, I have tried the following. 1) using the PTypeData.UnitName, this solution works, but only when the TTypeKind is tkClass. procedure ListAllUnits; var ctx : TRttiContext; lType: TRttiType; Units: TStrings; begin Units:=TStringList.Create; try ctx :...

How Determine if a TRttiMethod is a function

I need determine if a TRttiMethod is a function so far, i wrote this function Function IsFunction(QualifiedName,MethodName:string):Boolean; Var ctx : TRttiContext; lType : TRttiType; lMethod : TRttiMethod; Begin result:=false; ctx := TRttiContext.Create; lType:=ctx.FindType(QualifiedName); if Assigned(lType)...

Why is std::type_info polymorphic?

Is there a reason why std::type_info is specified to be polymorphic? The destructor is specified to be virtual (and there's a comment to the effect of "so that it's polymorphic" in The Design and Evolution of C++). I can't really see a compelling reason why. I don't have any specific use case, I was just wondering if there ever was a rat...

Determine when a TRttiMethod is marked as overload, override or abstract

Is possible using the Rtti determine if a TRttiMethod is a marked as overload,override or abstract ? thanks in advance. ...

How can I list the Attributes of a property using the rtti?

I am currently using this code, but does not list anything. What I'm missing? program ListAttrs; {$APPTYPE CONSOLE} uses Rtti, SysUtils; type TPerson = class private FName: String; FAge: Integer; public [NonEmptyString('Must provide a Name')] property Name : String read FName write FName; [MinimumInteger...

How can this be implemented(elegantly) without using RTTI?

I was coding this up in C# and the quickest solution to come to mind used the "as" or "is" keywords. I began wondering how I could implement it neatly in C++(without RTTI)... or even in C# without the aforementioned keywords. Here is the problem (simplified): There is a class Command which contains a stream of so called "tokens". clas...

What is the easiest solution for transparent remoting with Delphi?

I have a two tier Delphi for Win32 application with a lot of business logic implemented in a god object I want to outsource into a separate service. This separate service should be accessed by multiple clients via TCP/IP telnet-style protocol. How do I go about making the transition most simple? Precisely, I'd like to keep this simplic...

delphi xe disable RTTI

i have use delphi xe recently but exe size is very big because of rtti(i think) howto remove rtti , and can i make my application size as small as delphi 2009 application(490 kb) without comprssion; and what is the use of rtti ...

Delphi 2010 RTTI : How to interegate/explore an enumeration containing custom attribute

I've created an enumeration utilizing a TCustomAttribute descendant class (TEnumAttribute) to give each enumeration additional data (if successful, it will drive a custom component that can interrogate an enumeration and populate itself accordingly). type TShoppingCartType = ( [TEnumAttribute(0, 'All')] sctAll, [TEnumA...