user401247
user401247

Reputation:

Use of Rtti ParamType

Assume we have the following code fragment:

TMyType = Pointer;

TMyClass = class
    procedure myMethod (argument : TMyType);
end;

I've been using Rtti to reflect on such a class so that I can write out the method signature including the argument type. However when I use Rtti on this I get:

TMyClass = class
    procedure myMethod (argument : Pointer);
end;

That is instead of getting the name TMyType, I get Pointer. I am using ParamType.name to get the name of the argument type.

My question is, is there anyway to get the name of the type the developer actually declared the argument to be, ie TMyType? Since ParamType.name doesn't return the expected type name I am assuming that types that are not declared in a class have no Rtti information?

Using Delphi XE

Upvotes: 2

Views: 171

Answers (1)

user401247
user401247

Reputation:

Sertac Akyuz and Remy Lebeau both answered the question. I provide the answer below:

Declare a type instead of an alias TMytype = type Pointer

Upvotes: 2

Related Questions