System.SysUtils.TMarshaller

From RAD Studio API Documentation
Jump to: navigation, search

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);
};

Properties

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

Description

TMarshaller is a record that facilitates working with memory buffers.

TMarshaller is a high-level API for marshalling arguments. It disposes of itself, and when disposed of, frees any buffers allocated for copying arguments.

TMarshaller introduces many functions and procedures to:

  • Allocate memory buffers.
  • Release memory buffers.
  • Access strings through wrapped pointers.

See Also