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

wbxml_buffers.h File Reference

Generic Buffers Functions. More...

#include <stdio.h>

Include dependency graph for wbxml_buffers.h:

Include dependency graph

This graph shows which files directly or indirectly include this file:

Included by dependency graph

Go to the source code of this file.

Defines

#define wbxml_buffer_create(a, b, c)   wbxml_mem_cleam(wbxml_buffer_create_real((const WB_UTINY *)a,b,c))
#define wbxml_buffer_create_from_cstr(a)   wbxml_buffer_create((const WB_UTINY *)a,WBXML_STRLEN(a),WBXML_STRLEN(a))
#define wbxml_buffer_append_data(a, b, c)   wbxml_buffer_append_data_real(a,(const WB_UTINY *)b,c)
#define wbxml_buffer_append_cstr(a, b)   wbxml_buffer_append_cstr_real(a,(const WB_UTINY *)b)
#define wbxml_buffer_split_words(a)   wbxml_mem_cleam(wbxml_buffer_split_words_real(a))

Typedefs

typedef WBXMLBuffer_s WBXMLBuffer
 WBXML Generic Buffer.


Functions

WBXMLBufferwbxml_buffer_create_real (const WB_UTINY *data, WB_ULONG len, WB_ULONG malloc_block)
 Create a Buffer.

void wbxml_buffer_destroy (WBXMLBuffer *buff)
 Destroy a Buffer.

void wbxml_buffer_destroy_item (void *buff)
 Destroy a Buffer.

WBXMLBufferwbxml_buffer_duplicate (WBXMLBuffer *buff)
 Duplicate a Buffer.

WB_ULONG wbxml_buffer_len (WBXMLBuffer *buff)
 Get data length of a buffer.

WB_BOOL wbxml_buffer_get_char (WBXMLBuffer *buff, WB_ULONG pos, WB_UTINY *result)
 Get a byte from a Buffer.

void wbxml_buffer_set_char (WBXMLBuffer *buff, WB_ULONG pos, WB_UTINY ch)
 Set a byte in a Buffer.

WB_UTINY * wbxml_buffer_get_cstr (WBXMLBuffer *buff)
 Get pointer to internal buffer data.

WB_BOOL wbxml_buffer_insert (WBXMLBuffer *to, WBXMLBuffer *buff, WB_ULONG pos)
 Append a Buffer into another one.

WB_BOOL wbxml_buffer_insert_cstr (WBXMLBuffer *to, WB_UTINY *str, WB_ULONG pos)
 Append a C String into a WBXMLBuffer.

WB_BOOL wbxml_buffer_append (WBXMLBuffer *dest, WBXMLBuffer *buff)
 Append a Buffer to another Buffer.

WB_BOOL wbxml_buffer_append_data_real (WBXMLBuffer *buff, const WB_UTINY *data, WB_ULONG len)
 Append data to a Buffer.

WB_BOOL wbxml_buffer_append_cstr_real (WBXMLBuffer *buff, const WB_UTINY *data)
 Append a C String (NULL terminated) to a Buffer.

WB_BOOL wbxml_buffer_append_char (WBXMLBuffer *buff, WB_UTINY ch)
 Append a byte to a Buffer.

WB_BOOL wbxml_buffer_append_mb_uint_32 (WBXMLBuffer *buff, WB_ULONG value)
 Append a Multibyte Integer.

void wbxml_buffer_delete (WBXMLBuffer *buff, WB_ULONG pos, WB_ULONG len)
 Delete a range of Bytes in a Buffer.

void wbxml_buffer_shrink_blanks (WBXMLBuffer *buff)
 Shrink all spaces in a Buffer.

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

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

WB_LONG wbxml_buffer_compare_cstr (WBXMLBuffer *buff, const WB_TINY *str)
 Compare a WBXML Buffer with a C String.

WBXMLListwbxml_buffer_split_words_real (WBXMLBuffer *buff)
 Split a Buffer into words at whitespace.

WB_BOOL wbxml_buffer_search_char (WBXMLBuffer *to, WB_UTINY ch, WB_ULONG pos, WB_ULONG *result)
 Search a char in Buffer.

WB_BOOL wbxml_buffer_search (WBXMLBuffer *to, WBXMLBuffer *search, WB_ULONG pos, WB_ULONG *result)
 Search a Buffer in another Buffer.

WB_BOOL wbxml_buffer_search_cstr (WBXMLBuffer *to, WB_UTINY *search, WB_ULONG pos, WB_ULONG *result)
 Search a C String in a WBXMLBuffer Buffer.

WB_BOOL 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.

WB_BOOL wbxml_buffer_binary_to_hex (WBXMLBuffer *buffer, WB_BOOL uppercase)
 Convert an Binary buffer to Hexa.

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://kannel.3glab.org/)

Definition in file wbxml_buffers.h.


Typedef Documentation

typedef struct WBXMLBuffer_s WBXMLBuffer
 

WBXML Generic Buffer.

Definition at line 49 of file wbxml_buffers.h.


Function Documentation

WB_BOOL wbxml_buffer_append WBXMLBuffer   dest,
WBXMLBuffer   buff
 

Append a Buffer to another Buffer.

Parameters:
dest The destination Buffer
buff The Buffer to append
Returns:
TRUE if buffer appended, FALSE otherwise

Definition at line 187 of file wbxml_buffers.c.

References FALSE, NULL, TRUE, WB_BOOL, wbxml_buffer_append_data, wbxml_buffer_get_cstr(), and wbxml_buffer_len().

WB_LONG wbxml_buffer_compare WBXMLBuffer   buff1,
WBXMLBuffer   buff2
 

Compare two Buffers.

Parameters:
buff1 
buff2 
Returns:
0 if they are equal, negative if `buff1' is less than `buff2' and positive if greater

Definition at line 332 of file wbxml_buffers.c.

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

WB_BOOL wbxml_buffer_contains_only_whitespaces WBXMLBuffer   buffer
 

Check if a buffer contains only Whitespaces.

Parameters:
buffer The buffer to check
Returns:
TRUE if it contains only whitespaces, FALSE otherwise

Definition at line 557 of file wbxml_buffers.c.

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

void wbxml_buffer_destroy WBXMLBuffer   buff
 

Destroy a Buffer.

Parameters:
buff The Buffer to destroy

Definition at line 104 of file wbxml_buffers.c.

References WBXMLBuffer_s::data, NULL, and wbxml_free().

Referenced by wbxml_attribute_destroy(), wbxml_attribute_name_destroy(), wbxml_buffer_destroy_item(), wbxml_encoder_destroy(), wbxml_parser_destroy(), wbxml_tag_destroy(), wbxml_tree_clb_xml_end_element(), and wbxml_tree_node_destroy().

void wbxml_buffer_destroy_item void *    buff
 

Destroy a Buffer.

Parameters:
buff The Buffer to destroy

Definition at line 113 of file wbxml_buffers.c.

References wbxml_buffer_destroy().

Referenced by wbxml_buffer_split_words_real().

WBXMLBuffer* wbxml_buffer_duplicate WBXMLBuffer   buff
 

Duplicate a Buffer.

Parameters:
buff The Buffer to duplicate
Returns:
The duplicated buffer, or NULL if not enough memory

Definition at line 119 of file wbxml_buffers.c.

References NULL, wbxml_buffer_create_real(), wbxml_buffer_get_cstr(), and wbxml_buffer_len().

Referenced by wbxml_attribute_duplicate(), wbxml_attribute_name_duplicate(), and wbxml_tag_duplicate().

WB_UTINY* wbxml_buffer_get_cstr WBXMLBuffer   buff
 

Get pointer to internal buffer data.

Parameters:
buff The Buffer
Returns:
Pointer to buffer data, or "" if buffer is NULL or empty

Definition at line 160 of file wbxml_buffers.c.

References WBXMLBuffer_s::data, WBXMLBuffer_s::len, NULL, WB_UTINY, and WBXML_UTINY_NULL_STRING.

Referenced by wbxml_attribute_get_xml_value(), wbxml_attribute_name_get_xml_name(), wbxml_buffer_append(), wbxml_buffer_duplicate(), wbxml_tag_get_xml_name(), and wbxml_tree_clb_xml_end_element().

void wbxml_buffer_hex_to_binary WBXMLBuffer   buffer
 

Convert an Hexa buffer to Binary.

Parameters:
buffer The buffer to convert

Definition at line 573 of file wbxml_buffers.c.

References WBXMLBuffer_s::data, WBXMLBuffer_s::len, NULL, WB_ULONG, WB_UTINY, and wbxml_buffer_len().

WB_ULONG wbxml_buffer_len WBXMLBuffer   buff
 

Get data length of a buffer.

Parameters:
buff The Buffer
Returns:
The Buffer data length

Definition at line 134 of file wbxml_buffers.c.

References WBXMLBuffer_s::len, NULL, and WB_ULONG.

Referenced by wbxml_buffer_append(), wbxml_buffer_binary_to_hex(), wbxml_buffer_duplicate(), wbxml_buffer_hex_to_binary(), wbxml_buffer_remove_trailing_zeros(), wbxml_buffer_shrink_blanks(), and wbxml_buffer_strip_blanks().

void wbxml_buffer_remove_trailing_zeros WBXMLBuffer **    buffer
 

Remove trailing Zeros.

Parameters:
buffer The buffer

Definition at line 641 of file wbxml_buffers.c.

References NULL, WB_UTINY, wbxml_buffer_delete(), wbxml_buffer_get_char(), and wbxml_buffer_len().

void wbxml_buffer_shrink_blanks WBXMLBuffer   buff
 

Shrink all spaces in a Buffer.

Parameters:
buff The Buffer to shrink
Note:
Replace every consecutive sequence of spaces into one unique whitespace

Definition at line 272 of file wbxml_buffers.c.

References NULL, WB_ULONG, WB_UTINY, wbxml_buffer_delete(), wbxml_buffer_get_char(), wbxml_buffer_len(), and wbxml_buffer_set_char().

WBXMLList* wbxml_buffer_split_words_real WBXMLBuffer   buff
 

Split a Buffer into words at whitespace.

Parameters:
buff The buffer to split
Returns:
The List of splitted Words, or NULL if not enought memory
Warning:
Do NOT use this function directly, use wbxml_buffer_split_words() macro instead

Definition at line 416 of file wbxml_buffers.c.

References WBXMLBuffer_s::data, WBXMLBuffer_s::len, NULL, WB_ULONG, WB_UTINY, wbxml_buffer_create, wbxml_buffer_destroy_item(), WBXML_BUFFER_SPLIT_BLOCK, wbxml_list_append(), wbxml_list_create, and wbxml_list_destroy().

void wbxml_buffer_strip_blanks WBXMLBuffer   buff
 

Remove whitespaces at beginning and end of a Buffer.

Parameters:
buff The Buffer to strip

Definition at line 302 of file wbxml_buffers.c.

References WB_ULONG, WB_UTINY, wbxml_buffer_delete(), wbxml_buffer_get_char(), and wbxml_buffer_len().


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