Main Page   Modules   Compound List   File List   Compound Members   File Members   Related Pages  

wbxml_buffers.c File Reference

Generic Buffers Functions. More...

#include <limits.h>
#include <ctype.h>
#include <stdlib.h>
#include <string.h>
#include "wbxml.h"

Include dependency graph for wbxml_buffers.c:

Include dependency graph

Go to the source code of this file.

Compounds

struct  WBXMLBuffer_s

Defines

#define WBXML_BUFFER_SPLIT_BLOCK   20

Functions

unsigned char grow_buff (WBXMLBuffer *buffer, unsigned int size)
 Add space for at least 'size' octets.

unsigned char insert_data (WBXMLBuffer *buffer, unsigned int pos, const unsigned char *data, unsigned int len)
 Insert data into a Generic Buffer.

WBXMLBufferwbxml_buffer_create_real (const unsigned char *data, unsigned int len, unsigned int malloc_block)
void wbxml_buffer_destroy (WBXMLBuffer *buffer)
 Destroy a Buffer.

void wbxml_buffer_destroy_item (void *buff)
 Destroy a Buffer.

WBXMLBufferwbxml_buffer_duplicate (WBXMLBuffer *buff)
 Duplicate a Buffer.

unsigned int wbxml_buffer_len (WBXMLBuffer *buffer)
 Get data length of a buffer.

unsigned char wbxml_buffer_get_char (WBXMLBuffer *buffer, unsigned int pos, unsigned char *result)
void wbxml_buffer_set_char (WBXMLBuffer *buffer, unsigned int pos, unsigned char ch)
unsigned char * wbxml_buffer_get_cstr (WBXMLBuffer *buffer)
 Get pointer to internal buffer data.

unsigned char wbxml_buffer_insert (WBXMLBuffer *to, WBXMLBuffer *buffer, unsigned int pos)
unsigned char wbxml_buffer_insert_cstr (WBXMLBuffer *to, unsigned char *str, unsigned int pos)
unsigned char wbxml_buffer_append (WBXMLBuffer *dest, WBXMLBuffer *buff)
 Append a Buffer to another Buffer.

unsigned char wbxml_buffer_append_data_real (WBXMLBuffer *buffer, const unsigned char *data, unsigned int len)
unsigned char wbxml_buffer_append_cstr_real (WBXMLBuffer *buffer, const unsigned char *data)
unsigned char wbxml_buffer_append_char (WBXMLBuffer *buffer, unsigned char ch)
unsigned char wbxml_buffer_append_mb_uint_32 (WBXMLBuffer *buffer, unsigned int value)
void wbxml_buffer_delete (WBXMLBuffer *buffer, unsigned int pos, unsigned int len)
void wbxml_buffer_shrink_blanks (WBXMLBuffer *buffer)
 Shrink all spaces in a Buffer.

void wbxml_buffer_strip_blanks (WBXMLBuffer *buffer)
 Remove whitespaces at beginning and end of a Buffer.

int wbxml_buffer_compare (WBXMLBuffer *buff1, WBXMLBuffer *buff2)
 Compare two Buffers.

int wbxml_buffer_compare_cstr (WBXMLBuffer *buff, const char *str)
WBXMLListwbxml_buffer_split_words_real (WBXMLBuffer *buff)
 Split a Buffer into words at whitespace.

unsigned char wbxml_buffer_search_char (WBXMLBuffer *to, unsigned char ch, unsigned int pos, unsigned int *result)
unsigned char wbxml_buffer_search (WBXMLBuffer *to, WBXMLBuffer *search, unsigned int pos, unsigned int *result)
unsigned char wbxml_buffer_search_cstr (WBXMLBuffer *to, unsigned char *search, unsigned int pos, unsigned int *result)
unsigned char wbxml_buffer_contains_only_whitespaces (WBXMLBuffer *buffer)
 Check if a buffer contains only Whitespaces.

void wbxml_buffer_hex_to_binary (WBXMLBuffer *buffer)
 Convert an Hexa buffer to Binary.

unsigned char wbxml_buffer_binary_to_hex (WBXMLBuffer *buffer, unsigned char uppercase)
void wbxml_buffer_remove_trailing_zeros (WBXMLBuffer **buffer)
 Remove trailing Zeros.


Detailed Description

Generic Buffers Functions.

Author:
Aymerick Jéhanne <libwbxml@jehanne.org>
Date:
02/03/12

Note:
Original idea: Kannel Project (http://www.kannel.org/)

Definition in file wbxml_buffers.c.


Define Documentation

#define WBXML_BUFFER_SPLIT_BLOCK   20
 

Definition at line 44 of file wbxml_buffers.c.

Referenced by wbxml_buffer_split_words_real().


Function Documentation

unsigned char grow_buff WBXMLBuffer   buffer,
unsigned int    size
[static]
 

Add space for at least 'size' octets.

Parameters:
buffer The buffer
size The size to add
Returns:
TRUE is space successfully reserved, FALSE is size was negative, buffer was NULL or if not enough memory

Definition at line 667 of file wbxml_buffers.c.

Referenced by wbxml_buffer_binary_to_hex().

unsigned char insert_data WBXMLBuffer   buffer,
unsigned int    pos,
const unsigned char *    data,
unsigned int    len
[static]
 

Insert data into a Generic Buffer.

Parameters:
buffer The Generic Buffer
pos Position in Generic Buffer where to insert data
data Data to insert
len Data length
Returns:
TRUE is data inserted, FALSE if not

Definition at line 698 of file wbxml_buffers.c.

Referenced by wbxml_buffer_append_char(), wbxml_buffer_append_data_real(), wbxml_buffer_insert(), and wbxml_buffer_insert_cstr().

unsigned char wbxml_buffer_append_char WBXMLBuffer   buffer,
unsigned char    ch
 

Definition at line 219 of file wbxml_buffers.c.

References FALSE, insert_data(), WBXMLBuffer_s::len, NULL, WB_BOOL, and WB_UTINY.

unsigned char wbxml_buffer_append_cstr_real WBXMLBuffer   buffer,
const unsigned char *    data
 

Definition at line 210 of file wbxml_buffers.c.

References NULL, TRUE, WB_BOOL, WB_UTINY, wbxml_buffer_append_data, and WBXML_STRLEN.

unsigned char wbxml_buffer_append_data_real WBXMLBuffer   buffer,
const unsigned char *    data,
unsigned int    len
 

Definition at line 199 of file wbxml_buffers.c.

References FALSE, insert_data(), WBXMLBuffer_s::len, NULL, TRUE, WB_BOOL, WB_ULONG, and WB_UTINY.

unsigned char wbxml_buffer_append_mb_uint_32 WBXMLBuffer   buffer,
unsigned int    value
 

Definition at line 230 of file wbxml_buffers.c.

References WB_BOOL, WB_LONG, WB_ULONG, WB_UTINY, and wbxml_buffer_append_data.

unsigned char wbxml_buffer_binary_to_hex WBXMLBuffer   buffer,
unsigned char    uppercase
 

Definition at line 609 of file wbxml_buffers.c.

References WBXMLBuffer_s::data, FALSE, grow_buff(), WBXMLBuffer_s::len, NULL, TRUE, WB_BOOL, WB_LONG, WB_UTINY, and wbxml_buffer_len().

int wbxml_buffer_compare_cstr WBXMLBuffer   buff,
const char *    str
 

Definition at line 374 of file wbxml_buffers.c.

References WBXMLBuffer_s::data, WBXMLBuffer_s::len, NULL, WB_LONG, WB_TINY, and WBXML_STRLEN.

WBXMLBuffer* wbxml_buffer_create_real const unsigned char *    data,
unsigned int    len,
unsigned int    malloc_block
 

Definition at line 68 of file wbxml_buffers.c.

References WBXMLBuffer_s::data, WBXMLBuffer_s::len, WBXMLBuffer_s::malloc_block, WBXMLBuffer_s::malloced, NULL, WB_ULONG, WB_UTINY, wbxml_free(), and wbxml_malloc().

void wbxml_buffer_delete WBXMLBuffer   buffer,
unsigned int    pos,
unsigned int    len
 

Definition at line 254 of file wbxml_buffers.c.

References WBXMLBuffer_s::data, WBXMLBuffer_s::len, and WB_ULONG.

unsigned char wbxml_buffer_get_char WBXMLBuffer   buffer,
unsigned int    pos,
unsigned char *    result
 

Definition at line 143 of file wbxml_buffers.c.

References WBXMLBuffer_s::data, FALSE, WBXMLBuffer_s::len, NULL, TRUE, WB_BOOL, WB_ULONG, and WB_UTINY.

unsigned char wbxml_buffer_insert WBXMLBuffer   to,
WBXMLBuffer   buffer,
unsigned int    pos
 

Definition at line 169 of file wbxml_buffers.c.

References WBXMLBuffer_s::data, FALSE, insert_data(), WBXMLBuffer_s::len, NULL, WB_BOOL, and WB_ULONG.

unsigned char wbxml_buffer_insert_cstr WBXMLBuffer   to,
unsigned char *    str,
unsigned int    pos
 

Definition at line 178 of file wbxml_buffers.c.

References FALSE, insert_data(), NULL, WB_BOOL, WB_ULONG, WB_UTINY, and WBXML_STRLEN.

unsigned char wbxml_buffer_search WBXMLBuffer   to,
WBXMLBuffer   search,
unsigned int    pos,
unsigned int *    result
 

Definition at line 477 of file wbxml_buffers.c.

References WBXMLBuffer_s::data, FALSE, WBXMLBuffer_s::len, NULL, TRUE, WB_BOOL, WB_ULONG, WB_UTINY, and wbxml_buffer_search_char().

unsigned char wbxml_buffer_search_char WBXMLBuffer   to,
unsigned char    ch,
unsigned int    pos,
unsigned int *    result
 

Definition at line 457 of file wbxml_buffers.c.

References WBXMLBuffer_s::data, FALSE, WBXMLBuffer_s::len, NULL, TRUE, WB_BOOL, WB_ULONG, and WB_UTINY.

unsigned char wbxml_buffer_search_cstr WBXMLBuffer   to,
unsigned char *    search,
unsigned int    pos,
unsigned int *    result
 

Definition at line 517 of file wbxml_buffers.c.

References WBXMLBuffer_s::data, FALSE, WBXMLBuffer_s::len, NULL, TRUE, WB_BOOL, WB_ULONG, WB_UTINY, wbxml_buffer_search_char(), and WBXML_STRLEN.

void wbxml_buffer_set_char WBXMLBuffer   buffer,
unsigned int    pos,
unsigned char    ch
 

Definition at line 153 of file wbxml_buffers.c.

References WBXMLBuffer_s::data, WBXMLBuffer_s::len, WB_ULONG, and WB_UTINY.


Generated on Mon Nov 24 20:09:44 2003 for WBXML Library by doxygen1.3-rc1