CattleBuffer

CattleBuffer — Memory buffer

Functions

Properties

gulong size Read / Write / Construct Only

Types and Values

struct CattleBuffer

Object Hierarchy

    GObject
    ╰── CattleBuffer

Includes

#include <cattle/cattle.h>

Description

A CattleBuffer represents a memory buffer.

Functions

cattle_buffer_new ()

CattleBuffer *
cattle_buffer_new (gulong size);

Create and initialize a new memory buffer.

Parameters

size

size of the buffer

 

Returns

a new CattleBuffer.

[transfer full]


cattle_buffer_set_contents ()

void
cattle_buffer_set_contents (CattleBuffer *buffer,
                            gint8 *contents);

Set the contents of a memory buffer.

The size of contents is assumed to be the same as the size of buffer .

[skip]

Parameters

buffer

a CattleBuffer

 

contents

data to copy inside the memory buffer.

[transfer none]

cattle_buffer_set_contents_full ()

void
cattle_buffer_set_contents_full (CattleBuffer *buffer,
                                 gint8 *contents,
                                 gulong size);

Set the contents of the memory buffer.

This method exists mainly for bindings; cattle_buffer_set_contents() is more convenient when writing C code.

[rename-to cattle_buffer_set_contents]

Parameters

buffer

a CattleBuffer

 

contents

data to copy inside the memory buffer.

[transfer none][array length=size]

size

size of contents

 

cattle_buffer_set_value ()

void
cattle_buffer_set_value (CattleBuffer *buffer,
                         gulong position,
                         gint8 value);

Set the value of a specific byte inside the memory buffer.

The value of position must be smaller than the size of the memory buffer, as returned by cattle_buffer_get_size().

Parameters

buffer

a CattleBuffer

 

position

offset inside the memory buffer

 

value

new value

 

cattle_buffer_get_value ()

gint8
cattle_buffer_get_value (CattleBuffer *buffer,
                         gulong position);

Get the value of a specific byte inside the memory buffer.

The value of position must be smaller than the size of the memory buffer, as returned by cattle_buffer_get_size().

Parameters

buffer

a CattleBuffer

 

position

offset inside the memory buffer

 

Returns

the value of the selected byte.


cattle_buffer_get_size ()

gulong
cattle_buffer_get_size (CattleBuffer *buffer);

Get the size of the memory buffer.

Parameters

buffer

a CattleBuffer

 

Returns

the size of the memory buffer

Types and Values

struct CattleBuffer

struct CattleBuffer;

Opaque data structure representing a memory buffer. It should never be accessed directly.

Property Details

The “size” property

  “size”                     gulong

Size of the memory buffer.

Owner: CattleBuffer

Flags: Read / Write / Construct Only