Simple C Expat Wrapper (SCEW)  1.1.7
str.h
Go to the documentation of this file.
1 
44 #ifndef STR_H_0212011305
45 #define STR_H_0212011305
46 
47 #include "bool.h"
48 
49 #include "export.h"
50 
51 #include <expat.h>
52 
53 #include <string.h>
54 
63 #define scew_memcpy(dst, src, n) memcpy (dst, src, sizeof (XML_Char) * (n))
64 
69 #define scew_memmove(dst, src, n) memmove (dst, src, sizeof (XML_Char) * (n))
70 
71 #ifdef XML_UNICODE_WCHAR_T
72 
73 #include <wchar.h>
74 #include <wctype.h>
75 
76 #define _XT(str) L##str
77 
78 #define scew_printf wprintf
79 #define scew_fprintf fwprintf
80 #define scew_vfprintf vfwprintf
81 #define scew_fputs fputws
82 #define scew_fgets fgetws
83 #define scew_fputc fputwc
84 #define scew_fgetc fgetwc
85 
86 #define scew_strspn(wcs, accept) wcsspn (wcs, accept)
87 #define scew_strcpy(dest, src) wcscpy (dest, src)
88 #define scew_strcat(dest, src) wcscat (dest, src)
89 #define scew_strncpy(dest, src, n) wcsncpy (dest, src, n)
90 #define scew_strncat(dest, src, n) wcsncat (dest, src, n)
91 #define scew_strlen(s) wcslen (s)
92 
93 #define scew_isalnum(c) iswalnum ((c))
94 #define scew_isalpha(c) iswalpha ((c))
95 #define scew_iscntrl(c) iswcntrl ((c))
96 #define scew_isdigit(c) iswdigit ((c))
97 #define scew_isxdigit(c) iswxdigit ((c))
98 #define scew_isgraph(c) iswgraph ((c))
99 #define scew_islower(c) iswlower ((c))
100 #define scew_isupper(c) iswupper ((c))
101 #define scew_isprint(c) iswprint ((c))
102 #define scew_ispunct(c) iswpunct ((c))
103 #define scew_isspace(c) iswspace ((c))
104 
105 #else /* XML_UNICODE_WCHAR_T */
106 
107 #include <ctype.h>
108 
112 #define _XT(str) str
113 
117 #define scew_printf printf
118 
122 #define scew_fprintf fprintf
123 
127 #define scew_vfprintf vfprintf
128 
132 #define scew_fputs fputs
133 
137 #define scew_fgets fgets
138 
142 #define scew_fputc fputc
143 
147 #define scew_fgetc fgetc
148 
149 
150 
154 #define scew_strspn(s, accept) strspn (s, accept)
155 
159 #define scew_strcpy(dest, src) strcpy (dest, src)
160 
164 #define scew_strcat(dest, src) strcat (dest, src)
165 
169 #define scew_strncpy(dest, src, n) strncpy (dest, src, (n))
170 
174 #define scew_strncat(dest, src, n) strncat (dest, src, (n))
175 
179 #define scew_strlen(s) strlen (s)
180 
181 
182 
186 #define scew_isalnum(c) isalnum ((unsigned char)(c))
187 
191 #define scew_isalpha(c) isalpha ((unsigned char)(c))
192 
196 #define scew_iscntrl(c) iscntrl ((unsigned char)(c))
197 
201 #define scew_isdigit(c) isdigit ((unsigned char)(c))
202 
206 #define scew_isxdigit(c) isxdigit ((unsigned char)(c))
207 
211 #define scew_isgraph(c) isgraph ((unsigned char)(c))
212 
216 #define scew_islower(c) islower ((unsigned char)(c))
217 
221 #define scew_isupper(c) isupper ((unsigned char)(c))
222 
226 #define scew_isprint(c) isprint ((unsigned char)(c))
227 
231 #define scew_ispunct(c) ispunct ((unsigned char)(c))
232 
236 #define scew_isspace(c) isspace ((unsigned char)(c))
237 
239 #endif /* XML_UNICODE_WCHAR_T */
240 
241 #ifdef __cplusplus
242 extern "C" {
243 #endif /* __cplusplus */
244 
253 extern SCEW_API int scew_strcmp (XML_Char const *a, XML_Char const *b);
254 
264 extern SCEW_API XML_Char* scew_strdup (XML_Char const *src);
265 
276 extern SCEW_API void scew_strtrim (XML_Char *src);
277 
291 extern SCEW_API scew_bool scew_isempty (XML_Char const *src);
292 
315 extern SCEW_API XML_Char* scew_strescape (XML_Char const *src);
316 
317 #ifdef __cplusplus
318 }
319 #endif /* __cplusplus */
320 
321 #endif /* STR_H_0212011305 */
SCEW shared library support.
unsigned char scew_bool
This should be defined using stdbool.h when C99 is available.
Definition: bool.h:35
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.
SCEW_API scew_bool scew_isempty(XML_Char const *src)
Tells whether the given string is empty.
SCEW_API XML_Char * scew_strescape(XML_Char const *src)
Escapes the given string for XML.
SCEW_API void scew_strtrim(XML_Char *src)
Trims off extra spaces from the beginning and end of a string.
SCEW boolean type declaration.