UCommon

ucommon/string.h File Reference

A common string class and character string support functions. More...

#include <ucommon/platform.h>
#include <ucommon/protocols.h>
#include <ucommon/object.h>
#include <stdio.h>
#include <string.h>
#include <stdarg.h>
#include <stdio.h>
#include <string.h>
Include dependency graph for string.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Data Structures

class  charbuf< S >
 A template to create a character array that can be manipulated as a string. More...
class  memstring
 A string class that uses a cstring buffer that is fixed in memory. More...
class  string
 A copy-on-write string class that operates by reference count. More...
class  string::cstring
 This is an internal class which contains the actual string data along with some control fields. More...
class  stringbuf< S >
 A string class that has a predefined string buffer. More...

Typedefs

typedef string String
 A convenience type when mixing std::string in old compilers that are bad with namespaces...
typedef string string_t
 A convenience type for string.

Functions

bool eq (char *s1, char *s2)
 Compare two null terminated strings if equal.
bool eq (char *s1, char *s2, size_t size)
 Compare two null terminated strings if equal up to specified size.
bool eq (String &s1, String &s2)
 Compare two string objects if equal.
bool ieq (String &s1, String &s2)
 Compare two string objects if equal ignoring case.
bool ieq (char *s1, char *s2)
 Compare two null terminated strings if equal ignoring case.
bool ieq (char *s1, char *s2, size_t size)
 Compare two null terminated strings if equal for a specified size ignoring case.
String str (short value)
String str (unsigned long value)
String str (char *string)
String str (double value)
String str (long value)
String str (CharacterProtocol &cp, strsize_t size)
String str (String &string)
String str (unsigned short value)
int stricmp (char *string1, char *string2)
 Convenience function for case insensitive null terminated string compare.
int strnicmp (char *string1, char *string2, size_t max)
 Convenience function for case insensitive null terminated string compare.

Variables

NAMESPACE_UCOMMON typedef
unsigned short 
strsize_t
 A convenience class for size of strings.

Detailed Description

A common string class and character string support functions.

Ucommon offers a simple string class that operates through copy-on-write when needing to expand buffer size. Derived classes and templates allows one to create strings which live entirely in the stack frame rather than using the heap. This offers the benefit of the string class manipulative members without compromising performance or locking issues in threaded applications. Other things found here include better and safer char array manipulation functions.

Definition in file string.h.


Function Documentation

bool eq ( char *  s1,
char *  s2 
) [inline]

Compare two null terminated strings if equal.

Parameters:
s1string to compare.
s2string to compare.
Returns:
true if equal.

Definition at line 1603 of file string.h.

Here is the call graph for this function:

bool eq ( char *  s1,
char *  s2,
size_t  size 
) [inline]

Compare two null terminated strings if equal up to specified size.

Parameters:
s1string to compare.
s2string to compare.
sizeof string to compare.
Returns:
true if equal.

Definition at line 1613 of file string.h.

Here is the call graph for this function:

bool eq ( String s1,
String s2 
) [inline]

Compare two string objects if equal.

Parameters:
s1string to compare.
s2string to compare.
Returns:
true if equal.

Definition at line 1622 of file string.h.

Here is the call graph for this function:

bool ieq ( String s1,
String s2 
) [inline]

Compare two string objects if equal ignoring case.

This is related to stricmp or gcc strcasecmp.

Parameters:
s1string to compare.
s2string to compare.
Returns:
true if equal.

Definition at line 1653 of file string.h.

Here is the call graph for this function:

bool ieq ( char *  s1,
char *  s2 
) [inline]

Compare two null terminated strings if equal ignoring case.

This is related to stricmp or gcc strcasecmp.

Parameters:
s1string to compare.
s2string to compare.
Returns:
true if equal.

Definition at line 1632 of file string.h.

Here is the call graph for this function:

bool ieq ( char *  s1,
char *  s2,
size_t  size 
) [inline]

Compare two null terminated strings if equal for a specified size ignoring case.

This is related to stricmp or gcc strcasecmp.

Parameters:
s1string to compare.
s2string to compare.
sizeof string to compare.
Returns:
true if equal.

Definition at line 1643 of file string.h.

Here is the call graph for this function:

int stricmp ( char *  string1,
char *  string2 
) [inline]

Convenience function for case insensitive null terminated string compare.

Parameters:
string1to compare.
string2to compare.
Returns:
0 if equal, > 0 if s2 > s1, < 0 if s2 < s1.

Definition at line 1582 of file string.h.

Here is the call graph for this function:

int strnicmp ( char *  string1,
char *  string2,
size_t  max 
) [inline]

Convenience function for case insensitive null terminated string compare.

Parameters:
string1to compare.
string2to compare.
maxsize of string to compare.
Returns:
0 if equal, > 0 if s2 > s1, < 0 if s2 < s1.

Definition at line 1592 of file string.h.

Here is the call graph for this function: