Buffer

A data buffer, generally used to represent a chunk of a #SoupMessageBody.

@data is a #char because that's generally convenient; in some situations you may need to cast it to #guchar or another type.

Constructors

this
this(SoupBuffer* soupBuffer, bool ownedRef)

Sets our main struct and passes it to the parent class.

this
this(SoupMemoryUse use, ubyte[] data)

Creates a new #SoupBuffer containing @length bytes from @data.

this
this(char[] data)

Creates a new #SoupBuffer containing @length bytes from @data.

this
this(ubyte[] data, void* owner, GDestroyNotify ownerDnotify)

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.

Destructor

~this
~this()
Undocumented in source.

Members

Functions

copy
Buffer copy()

Makes a copy of @buffer. In reality, #SoupBuffer is a refcounted type, and calling soup_buffer_copy() will normally just increment the refcount on @buffer and return it. However, if @buffer was created with #SOUP_MEMORY_TEMPORARY memory, then soup_buffer_copy() will actually return a copy of it, so that the data in the copy will remain valid after the temporary buffer is freed.

free
void free()

Frees @buffer. (In reality, as described in the documentation for soup_buffer_copy(), this is actually an "unref" operation, and may or may not actually free @buffer.)

getAsBytes
Bytes getAsBytes()

Creates a #GBytes pointing to the same memory as @buffer. The #GBytes will hold a reference on @buffer to ensure that it is not freed while the #GBytes is still valid.

getBufferStruct
SoupBuffer* getBufferStruct(bool transferOwnership)

Get the main Gtk struct

getData
void getData(ubyte[] data)

This function exists for use by language bindings, because it's not currently possible to get the right effect by annotating the fields of #SoupBuffer.

getOwner
void* getOwner()

Gets the "owner" object for a buffer created with soup_buffer_new_with_owner().

getStruct
void* getStruct()

the main Gtk struct as a void*

newSubbuffer
Buffer newSubbuffer(size_t offset, size_t length)

Creates a new #SoupBuffer containing @length bytes "copied" from @parent starting at @offset. (Normally this will not actually copy any data, but will instead simply reference the same data as @parent does.)

Properties

data
void* data [@property getter]
void* data [@property setter]

the data

length
size_t length [@property getter]
size_t length [@property setter]

length of @data

Static functions

getType
GType getType()

Variables

ownedRef
bool ownedRef;
Undocumented in source.
soupBuffer
SoupBuffer* soupBuffer;

the main Gtk struct

Meta