System.Rtti.TRttiContext
Delphi
TRttiContext = record
private
FContextToken: IInterface;
{$HINTS OFF}
private class var
FGlobalContextCounter: Integer;
FGlobalContextToken: IInterface;
{$HINTS ON}
public
class function Create: TRttiContext; static;
procedure Free;
class procedure KeepContext; static;
class procedure DropContext; static;
function GetType(ATypeInfo: Pointer): TRttiType; overload;
function GetType(AClass: TClass): TRttiType; overload;
function GetTypes: TArray<TRttiType>;
function FindType(const AQualifiedName: string): TRttiType;
function GetPackages: TArray<TRttiPackage>;
end;
C++
struct DECLSPEC_DRECORD TRttiContext
{
private:
System::_di_IInterface FContextToken;
static int FGlobalContextCounter;
static System::_di_IInterface FGlobalContextToken;
public:
static TRttiContext __fastcall Create();
void __fastcall Free();
static void __fastcall KeepContext();
static void __fastcall DropContext();
TRttiType* __fastcall GetType(void * ATypeInfo)/* overload */;
TRttiType* __fastcall GetType(System::TClass AClass)/* overload */;
#ifndef _WIN64
System::DynamicArray<TRttiType*> __fastcall GetTypes();
#else /* _WIN64 */
System::TArray__1<TRttiType*> __fastcall GetTypes();
#endif /* _WIN64 */
TRttiType* __fastcall FindType(const System::UnicodeString AQualifiedName);
#ifndef _WIN64
System::DynamicArray<TRttiPackage*> __fastcall GetPackages();
#else /* _WIN64 */
System::TArray__1<TRttiPackage*> __fastcall GetPackages();
#endif /* _WIN64 */
private:
};
プロパティ
種類 | 可視性 | ソース | ユニット | 親 |
---|---|---|---|---|
record struct |
public | System.Rtti.pas System.Rtti.hpp |
System.Rtti | System.Rtti |
説明
TRttiContext は、Rtti ユニットに不可欠なものです。
TRttiContext インスタンスを取得して使用すると、アプリケーション内のすべての public 型と関連付けられたパッケージに関する型情報にアクセスできます。アプリケーションで実際に作成できる TRttiContext インスタンスは、1 つだけです。
TRttiContext は、別の RTTI 情報を表す TRttiObject インスタンスを取得できる、メソッドとプロパティを公開します。これらすべての TRttiObject インスタンスは、内部でキャッシュされ、アプリケーションが終了するときに解放されます。
関連項目
コード サンプル