Skip to content

Instantly share code, notes, and snippets.

@jpluimers
Created September 25, 2013 14:52
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jpluimers/6700788 to your computer and use it in GitHub Desktop.
Save jpluimers/6700788 to your computer and use it in GitHub Desktop.
TRttiTypeHelper
type
TRttiTypeHelper = class helper for TRttiType
function GetBestName(): string; virtual;
function GetUnitName(): string; virtual;
end;
function TRttiTypeHelper.GetBestName(): string;
begin
// you cannot ask for QualifiedName on a non-public RttiType
if Self.IsPublicType then
Result := Self.QualifiedName
else
Result := Self.Name;
end;
function TRttiTypeHelper.GetUnitName(): string;
begin
Result := Copy(QualifiedName, 1, Length(QualifiedName) - Length(Name) - 1);
end;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment