bstr_builder.c File Reference

#include "bstr.h"
#include "htp_list.h"

Functions

htp_status_t bstr_builder_appendn (bstr_builder_t *bb, bstr *b)
htp_status_t bstr_builder_append_c (bstr_builder_t *bb, const char *cstr)
htp_status_t bstr_builder_append_mem (bstr_builder_t *bb, const void *data, size_t len)
void bstr_builder_clear (bstr_builder_t *bb)
bstr_builder_tbstr_builder_create ()
void bstr_builder_destroy (bstr_builder_t *bb)
size_t bstr_builder_size (const bstr_builder_t *bb)
bstrbstr_builder_to_str (const bstr_builder_t *bb)

Detailed Description

Author:
Ivan Ristic <ivanr@webkreator.com>

Function Documentation

htp_status_t bstr_builder_append_c ( bstr_builder_t bb,
const char *  cstr 
)

Adds one new piece, in the form of a NUL-terminated string, to the builder. This function will make a copy of the provided string.

Parameters:
[in] bb 
[in] cstr 
Returns:
HTP_OK on success, HTP_ERROR on failure.
htp_status_t bstr_builder_append_mem ( bstr_builder_t bb,
const void *  data,
size_t  len 
)

Adds one new piece, defined with the supplied pointer and length, to the builder. This function will make a copy of the provided data region.

Parameters:
[in] bb 
[in] data 
[in] len 
Returns:
HTP_OK on success, HTP_ERROR on failure.
htp_status_t bstr_builder_appendn ( bstr_builder_t bb,
bstr b 
)

Adds one new string to the builder. This function will adopt the string and destroy it when the builder itself is destroyed.

Parameters:
[in] bb 
[in] b 
Returns:
HTP_OK on success, HTP_ERROR on failure.
void bstr_builder_clear ( bstr_builder_t bb  ) 

Clears this string builder, destroying all existing pieces. You may want to clear a builder once you've either read all the pieces and done something with them, or after you've converted the builder into a single string.

Parameters:
[in] bb 
bstr_builder_t* bstr_builder_create ( void   ) 

Creates a new string builder.

Returns:
New string builder, or NULL on error.
void bstr_builder_destroy ( bstr_builder_t bb  ) 

Destroys an existing string builder, also destroying all the pieces stored within.

Parameters:
[in] bb 
size_t bstr_builder_size ( const bstr_builder_t bb  ) 

Returns the size (the number of pieces) currently in a string builder.

Parameters:
[in] bb 
Returns:
size
bstr* bstr_builder_to_str ( const bstr_builder_t bb  ) 

Creates a single string out of all the pieces held in a string builder. This method will not destroy any of the pieces.

Parameters:
[in] bb 
Returns:
New string, or NULL on error.

Generated on 1 Jan 2017 for HTP by  doxygen 1.6.1