rtti

Why is type_info declared outside namespace std?

Hi, I'm using VS2005 and the MS implementation of STL. However, the class type_info in is declared outside of "namespace std". This creates some problems for third party libs that excepts to find a std::type_info. Why is this so, and is there any workaround? Here is a sample from the beginning of typeinfo: class type_info { ... }; _S...

how to set array length with delphi 2010 rtti

how to set array length in runtime ? setLength(t.GetProperty('Propertys'),3); ???? unit Unit3; interface uses Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms, Dialogs, StdCtrls; type TSubProperty = Class private Fitem2: Integer; Fitem1: String; proc...

Does using __declspec(novtable) on abstract base classes affect RTTI in any way?

Or, are there any other known negative affects of employing __declspec(novtable)? I can't seem to find references to any issues. ...

CException::`RTTI Complete Object Locator in VC++ Application

HI I seem to be getting an CException::`RTTI Complete Object Locator exception once in a while in my VC++ application. Does any of u know why this particular exception occurs. i get this when calling the GetLocaleInfo() WINDOWS API. Any help would be great. Thanks ...

When can typeid return different type_info instances for same type?

Andrei Alexandrescu writes in Modern C++ Design: The objects returned by typeid have static storage, so you don't have to worry about lifetime issues. Andrei continues: The standard does not guarantee that each invocation of, say, typeid(int) returns a reference to the same type_info object. Even though the standard...

C++ RTTI and Derived Classes

My C++ is a bit rusty. Here's what I'm attempting to do: class Cmd { }; class CmdA : public Cmd { }; class CmdB : public Cmd { }; ... Cmd *a = new CmdA (); Cmd *b = new CmdB (); First problem: cout << typeid (a).name () cout << typeid (b).name () both return Cmd * types. My desired result is CmdA* and CmdB*. Any way of accomplis...

Which Design Pattern / RTTI

I'm looking for the best way to dispatch objects to the correct "target" object. I have a base command class: Cmd, two sub-classes: BufferCmd and StateCmd. Command "GotoLine" is derived from BufferCmd and "ChangeCmd" is derived from StateCmd. BufferCmds are intended to go to a Buffer class and StateCmds are intended to go to a State o...

generalized request function in DataSnap 2010 ?!?

This is a client-side function i'm trying to build, more generalized, which will allow me to call different server-side procedures which return TDBXReader. Right now it works, BUT i'm facing couple of problems and i need your help: (most important) what do you think about this aproach ? any suggestions/advices ? how can i free the vLCl...

Creating a new object from dynamic type info

In C++, is there any way to query the type of an object and then use that information to dynamically create a new object of the same type? For example, say I have a simple 3 class hierarchy: class Base class Foo : public Base class Bar : public Base Now suppose I give you an object cast as type Base -- which is in reality of type Foo...

Boost library for RTTI

Hi, which boost library should I use to implement RTTI in my project?? Is it Statechart library? Thanks and Regards, Jabez. ...

How can I set the $RTTI directive for the entire project?

I'm working on migrating an old project from Delphi 2007 to Delphi 2010. One thing I've found is that the resulting executable has more than doubled in size, and the original was already quite big. (Over 50 MB.) I suspect that a lot of it has to do with extended RTTI. Since the project predates Delphi 2010, it doesn't use extended RT...

Can I ungarble GCC's RTTI names?

On my Ubuntu computer, when I ask for an object/variable's type using typeid, I get a weird-looking name using the type_info::name method. (By "weird" I mean that it's different from what I'd expect to get on Windows.) I Googled around a bit, and found out that RTTI names are implementation-specific. Problem is, I want to get a type's n...

What's the lifetime of memory pointed to typeinfo::name()?

In C++ I can use typeid operator to retrieve the name of any polymorphic class: const char* name = typeid( CMyClass ).name(); How long will the string pointed to by the returned const char* pointer available to my program? ...

Howto set event handlers with arbitrary type with RTTI in Delphi 2010 ?

Hi, after reading the post How to set event handlers via new RTTI?, I wonder if it is possible to solve this more dynamically. For example I want to set ALL event handlers of any component to nil. Using TValue.From <TNotifyEvent> (SomeMethod) does not work for two reasons: 1. The type is unknown (could be TNotifyEvent, TMouseEvent etc....

Delphi 2010 RTTI : Explore Enumerations

Hi, Considering such an enumeration : type TTypeOfData = ( [XmlName('ABC')] todABC, [XmlName('DEF')] todDEF, [XmlName('GHI')] todGHI ); Where XmlName is a custom attribute used to define the serialization string for members of this enumeration. How can I explore the attributes attached to each member of this enumer...

no RTTI on unamed data types

Hi, AFAIK the compiler does not generate RTTI if the type is not named. eg: T = array[0..1,0..1] of Integer; In this case it is possible to know the total size of the array, but it is impossible to know the size of each dimension. It works only if I use a type explicitly named: T01 = 0..1; T = array[T01,T01] of Integer; I missed somet...

Delphi 2010 RTTI : Use TValue to store data

Hi, I would like to be able to use TValue to store Data in a TList<>. Like in : type TXmlBuilder = class type TXmlAttribute = class Name: String; Value: TValue; // TValue comes from Rtti end; TXmlNode = class Name: String; Parent: TXmlNode; Value: TXmlNode; Attributes: TList<TXmlAttr...

How to set NULL to Variant field using rtti

Hi, I have a problem setting null to a variant field using rtti. Suppose I have class like this: TClass1 = class Field1:Integer; Field2:Variant; end; when I get access to a Field1 I can do: Field.SetValue(TObject(ValueObject.AsObject), 1); but it seems I can not do this with Field2: Field.SetValue(TObject(ValueObject.AsOb...

Enumerate all Delphi classes that implement a given interface?

With the new extended RTTI in Delphi 2010, can a Delphi application (at run time) build a list of all classes which implement a given interface? ...

Why should I care about RTTI in Delphi?

I've heard a lot about the new/improved RTTI capabilities of Delphi 2010, but I must admit my ignorance...I don't understand it. I know every version of Delphi has supported RTTI...and I know that RTTI (Runtime Type Information) allows me to access type information while my application is running. But what exactly does that mean? Is Del...