Struct
VipsBuf
Description [src]
struct VipsBuf {
/* No available fields */
}
A message buffer you can append stuff to safely and quickly. If the message gets too long, you get “…” and truncation. Message buffers can be on the stack or heap.
For example:
char txt[256];
VipsBuf buf = VIPS_BUF_STATIC(txt);
int i;
vips_buf_appends(&buf, "Numbers are: ");
for (i = 0; i < array_length; i++) {
if (i > 0)
vips_buf_appends(&buf, ", ");
vips_buf_appendg(&buf, array[i]);
}
printf("%s", vips_buf_all(&buf));
Instance methods
vips_buf_append_size
Turn a number of bytes into a sensible string … eg “12”, “12KB”, “12MB”, “12GB” etc.
vips_buf_appendd
Append a number. If the number is -ve, add brackets. Needed for building function arguments.
vips_buf_appendgv
Format and append a GValue
as a printable thing. We display text line “3144
bytes of binary data” for BLOBs like icc-profile-data.
vips_buf_appendns
Append at most sz
chars from str
to buf
. sz
< 0 means unlimited. This
is the low-level append operation: functions like vips_buf_appendf()
build
on top of this.
vips_buf_destroy
Destroy a buffer. Only needed for heap buffers. Leaves the buffer in the _init state.
vips_buf_init_dynamic
Initialise and attach to a heap memory area. The memory area needs to be at least 4 bytes long.
vips_buf_init_static
Initialise and attach to a static memory area. VIPS_BUF_STATIC()
is usually
more convenient.
vips_buf_set_dynamic
Attach the buffer to a heap memory area. The buffer needs to have been initialised. The memory area needs to be at least 4 bytes long.
vips_buf_set_static
Attach the buffer to a static memory area. The buffer needs to have been initialised. The memory area needs to be at least 4 bytes long.