System.Rtti.TValue

De RAD Studio API Documentation
Aller à : navigation, rechercher

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 operator Implicit(const VarRec: TVarRec): TValue; inline;
    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;
    class function FromVarRec(const VarRec: TVarRec): 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 AsVarRec: TVarRec;
    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::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);
    TValue& __fastcall operator=(const System::UnicodeString Value) { *this = TValue::_op_Implicit(Value); return *this; };
    static TValue __fastcall _op_Implicit(int Value);
    TValue& __fastcall operator=(int Value) { *this = TValue::_op_Implicit(Value); return *this; };
    static TValue __fastcall _op_Implicit(float Value);
    TValue& __fastcall operator=(float Value) { *this = TValue::_op_Implicit(Value); return *this; };
    static TValue __fastcall _op_Implicit(double Value);
    TValue& __fastcall operator=(double Value) { *this = TValue::_op_Implicit(Value); return *this; };
    static TValue __fastcall _op_Implicit(System::Extended Value);
    TValue& __fastcall operator=(System::Extended Value) { *this = TValue::_op_Implicit(Value); return *this; };
    static TValue __fastcall _op_Implicit(System::Currency Value);
    TValue& __fastcall operator=(System::Currency Value) { *this = TValue::_op_Implicit(Value); return *this; };
    static TValue __fastcall _op_Implicit(__int64 Value);
    TValue& __fastcall operator=(__int64 Value) { *this = TValue::_op_Implicit(Value); return *this; };
    static TValue __fastcall _op_Implicit(unsigned __int64 Value);
    TValue& __fastcall operator=(unsigned __int64 Value) { *this = TValue::_op_Implicit(Value); return *this; };
    static TValue __fastcall _op_Implicit(System::TObject* Value);
    TValue& __fastcall operator=(System::TObject* Value) { *this = TValue::_op_Implicit(Value); return *this; };
    static TValue __fastcall _op_Implicit(System::TClass Value);
    TValue& __fastcall operator=(System::TClass Value) { *this = TValue::_op_Implicit(Value); return *this; };
    static TValue __fastcall _op_Implicit(bool Value);
    TValue& __fastcall operator=(bool Value) { *this = TValue::_op_Implicit(Value); return *this; };
    static TValue __fastcall _op_Implicit(const System::TVarRec &VarRec);
    TValue& __fastcall operator=(const System::TVarRec &VarRec) { *this = TValue::_op_Implicit(VarRec); return *this; };
    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, const TValue *Values, const int Values_High);
    static TValue __fastcall FromVarRec(const System::TVarRec &VarRec);
    __property System::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);
    System::TVarRec __fastcall AsVarRec(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() {}
};

Propriétés

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

Description

Représente une version légère du type Variant.

TValue est une structure de données qui peut stocker différentes sortes de types de données. TValue est utilisé dans l'unité Rtti pour faciliter l'accès aux champs et aux paramètres des méthodes.

Voir aussi