Main Page | Class List | File List | Class Members | File Members | Related Pages

gi_string.h File Reference

Extended functions that follow a similar scheme to those provided by ANSI C in string.h. More...

Go to the source code of this file.

Defines

#define GFMT   gi_stringf
#define GSZ(buf)   (buf), sizeof(buf)

Functions

EXTERN_C_BEGIN LIBGIFT_EXPORT
char * 
gi_stringf (char *buffer, size_t size, const char *fmt,...)
LIBGIFT_EXPORT char * gi_stringf_dup (const char *fmt,...)
LIBGIFT_EXPORT char * gi_strerrno (void)
LIBGIFT_EXPORT char * gi_stpcpy (char *dst, const char *src)
LIBGIFT_EXPORT size_t strspn (const char *str, const char *accept)
LIBGIFT_EXPORT size_t strcspn (const char *str, const char *reject)
LIBGIFT_EXPORT char * strpbrk (const char *str, const char *accept)
LIBGIFT_EXPORT size_t strlcpy (char *dst, const char *src, size_t siz)
LIBGIFT_EXPORT size_t strlcat (char *dst, const char *src, size_t siz)
LIBGIFT_EXPORT char * strsep (char **stringp, const char *delim)
LIBGIFT_EXPORT int strcasecmp (const char *s1, const char *s2)
LIBGIFT_EXPORT int strncasecmp (const char *s1, const char *s2, size_t n)
LIBGIFT_EXPORT int strcasecmp_s (const char *s1, const char *s2)
LIBGIFT_EXPORT int strcmp_s (const char *s1, const char *s2)
LIBGIFT_EXPORT size_t strlen_s (const char *str)
LIBGIFT_EXPORT size_t strlen0_s (const char *str)
LIBGIFT_EXPORT long strtol_s (const char *nptr, char **endptr, int base)
LIBGIFT_EXPORT unsigned long strtoul_s (const char *nptr, char **endptr, int base)
LIBGIFT_EXPORT char * strmove (char *dst, const char *src)
LIBGIFT_EXPORT char * strmove_s (char *dst, const char *src)
LIBGIFT_EXPORT char * strtrim_s (char *str)
LIBGIFT_EXPORT char * strupper_s (char *str)
LIBGIFT_EXPORT char * strlower_s (char *str)
LIBGIFT_EXPORT char * strdup_s (const char *str)
LIBGIFT_EXPORT void * memdup (const void *ptr, size_t len)
LIBGIFT_EXPORT void * memdup_s (const void *ptr, size_t len)


Detailed Description

Extended functions that follow a similar scheme to those provided by ANSI C in string.h.

Some of these functions are simply wrappers of their ANSI C counterparts to ensure safety when invalid parameters are specified. By convention, such functions will be suffixed with "_s".


Define Documentation

#define GFMT   gi_stringf
 

Simple convenience macros for using gi_stringf. Expect usage is as follows:

char buf[32]; puts (GFMT(GSZ(buf), "%s %s!", "Hello", "World"));


Function Documentation

LIBGIFT_EXPORT char* gi_stpcpy char *  dst,
const char *  src
 

Todo:
DOCME!

LIBGIFT_EXPORT char* gi_strerrno void   ) 
 

Wrapping interface for strerror(errno).

EXTERN_C_BEGIN LIBGIFT_EXPORT char* gi_stringf char *  buffer,
size_t  size,
const char *  fmt,
  ...
 

Identical to snprintf except that `buf' will be returned as a convenience to the caller.

LIBGIFT_EXPORT char* gi_stringf_dup const char *  fmt,
  ...
 

Similar to gi_stringf, but returns a dynamically allocated buffer. This interface is discouraged, and is provided for compatibility only.

LIBGIFT_EXPORT void* memdup_s const void *  ptr,
size_t  len
 

Safe memdup.

LIBGIFT_EXPORT int strcasecmp_s const char *  s1,
const char *  s2
 

Safe strcasecmp.

LIBGIFT_EXPORT int strcmp_s const char *  s1,
const char *  s2
 

Safe strcmp.

LIBGIFT_EXPORT char* strdup_s const char *  str  ) 
 

Safe strdup.

LIBGIFT_EXPORT size_t strlen0_s const char *  str  ) 
 

Safe strlen which also counts the NUL termination character.

LIBGIFT_EXPORT size_t strlen_s const char *  str  ) 
 

Safe strlen.

LIBGIFT_EXPORT char* strlower_s char *  str  ) 
 

See strupper_s, then guess.

LIBGIFT_EXPORT char* strmove_s char *  dst,
const char *  src
 

Safe strmove.

LIBGIFT_EXPORT long strtol_s const char *  nptr,
char **  endptr,
int  base
 

Safe strtol.

LIBGIFT_EXPORT unsigned long strtoul_s const char *  nptr,
char **  endptr,
int  base
 

Safe strtoul.

LIBGIFT_EXPORT char* strtrim_s char *  str  ) 
 

Removes leading and trailing whitespace from `str' according to isspace().

Note:
Leading whitespace is removed by shifting back the contents of the string using ::strmove.
Returns:
Pointer to `str' for convenience.

LIBGIFT_EXPORT char* strupper_s char *  str  ) 
 

Replace each character found in `str' (except the trailing NUL) with it's upperspace equivalent as given by toupper().

Returns:
Pointer to `str' for convenience.


Generated on Sun Aug 22 07:56:40 2004 by doxygen 1.3.7