System.SysUtils.TMarshaller

De RAD Studio API Documentation
Aller à : navigation, rechercher

Delphi

TMarshaller = record

C++

struct DECLSPEC_DRECORD TMarshaller
{
private:
    struct TDisposeRec;
    typedef TDisposeRec *PDisposeRec;
    typedef void __fastcall (*TDisposeProc)(PDisposeRec Args);
    struct DECLSPEC_DRECORD TDisposeRec
    {
    public:
        TMarshaller::TDisposeProc Proc;
        System::TObject* Obj;
        System::NativeInt Arg1;
        System::NativeInt Arg2;
    };
    __interface DELPHIINTERFACE IDisposer;
    typedef System::DelphiInterface<IDisposer> _di_IDisposer;
    __interface IDisposer  : public System::IInterface
    {
        virtual void __fastcall AddDispose(const TMarshaller::TDisposeRec &Rec) = 0 ;
        virtual void __fastcall RemoveDispose(const TMarshaller::TDisposeRec &Rec) = 0 ;
        virtual void __fastcall Flush() = 0 ;
    };
    class DELPHICLASS TDisposer;
#ifndef _WIN64
    #pragma pack(push,4)
#endif /* not _WIN64 */
    class PASCALIMPLEMENTATION TDisposer : public System::TInterfacedObject
    {
        typedef System::TInterfacedObject inherited;
    private:
        System::StaticArray<TMarshaller::TDisposeRec, 4> FInline;
        System::DynamicArray<TMarshaller::TDisposeRec> FOverflow;
        int FCount;
        void __fastcall AddDispose(const TMarshaller::TDisposeRec &Rec);
        void __fastcall RemoveDispose(const TMarshaller::TDisposeRec &Rec);
        void __fastcall Flush();
    public:
        __fastcall virtual ~TDisposer();
    public:
        /* TObject.Create */ inline __fastcall TDisposer() : System::TInterfacedObject() { }
private:
        void *__TMarshaller_IDisposer;	// TMarshaller::IDisposer
public:
        operator TMarshaller::IDisposer*(void) { return (TMarshaller::IDisposer*)&__TMarshaller_IDisposer; }
    };
#ifndef _WIN64
    #pragma pack(pop)
#endif /* not _WIN64 */
private:
    _di_IDisposer FDisposer;
    void __fastcall AddDispose(const TDisposeRec &Rec);
    template<typename T> static void __fastcall DoUnfixArray(PDisposeRec Rec);
#ifndef _WIN64
    template<typename T> static TDisposeRec __fastcall MakeUnfixArray(System::TPtrWrapper Ptr);
#else /* _WIN64 */
    template<typename T> static TDisposeRec __fastcall MakeUnfixArray(const System::TPtrWrapper &Ptr);
#endif /* _WIN64 */
public:
    System::TPtrWrapper __fastcall InString(TStringBuilder* SB, int MaxLen);
    System::TPtrWrapper __fastcall OutString(const System::UnicodeString S);
    System::TPtrWrapper __fastcall InOutString(TStringBuilder* SB, int MaxLen);
    System::TPtrWrapper __fastcall AsAnsi(const System::UnicodeString S)/* overload */;
    System::TPtrWrapper __fastcall AsAnsi(System::WideChar * S)/* overload */;
    System::TPtrWrapper __fastcall AsAnsi(const System::UnicodeString S, System::Word CodePage)/* overload */;
    System::TPtrWrapper __fastcall AsAnsi(System::WideChar * S, System::Word CodePage)/* overload */;
    System::TPtrWrapper __fastcall AsUtf8(const System::UnicodeString S)/* overload */;
    System::TPtrWrapper __fastcall AsUtf8(System::WideChar * S)/* overload */;
    System::TPtrWrapper __fastcall AsRaw(const TBytes B);
    void __fastcall Flush();
    System::TPtrWrapper __fastcall AllocMem(System::NativeInt Size);
#ifndef _WIN64
    System::TPtrWrapper __fastcall ReallocMem(System::TPtrWrapper OldPtr, System::NativeInt NewSize);
#else /* _WIN64 */
    System::TPtrWrapper __fastcall ReallocMem(const System::TPtrWrapper &OldPtr, System::NativeInt NewSize);
#endif /* _WIN64 */
    template<typename T> System::TPtrWrapper __fastcall FixArray(System::DynamicArray<T> Arr);
    System::TPtrWrapper __fastcall FixString(System::UnicodeString &Str);
    System::TPtrWrapper __fastcall UnsafeFixString(const System::UnicodeString Str);
    System::TPtrWrapper __fastcall AllocStringAsAnsi(const System::UnicodeString Str)/* overload */;
    System::TPtrWrapper __fastcall AllocStringAsAnsi(const System::UnicodeString Str, System::Word CodePage)/* overload */;
    System::TPtrWrapper __fastcall AllocStringAsUtf8(const System::UnicodeString Str)/* overload */;
    System::TPtrWrapper __fastcall AllocStringAsUnicode(const System::UnicodeString Str);
};

Propriétés

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

Description

TMarshaller est un enregistrement qui facilite le travail avec les tampons mémoire.

TMarshaller est une API de haut niveau pour le marshalling des arguments. Il s'élimine tout seul, et lorsqu'il est éliminé, il libère les tampons alloués à la copie d'arguments.

TMarshaller introduit de nombreuses fonctions et procédures pour :

  • Allouer les tampons mémoire.
  • Libérer les tampons mémoire.
  • Accéder à des chaînes via des pointeurs encapsulés.

Voir aussi