Buffer.this

Creates a new #SoupBuffer containing @length bytes from @data. When the #SoupBuffer is freed, it will call @owner_dnotify, passing @owner to it. You must ensure that @data will remain valid until @owner_dnotify is called.

For example, you could use this to create a buffer containing data returned from libxml without needing to do an extra copy:

<informalexample><programlisting> xmlDocDumpMemory (doc, &xmlbody, &len); return soup_buffer_new_with_owner (xmlbody, len, xmlbody, (GDestroyNotify)xmlFree); </programlisting></informalexample>

In this example, @data and @owner are the same, but in other cases they would be different (eg, @owner would be a object, and @data would be a pointer to one of the object's fields).

  1. this(SoupBuffer* soupBuffer, bool ownedRef)
  2. this(SoupMemoryUse use, ubyte[] data)
  3. this(char[] data)
  4. this(ubyte[] data, void* owner, GDestroyNotify ownerDnotify)
    class Buffer
    this
    (
    ubyte[] data
    ,
    void* owner
    ,
    GDestroyNotify ownerDnotify
    )

Parameters

data ubyte[]

data

owner void*

pointer to an object that owns @data

ownerDnotify GDestroyNotify

a function to free/unref @owner when the buffer is freed

Return Value

the new #SoupBuffer.

Throws

ConstructionException GTK+ fails to create the object.

Meta