libonion
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
Public Member Functions | Data Fields

Data type to store some raw dataNormally it will be used to store strings when the size is unknown beforehand, but it can contain any type of data. More...

#include <types.h>

Public Member Functions

onion_blockonion_block_new ()
 Creates a new block.
void onion_block_free (onion_block *bl)
 Removes the current block.
void onion_block_clear (onion_block *b)
 Discards all data on this block, and set the size to 0.
void onion_block_min_maxsize (onion_block *b, int minsize)
 Ensures the block has at least this reserved memory space.
const char * onion_block_data (const onion_block *b)
 Returns the current data.
off_t onion_block_size (const onion_block *b)
 Returns current block size.
void onion_block_rewind (onion_block *b, off_t n)
 Reduces the size of the block.
int onion_block_add_char (onion_block *bl, char c)
 Adds a character to the block.
int onion_block_add_str (onion_block *b, const char *str)
 Adds a string to the block.
int onion_block_add_data (onion_block *bl, const char *data, size_t l)
 Adds raw data to the block.
int onion_block_add_block (onion_block *b, onion_block *toadd)
 Appends both blocks on the first.

Data Fields

char * data
int size
int maxsize

Detailed Description

Data type to store some raw data

Normally it will be used to store strings when the size is unknown beforehand, but it can contain any type of data.

Use with care as in most situations it might not be needed and more efficient alternatives may exist.

Member Function Documentation

int onion_block_add_block ( onion_block b,
onion_block toadd 
)

Appends both blocks on the first.

References data, onion_block_add_data(), and size.

int onion_block_add_char ( onion_block bl,
char  c 
)
int onion_block_add_data ( onion_block bl,
const char *  data,
size_t  l 
)
int onion_block_add_str ( onion_block b,
const char *  str 
)

Adds a string to the block.

References onion_block_add_data(), and size.

Referenced by onion_webdav_write_propfind().

Field Documentation

char* onion_block_t::data
int onion_block_t::maxsize
int onion_block_t::size

The documentation for this struct was generated from the following files: