the data
length of data
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.
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
.)
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.
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.
Gets the "owner" object for a buffer created with soup_buffer_new_with_owner().
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.)
offset within parent
to start at
number of bytes to copy from parent
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:
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).
data
pointer to an object that owns data
a function to free/unref owner
when the buffer is freed
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.