System.TPtrWrapper

De RAD Studio API Documentation
Aller à : navigation, rechercher

Delphi

  TPtrWrapper = record
  private
    Value: PByte;
    class function GetNilValue: TPtrWrapper; inline; static;
  public
    constructor Create(AValue: NativeInt); overload;
    constructor Create(AValue: Pointer); overload;
    function ToPointer: Pointer;
    function ToInteger: NativeInt;
    class property NilValue: TPtrWrapper read GetNilValue;
    class operator Equal(Left, Right: TPtrWrapper): Boolean;
    class operator NotEqual(Left, Right: TPtrWrapper): Boolean;
  end;

C++

struct DECLSPEC_DRECORD TPtrWrapper
{
private:
    Byte *Value;
    static TPtrWrapper __fastcall GetNilValue();
public:
    __fastcall TPtrWrapper(NativeInt AValue)/* overload */;
    __fastcall TPtrWrapper(void * AValue)/* overload */;
    void * __fastcall ToPointer();
    NativeInt __fastcall ToInteger();
    /* static */ __property TPtrWrapper NilValue = {read=GetNilValue};
#ifndef _WIN64
    static bool __fastcall _op_Equality(TPtrWrapper Left, TPtrWrapper Right);
    static bool __fastcall _op_Inequality(TPtrWrapper Left, TPtrWrapper Right);
#else /* _WIN64 */
    static bool __fastcall _op_Equality(const TPtrWrapper &Left, const TPtrWrapper &Right);
    static bool __fastcall _op_Inequality(const TPtrWrapper &Left, const TPtrWrapper &Right);
#endif /* _WIN64 */
    TPtrWrapper() {}
#ifndef _WIN64
    friend bool operator ==(TPtrWrapper Left, TPtrWrapper Right) { return TPtrWrapper::_op_Equality(Left, Right); }
    friend bool operator !=(TPtrWrapper Left, TPtrWrapper Right) { return TPtrWrapper::_op_Inequality(Left, Right); }
#else /* _WIN64 */
    friend bool operator ==(const TPtrWrapper &Left, const TPtrWrapper &Right) { return TPtrWrapper::_op_Equality(Left, Right); }
    friend bool operator !=(const TPtrWrapper &Left, const TPtrWrapper &Right) { return TPtrWrapper::_op_Inequality(Left, Right); }
#endif /* _WIN64 */
};

Propriétés

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

Description

TPtrWrapper est une valeur de taille pointeur représentant un pointeur.

TPtrWrapper a la même taille qu'un pointeur. Il a été conçu de façon à être utilisé à l'emplacement où un pointeur apparaîtrait dans une déclaration API, afin d'éviter les transtypages en arrière.

Ce pointeur encapsulé est utilisé dans le processus de marshalling et est appliqué par les API de bas niveau TMarshal et de haut niveau TMarshaller.

Voir aussi