Main Page | Modules | Alphabetical List | Data Structures | File List | Data Fields | Globals | Related Pages

String abstraction


Data Structures

struct  s_string

Typedefs

typedef s_string t_string

Functions

void str_init (t_string *str)
void str_cleanup (t_string *str)
size_t str_char_append (t_string *str, const u_char content)
size_t str_chars_append (t_string *str, const u_char *content, size_t length)
size_t str_str_append (t_string *str, t_string *content)
size_t str_char_set (t_string *str, const u_char *content, size_t length)
size_t str_str_set (t_string *str, t_string *content)
int str_equal_string (const t_string *str1, const t_string *str2)
int str_equal_chars (const t_string *str1, const u_char *str2, size_t len)

Typedef Documentation

typedef struct s_string t_string
 

This is the heart of the string abstraction. It contains the string itself, the length of the string and the size of the reserved memory for the string.


Function Documentation

size_t str_char_append t_string str,
const u_char  content
 

This function appends a character to the string

Parameters:
str A reference to the string structure
content The character to append
Returns:
Number of characters appended on success or 0 on failure

Definition at line 190 of file utils.c.

size_t str_char_set t_string str,
const u_char *  content,
size_t  length
 

This function sets the value of an string structure to a given u_char array. The old string contained in the structure will be lost.

Parameters:
str A reference to the string to append to
content The string to set
length The length of the string to set
Returns:
The number of characters set on success or 0 on failure

Definition at line 351 of file utils.c.

size_t str_chars_append t_string str,
const u_char *  content,
size_t  length
 

This function appends a u_char array to the string in the string structure.

Parameters:
str A reference to the string structure
content The u_char array to append
length The length of the u_char array
Returns:
The number of characters appended on success or 0 on failure

Definition at line 214 of file utils.c.

void str_cleanup t_string str  ) 
 

This function frees the reserved memory in a string structure and sets everything to NULL

Parameters:
str A reference to the string structure

Definition at line 171 of file utils.c.

int str_equal_chars const t_string str1,
const u_char *  str2,
size_t  len
 

This function tests if two strings (t_string, u_char *) are equal

Parameters:
str1 string 1
str2 string 2
len Length of string str2
Returns:
TRUE if both equal, FALSE otherwise

Definition at line 269 of file utils.c.

int str_equal_string const t_string str1,
const t_string str2
 

This function tests if two strings (t_string) are equal

Parameters:
str1 string 1
str2 string 2
Returns:
TRUE if both equal, FALSE otherwise

Definition at line 242 of file utils.c.

void str_init t_string str  ) 
 

This function initializes a string structure. It just sets everything to 0

Parameters:
str A reference to a string structure

Definition at line 145 of file utils.c.

size_t str_str_append t_string str,
t_string content
 

This function appends a string structure to a string structure. It's just a wrapper for the str_chars_append() function.

Parameters:
str A reference to the string structure to append to
content A reference to the string structure to append

Definition at line 316 of file utils.c.

size_t str_str_set t_string str,
t_string content
 

This function sets the value of a string structure to the value of another string structure. The old string contained in the target structure will be lost.

Parameters:
str A reference to the structure to set to
content A reference to the structure to set
Returns:
The number of characters set on success or 0 on failure

Definition at line 380 of file utils.c.


Generated on Sun Apr 25 16:37:40 2004 for Classic Forum by doxygen 1.3.5