System.Rtti.TValue

From RAD Studio API Documentation
Jump to: navigation, search

Delphi

  TValue = record
  private
    function GetIsEmpty: Boolean;
    function GetTypeInfo: PTypeInfo;
    function GetTypeKind: TTypeKind;
    function GetTypeDataProp: PTypeData;
    function GetDataSize: Integer;
    constructor Create(ATypeInfo: PTypeInfo);
    class function GetEmpty: TValue; static;
    procedure Get<T>(out Result: T);
  public
    class operator Implicit(const Value: string): TValue;
    class operator Implicit(Value: Integer): TValue;
    class operator Implicit(Value: Single): TValue;
    class operator Implicit(Value: Double): TValue;
    class operator Implicit(Value: Extended): TValue;
    class operator Implicit(Value: Currency): TValue;
    class operator Implicit(Value: Int64): TValue;
    class operator Implicit(Value: UInt64): TValue;
    class operator Implicit(Value: TObject): TValue;
    class operator Implicit(Value: TClass): TValue;
    class operator Implicit(Value: Boolean): TValue;
    class function FromVariant(const Value: Variant): TValue; static;
    class function From<T>(const Value: T): TValue; static;
    class function FromOrdinal(ATypeInfo: PTypeInfo; AValue: Int64): TValue; static;
    class function FromArray(ArrayTypeInfo: PTypeInfo; const Values: array of TValue): TValue; static;
    property Kind: TTypeKind read GetTypeKind;
    property TypeInfo: PTypeInfo read GetTypeInfo;
    property TypeData: PTypeData read GetTypeDataProp;
    property IsEmpty: Boolean read GetIsEmpty;
    function IsObject: Boolean;
    function AsObject: TObject;
    function IsInstanceOf(AClass: TClass): Boolean;
    function IsClass: Boolean;
    function AsClass: TClass;
    function IsOrdinal: Boolean;
    function AsOrdinal: Int64;
    function TryAsOrdinal(out AResult: Int64): Boolean;
    function IsType<T>: Boolean; overload;
    function IsType(ATypeInfo: PTypeInfo): Boolean; overload;
    function AsType<T>: T;
    function TryAsType<T>(out AResult: T): Boolean;
    function Cast<T>: TValue; overload;
    function Cast(ATypeInfo: PTypeInfo): TValue; overload;
    function TryCast(ATypeInfo: PTypeInfo; out AResult: TValue): Boolean;
    function AsInteger: Integer;
    function AsBoolean: Boolean;
    function AsExtended: Extended;
    function AsInt64: Int64;
    function AsUInt64: UInt64;
    function AsInterface: IInterface;
    function AsString: string;
    function AsVariant: Variant;
    function AsCurrency: Currency;
    function IsArray: Boolean;
    function GetArrayLength: Integer;
    function GetArrayElement(Index: Integer): TValue;
    procedure SetArrayElement(Index: Integer; const AValue: TValue);
    class procedure Make(ABuffer: Pointer; ATypeInfo: PTypeInfo; out Result: TValue); overload; static;
    class procedure Make(AValue: NativeInt; ATypeInfo: PTypeInfo; out Result: TValue); overload; static;
    class procedure MakeWithoutCopy(ABuffer: Pointer; ATypeInfo: PTypeInfo; out Result: TValue); overload; static;
    property DataSize: Integer read GetDataSize;
    procedure ExtractRawData(ABuffer: Pointer);
    procedure ExtractRawDataNoCopy(ABuffer: Pointer);
    function GetReferenceToRawData: Pointer;
    function GetReferenceToRawArrayElement(Index: Integer): Pointer;
    class property Empty: TValue read GetEmpty;
    function ToString: string;
  private
    FData: TValueData;
  end;

C++

struct __declspec(delphirecord) TValue
{
private:
    bool __fastcall GetIsEmpty(void);
    System::Typinfo::PTypeInfo __fastcall GetTypeInfo(void);
    System::Typinfo::TTypeKind __fastcall GetTypeKind(void);
    System::Typinfo::PTypeData __fastcall GetTypeDataProp(void);
    int __fastcall GetDataSize(void);
protected:
    __fastcall TValue(System::Typinfo::PTypeInfo ATypeInfo);
private:
    static TValue __fastcall GetEmpty();
    template<typename T> void __fastcall Get(/* out */ T &Result);
public:
    static TValue __fastcall _op_Implicit(const System::UnicodeString Value);
    static TValue __fastcall _op_Implicit(int Value);
    static TValue __fastcall _op_Implicit(float Value);
    static TValue __fastcall _op_Implicit(double Value);
    static TValue __fastcall _op_Implicit(System::Extended Value);
    static TValue __fastcall _op_Implicit(System::Currency Value);
    static TValue __fastcall _op_Implicit(__int64 Value);
    static TValue __fastcall _op_Implicit(unsigned __int64 Value);
    static TValue __fastcall _op_Implicit(System::TObject* Value);
    static TValue __fastcall _op_Implicit(System::TClass Value);
    static TValue __fastcall _op_Implicit(bool Value);
    static TValue __fastcall FromVariant(const System::Variant &Value);
    template<typename T> static TValue __fastcall From(const T Value);
    static TValue __fastcall FromOrdinal(System::Typinfo::PTypeInfo ATypeInfo, __int64 AValue);
    static TValue __fastcall FromArray(System::Typinfo::PTypeInfo ArrayTypeInfo, TValue const *Values, const int Values_High);
    __property System::Typinfo::TTypeKind Kind = {read=GetTypeKind};
    __property System::Typinfo::PTypeInfo TypeInfo = {read=GetTypeInfo};
    __property System::Typinfo::PTypeData TypeData = {read=GetTypeDataProp};
    __property bool IsEmpty = {read=GetIsEmpty};
    bool __fastcall IsObject(void);
    System::TObject* __fastcall AsObject(void);
    bool __fastcall IsInstanceOf(System::TClass AClass);
    bool __fastcall IsClass(void);
    System::TClass __fastcall AsClass(void);
    bool __fastcall IsOrdinal(void);
    __int64 __fastcall AsOrdinal(void);
    bool __fastcall TryAsOrdinal(/* out */ __int64 &AResult);
    template<typename T> bool __fastcall IsType(void)/* overload */;
    bool __fastcall IsType(System::Typinfo::PTypeInfo ATypeInfo)/* overload */;
    template<typename T> T __fastcall AsType(void);
    template<typename T> bool __fastcall TryAsType(/* out */ T &AResult);
    template<typename T> TValue __fastcall Cast(void)/* overload */;
    TValue __fastcall Cast(System::Typinfo::PTypeInfo ATypeInfo)/* overload */;
    bool __fastcall TryCast(System::Typinfo::PTypeInfo ATypeInfo, /* out */ TValue &AResult);
    int __fastcall AsInteger(void);
    bool __fastcall AsBoolean(void);
    System::Extended __fastcall AsExtended(void);
    __int64 __fastcall AsInt64(void);
    unsigned __int64 __fastcall AsUInt64(void);
    System::_di_IInterface __fastcall AsInterface(void);
    System::UnicodeString __fastcall AsString(void);
    System::Variant __fastcall AsVariant(void);
    System::Currency __fastcall AsCurrency(void);
    bool __fastcall IsArray(void);
    int __fastcall GetArrayLength(void);
    TValue __fastcall GetArrayElement(int Index);
    void __fastcall SetArrayElement(int Index, const TValue &AValue);
    static void __fastcall Make(void * ABuffer, System::Typinfo::PTypeInfo ATypeInfo, /* out */ TValue &Result)/* overload */;
    static void __fastcall Make(NativeInt AValue, System::Typinfo::PTypeInfo ATypeInfo, /* out */ TValue &Result)/* overload */;
    static void __fastcall MakeWithoutCopy(void * ABuffer, System::Typinfo::PTypeInfo ATypeInfo, /* out */ TValue &Result)/* overload */;
    __property int DataSize = {read=GetDataSize};
    void __fastcall ExtractRawData(void * ABuffer);
    void __fastcall ExtractRawDataNoCopy(void * ABuffer);
    void * __fastcall GetReferenceToRawData(void);
    void * __fastcall GetReferenceToRawArrayElement(int Index);
    /* static */ __property TValue Empty = {read=GetEmpty};
    System::UnicodeString __fastcall ToString(void);
private:
    TValueData FData;
public:
    TValue() {}
};

Properties

Type Visibility Source Unit Parent
record
struct
public
System.Rtti.pas
System.Rtti.hpp
System.Rtti System.Rtti

Description

Represents a lightweight version of the Variant type.

TValue is a data structure that can store different kinds of data types. TValue is used in the Rtti unit to ease the access to fields and method parameters.

See Also