Created
September 25, 2013 14:52
-
-
Save jpluimers/6700788 to your computer and use it in GitHub Desktop.
TRttiTypeHelper
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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