str.cc File Reference

utilities for string handling More...

#include <jabberdlib.h>

Functions

char * j_strdup (const char *str)
char * j_strcat (char *dest, char *txt)
int j_strcmp (const char *a, const char *b)
int j_strcasecmp (const char *a, const char *b)
int j_strncmp (const char *a, const char *b, int i)
int j_strncasecmp (const char *a, const char *b, int i)
int j_strlen (const char *a)
int j_atoi (const char *a, int def)
char * strunescape (pool p, char *buf)
std::string strescape (std::string s)
char * strescape (pool p, char *buf)
char * zonestr (char const *file, int line)

Detailed Description

utilities for string handling

This file contains utility functions for string handling:

String spools allow to create a string by concatenating several smaller strings and the spool implementation is allocating the neccessary memory using memory pools.


Function Documentation

int j_atoi ( const char *  a,
int  def 
)
int j_strcasecmp ( const char *  a,
const char *  b 
)

NULL pointer save version of strcasecmp()

If one of the parameters contains a NULL pointer, the string is considered to be unequal

Parameters:
a the one string
b the other string
Returns:
0 if the strings are equal, non zero else

Referenced by dialback_in_read_db(), dialback_out_read(), and xmlnode_select_by_lang().

char* j_strcat ( char *  dest,
char *  txt 
)

NULL pointer save version of strcat()

Note:
the return value of j_strcat() is not compatible with the return value of strcat()
Todo:
check if the behaviour of the return value is intended
Parameters:
dest where to append the string
txt what to append
Returns:
dest if txt contains a NULL pointer, pointer to the terminating zero byte of the result else
int j_strcmp ( const char *  a,
const char *  b 
)
char* j_strdup ( const char *  str  ) 

NULL pointer save version of strdup()

Parameters:
str the string the should be duplicated
Returns:
the duplicated string
int j_strlen ( const char *  a  ) 

NULL pointer save version of strlen

If the parameter contains a NULL pointer, 0 is returned

Parameters:
a the string for which the length should be calculated
Returns:
0 if a==NULL, length of the string else

Referenced by dialback_in_read_db(), js_session_get(), jutil_msgnew(), jutil_presnew(), log_generic(), logger(), main(), srv_lookup(), xdb_file_phandler(), and xmlnode2file_limited().

int j_strncasecmp ( const char *  a,
const char *  b,
int  i 
)

NULL pointer save version of strncasecmp()

If one of the parameters contains a NULL pointer, the string is considered to be unequal

Parameters:
a the first string
b the second string
i how many characters to compare at most
Returns:
0 if the strings are equal (within the given length limitation), non zero else
int j_strncmp ( const char *  a,
const char *  b,
int  i 
)

NULL pointer save version of strncmp()

If one of the parameters contains a NULL pointer, the string is considered to be unequal

Parameters:
a the first string
b the second string
i how many characters to compare at most
Returns:
0 if the strings are equal (within the given length limitation), non zero else

Referenced by dialback_check_settings(), js_session_get(), xmlnode_get_attrib(), xmlnode_hide_attrib(), and xmlnode_put_attrib().

char* strescape ( pool  p,
char *  buf 
)

References pmalloc().

Referenced by xstream_header_char().

std::string strescape ( std::string  s  ) 

escape a string to be print as XML

Parameters:
s the original string
Returns:
the string with &, ', , < and > replaced with their entity representation
char* strunescape ( pool  p,
char *  buf 
)

References pmalloc().

char* zonestr ( char const *  file,
int  line 
)

Generated on Wed Mar 10 06:00:06 2010 for jabberd14 by  doxygen 1.6.1