Simple C Expat Wrapper (SCEW)
1.1.7
|
This module defines a set of functions to work with text strings. More...
Files | |
file | str.h |
SCEW string functions. | |
Macros | |
#define | scew_memcpy(dst, src, n) memcpy (dst, src, sizeof (XML_Char) * (n)) |
Copy the number of given characters from src to dst. More... | |
#define | scew_memmove(dst, src, n) memmove (dst, src, sizeof (XML_Char) * (n)) |
Move the number of given characters from src to dst. More... | |
#define | _XT(str) str |
Creates a regular string or a wide character string. | |
#define | scew_printf printf |
See standard printf documentation. | |
#define | scew_fprintf fprintf |
See standard fprintf documentation. | |
#define | scew_vfprintf vfprintf |
See standard vfprintf documentation. | |
#define | scew_fputs fputs |
See standard fputs documentation. | |
#define | scew_fgets fgets |
See standard fgets documentation. | |
#define | scew_fputc fputc |
See standard fputc documentation. | |
#define | scew_fgetc fgetc |
See standard fgetc documentation. | |
#define | scew_strspn(s, accept) strspn (s, accept) |
See standard strspn documentation. | |
#define | scew_strcpy(dest, src) strcpy (dest, src) |
See standard strcpy documentation. | |
#define | scew_strcat(dest, src) strcat (dest, src) |
See standard strcat documentation. | |
#define | scew_strncpy(dest, src, n) strncpy (dest, src, (n)) |
See standard strncpy documentation. | |
#define | scew_strncat(dest, src, n) strncat (dest, src, (n)) |
See standard strncat documentation. | |
#define | scew_strlen(s) strlen (s) |
See standard strlen documentation. | |
#define | scew_isalnum(c) isalnum ((unsigned char)(c)) |
See standard isalnum documentation. | |
#define | scew_isalpha(c) isalpha ((unsigned char)(c)) |
See standard isalpha documentation. | |
#define | scew_iscntrl(c) iscntrl ((unsigned char)(c)) |
See standard iscntrl documentation. | |
#define | scew_isdigit(c) isdigit ((unsigned char)(c)) |
See standard isdigit documentation. | |
#define | scew_isxdigit(c) isxdigit ((unsigned char)(c)) |
See standard isxdigit documentation. | |
#define | scew_isgraph(c) isgraph ((unsigned char)(c)) |
See standard isgraph documentation. | |
#define | scew_islower(c) islower ((unsigned char)(c)) |
See standard islower documentation. | |
#define | scew_isupper(c) isupper ((unsigned char)(c)) |
See standard isupper documentation. | |
#define | scew_isprint(c) isprint ((unsigned char)(c)) |
See standard isprint documentation. | |
#define | scew_ispunct(c) ispunct ((unsigned char)(c)) |
See standard ispunct documentation. | |
#define | scew_isspace(c) isspace ((unsigned char)(c)) |
See standard isspace documentation. | |
Functions | |
SCEW_API int | scew_strcmp (XML_Char const *a, XML_Char const *b) |
Compares the two given strings s1 and s2. More... | |
SCEW_API XML_Char * | scew_strdup (XML_Char const *src) |
Creates a new copy of the given string. More... | |
SCEW_API void | scew_strtrim (XML_Char *src) |
Trims off extra spaces from the beginning and end of a string. More... | |
SCEW_API scew_bool | scew_isempty (XML_Char const *src) |
Tells whether the given string is empty. More... | |
SCEW_API XML_Char * | scew_strescape (XML_Char const *src) |
Escapes the given string for XML. More... | |
This module defines a set of functions to work with text strings.
SCEW has defined wrappers for standard C routines in order to work with regular and wide character strings (wchar_t). The wrappers are simple macros to call the appropiate functions in both cases.
Right now, wide character strings are only availabe in Windows platforms to provide UTF-16 support (XML_UNICODE_WCHAR_T needs to be defined at compile time).
#define scew_memcpy | ( | dst, | |
src, | |||
n | |||
) | memcpy (dst, src, sizeof (XML_Char) * (n)) |
Copy the number of given characters from src to dst.
See standard memcpy documentation.
#define scew_memmove | ( | dst, | |
src, | |||
n | |||
) | memmove (dst, src, sizeof (XML_Char) * (n)) |
Move the number of given characters from src to dst.
See standard memmove documentation.
SCEW_API int scew_strcmp | ( | XML_Char const * | a, |
XML_Char const * | b | ||
) |
Compares the two given strings s1 and s2.
SCEW_API XML_Char* scew_strdup | ( | XML_Char const * | src | ) |
Creates a new copy of the given string.
src | the string to be duplicated (might be NULL). |
SCEW_API void scew_strtrim | ( | XML_Char * | src | ) |
Trims off extra spaces from the beginning and end of a string.
The trimming is done in place.
src | the string to be trimmed off. |
SCEW_API scew_bool scew_isempty | ( | XML_Char const * | src | ) |
Tells whether the given string is empty.
That is, all characters are spaces, form-feed, newlines, etc. See isspace documentation to see the list of characters considered space.
src | the string to tell if its empty or not. |
SCEW_API XML_Char* scew_strescape | ( | XML_Char const * | src | ) |
Escapes the given string for XML.
This will substitute the general XML delimiters:
< > & ' "
to the pre-defined XML entities, respectively:
< > & ' "
A new escaped string will be allocated. Thus, the user is responsible of freeing the new string.
src | the string to be escaped. |