String-related
[Functions]


Detailed Description

Some of these functions are similar to <string.h> functions, with the exception that they also accept NULL pointers as empty strings (""), and use operator new instead of malloc().

It is recommended to use these functions instead of the original <string.h> functions.


Functions

int opp_strlen (const char *)
char * opp_strdup (const char *)
char * opp_strcpy (char *, const char *)
int opp_strcmp (const char *, const char *)
SIM_API char * opp_strprettytrunc (char *dest, const char *src, unsigned maxlen)


Function Documentation

int opp_strcmp ( const char *  s1,
const char *  s2 
) [inline]

Same as the standard strcmp() function, except that NULL pointers are treated exactly as empty strings ("").

Referenced by cObject::isName(), and opp_string::operator<().

char * opp_strcpy ( char *  s1,
const char *  s2 
) [inline]

Same as the standard strcpy() function, except that NULL pointers in the second argument are treated like pointers to a null string ("").

char * opp_strdup ( const char *  s  )  [inline]

Duplicates the string, using new char[].

For NULLs and empty strings it returns NULL.

Referenced by opp_string::operator=(), and opp_string::opp_string().

int opp_strlen ( const char *  s  )  [inline]

Same as the standard strlen() function, except that does not crash on NULL pointers but returns 0.

SIM_API char* opp_strprettytrunc ( char *  dest,
const char *  src,
unsigned  maxlen 
)

Copies src string into desc, and if its length would exceed maxlen, it is truncated with an ellipsis.

For example, opp_strprettytrunc(buf, "long-long",6) yields "lon...".


Generated on Wed Apr 3 14:40:28 2013 for OMNeT++ Simulation Library by  doxygen 1.5.5