group Buffers

Description

Data management is tricky at the best of times, but keeping it together can be a nightmare in memory management. Ferite buffers provide a clean mechanism of quickly storing various different data types together and outputing them in various different forms.

group attributes
function ferite_buffer_new() - Create a new FeriteBuffer
function ferite_buffer_add() - Add data to a buffer
function ferite_buffer_alloc() - Alloc a slab of memory and add it to the buffer if needed
function ferite_buffer_add_char() - Add a character onto the end of a buffer
function ferite_buffer_add_fstr() - Add a FeriteString onto the end of a buffer
function ferite_buffer_add_str() - Add a null terminated C string onto the buffer
function ferite_buffer_add_long() - Add a long onto the end of a buffer
function ferite_buffer_add_double() - Add a double onto the end of a buffer
function ferite_buffer_add_variable() - Add a ferite variable's value onto the end of a buffer
function ferite_buffer_vprintf() - Same as a standard C vprintf except onto a ferite buffer
function ferite_buffer_printf() - Same as a standard C printf except onto a ferite buffer
function ferite_buffer_merge() - Take two buffers and combine them into one
function ferite_buffer_delete() - Clean up a buffer and free all memory it uses
function ferite_buffer_get_size() - Get the total size of the data contained within a buffer
function ferite_buffer_get() - Get the entire contents of the bugffer in a contiguous memory block
function ferite_buffer_to_fd() - Write a buffer out to a system file descriptor
function ferite_buffer_to_file() - Write a buffer out to a file pointed to by a C FILE stream
function ferite_buffer_to_var() - Create a ferite string variable based upon the data within the buffer
function ferite_buffer_to_str() - Create a FeriteString containing the contents of a buffer

Functions

function ferite_buffer_new Click to go up to the list
Create a new FeriteBuffer
Declaration:
    FeriteBuffer *ferite_buffer_new( size_t size )
Parameters:
    Parameter #1: size_t size - The initial size of the buffer

function ferite_buffer_add Click to go up to the list
Add data to a buffer
Declaration:
    void ferite_buffer_add( FeriteBuffer *buf, void *ptr, size_t size )
Parameters:
    Parameter #1: FeriteBuffer *buf - The buffer to use
    Parameter #2: void *ptr - A pointer to the data
    Parameter #3: size_t size - The amount of data to get - this is used to buffers can handle binary data

function ferite_buffer_alloc Click to go up to the list
Alloc a slab of memory and add it to the buffer if needed
Declaration:
    void *ferite_buffer_alloc( FeriteBuffer *buf, size_t size )
Parameters:
    Parameter #1: FeriteBuffer *buf - The buffer to add the memory to
    Parameter #2: size_t size - The size of the slab to add

function ferite_buffer_add_char Click to go up to the list
Add a character onto the end of a buffer
Declaration:
    void ferite_buffer_add_char( FeriteBuffer *buf, int character )
Parameters:
    Parameter #1: FeriteBuffer *buf - The buffer to add onto
    Parameter #2: int character - The character to add

function ferite_buffer_add_fstr Click to go up to the list
Add a FeriteString onto the end of a buffer
Declaration:
    void ferite_buffer_add_fstr( FeriteBuffer *buf, FeriteString *str )
Parameters:
    Parameter #1: FeriteBuffer *buf - The buffer to add onto
    Parameter #2: FeriteString *str - The String to add

function ferite_buffer_add_str Click to go up to the list
Add a null terminated C string onto the buffer
Declaration:
    void ferite_buffer_add_str( FeriteBuffer *buf, char *str )
Parameters:
    Parameter #1: FeriteBuffer *buf - The buffer to add onto
    Parameter #2: char *str - null terminated string to use

function ferite_buffer_add_long Click to go up to the list
Add a long onto the end of a buffer
Declaration:
    void ferite_buffer_add_long( FeriteBuffer *buf, long data )
Parameters:
    Parameter #1: FeriteBuffer *buf - The Buffer to add onto
    Parameter #2: long data - The long value to use

function ferite_buffer_add_double Click to go up to the list
Add a double onto the end of a buffer
Declaration:
    void ferite_buffer_add_double( FeriteBuffer *buf, double data )
Parameters:
    Parameter #1: FeriteBuffer *buf - The Buffer to add onto
    Parameter #2: double data - The double value to use

function ferite_buffer_add_variable Click to go up to the list
Add a ferite variable's value onto the end of a buffer
Declaration:
    void ferite_buffer_add_long( FeriteScript *script, FeriteBuffer *buf, FeriteVariable *v )
Parameters:
    Parameter #1: FeriteScript *script - The script the variable belongs to
    Parameter #2: FeriteBuffer *buf - The Buffer to add onto
    Parameter #3: FeriteVariable *v - The variable to use

function ferite_buffer_vprintf Click to go up to the list
Same as a standard C vprintf except onto a ferite buffer
Declaration:
    int ferite_buffer_vprintf( FeriteBuffer *buf, char *fmt, va_list *args )
Parameters:
    Parameter #1: FeriteBuffer *buf - The buffer to use
    Parameter #2: char *fmt - The format to use - please c the vprintf man pages for more information
    Parameter #3: va_list *args - The arguments to use with the format
Returns:
    The length of the entire format

function ferite_buffer_printf Click to go up to the list
Same as a standard C printf except onto a ferite buffer
Declaration:
    int ferite_buffer_printf( FeriteBuffer *buf, char *fmt, ... )
Parameters:
    Parameter #1: FeriteBuffer *buf - The buffer to use
    Parameter #2: char *fmt - The format to use - please c the vprintf man pages for more information
    Parameter #3: . .. - The arguments to use with the format
Returns:
    The length of the entire format

function ferite_buffer_merge Click to go up to the list
Take two buffers and combine them into one
Declaration:
    void ferite_buffer_merge( FeriteBuffer *dest, FeriteBuffer *source )
Description:
Please remember, after merging buffers, you must forget about the source buffer. You do not need to delete the buffer.
Parameters:
    Parameter #1: FeriteBuffer *dest - The buffer to merge into
    Parameter #2: FeriteBuffer *source - The buffer to merge

function ferite_buffer_delete Click to go up to the list
Clean up a buffer and free all memory it uses
Declaration:
    void ferite_buffer_delete( FeriteBuffer *buf )
Parameters:
    Parameter #1: FeriteBuffer *buf - The buffer to delete

function ferite_buffer_get_size Click to go up to the list
Get the total size of the data contained within a buffer
Declaration:
    int ferite_buffer_get_size( FeriteBuffer *buf )
Parameters:
    Parameter #1: FeriteBuffer *buf - The buffer to use
Returns:
    The length

function ferite_buffer_get Click to go up to the list
Get the entire contents of the bugffer in a contiguous memory block
Declaration:
    void *ferite_buffer_get( FeriteBuffer *buf, int *len )
Description:
You must call ffree() on the memory returned otherwise leaks will occur
Parameters:
    Parameter #1: FeriteBuffer *buf - The buffer whose contents is wanted
    Parameter #2: int *len - A pointer to an int where the length of the data can be put
Returns:
    A pointer to a memory block containing len number of bytes of data

function ferite_buffer_to_fd Click to go up to the list
Write a buffer out to a system file descriptor
Declaration:
    int ferite_buffer_to_fd( FeriteBuffer *buf, int fd )
Parameters:
    Parameter #1: FeriteBuffer *buf - The buffer to write
    Parameter #2: int fd - The file descriptor to write to
Returns:
    The number of bytes written to the descriptor

function ferite_buffer_to_file Click to go up to the list
Write a buffer out to a file pointed to by a C FILE stream
Declaration:
    int ferite_buffer_to_file( FeriteBuffer *buf, FILE *f )
Parameters:
    Parameter #1: FeriteBuffer *buf - The buffer to write
    Parameter #2: FILE *f - The file to write to
Returns:
    The number of bytes written to the stream

function ferite_buffer_to_var Click to go up to the list
Create a ferite string variable based upon the data within the buffer
Declaration:
    FeriteVariable *ferite_buffer_to_var( FeriteBuffer *buf )
Parameters:
    Parameter #1: FeriteBuffer *buf - The buffer to use
Returns:
    A FeriteVariable with the contents of the buffer

function ferite_buffer_to_str Click to go up to the list
Create a FeriteString containing the contents of a buffer
Declaration:
    FeriteString *ferite_buffer_to_str( FeriteBuffer *buf )
Parameters:
    Parameter #1: FeriteBuffer *buf - The buffer to use
Returns:
    A FeriteString with the contents of the buffer

Automatically generated at 8:45pm, Wednesday 08 January 2003 by feritedoc.