1/**
2 * @file
3 *
4 * @brief set of routines to process strings
5 *
6 * type and interfaces needed for the internal string handling
7 * of the library, especially UTF8 processing.
8 *
9 * @copyright See Copyright for the status of this software.
10 *
11 * @author Daniel Veillard
12 */
13
14#ifndef __XML_STRING_H__
15#define __XML_STRING_H__
16
17#include <stdarg.h>
18#include <libxml/xmlversion.h>
19
20#ifdef __cplusplus
21extern "C" {
22#endif
23
24/**
25 * This is a basic byte in an UTF-8 encoded string.
26 * It's unsigned allowing to pinpoint case where char * are assigned
27 * to xmlChar * (possibly making serialization back impossible).
28 */
29typedef unsigned char xmlChar;
30
31/**
32 * Macro to cast a string to an xmlChar * when one know its safe.
33 */
34#define BAD_CAST (xmlChar *)
35
36/*
37 * xmlChar handling
38 */
39XMLPUBFUN xmlChar *
40 xmlStrdup (const xmlChar *cur);
41XMLPUBFUN xmlChar *
42 xmlStrndup (const xmlChar *cur,
43 int len);
44XMLPUBFUN xmlChar *
45 xmlCharStrndup (const char *cur,
46 int len);
47XMLPUBFUN xmlChar *
48 xmlCharStrdup (const char *cur);
49XMLPUBFUN xmlChar *
50 xmlStrsub (const xmlChar *str,
51 int start,
52 int len);
53XMLPUBFUN const xmlChar *
54 xmlStrchr (const xmlChar *str,
55 xmlChar val);
56XMLPUBFUN const xmlChar *
57 xmlStrstr (const xmlChar *str,
58 const xmlChar *val);
59XMLPUBFUN const xmlChar *
60 xmlStrcasestr (const xmlChar *str,
61 const xmlChar *val);
62XMLPUBFUN int
63 xmlStrcmp (const xmlChar *str1,
64 const xmlChar *str2);
65XMLPUBFUN int
66 xmlStrncmp (const xmlChar *str1,
67 const xmlChar *str2,
68 int len);
69XMLPUBFUN int
70 xmlStrcasecmp (const xmlChar *str1,
71 const xmlChar *str2);
72XMLPUBFUN int
73 xmlStrncasecmp (const xmlChar *str1,
74 const xmlChar *str2,
75 int len);
76XMLPUBFUN int
77 xmlStrEqual (const xmlChar *str1,
78 const xmlChar *str2);
79XMLPUBFUN int
80 xmlStrQEqual (const xmlChar *pref,
81 const xmlChar *name,
82 const xmlChar *str);
83XMLPUBFUN int
84 xmlStrlen (const xmlChar *str);
85XMLPUBFUN xmlChar *
86 xmlStrcat (xmlChar *cur,
87 const xmlChar *add);
88XMLPUBFUN xmlChar *
89 xmlStrncat (xmlChar *cur,
90 const xmlChar *add,
91 int len);
92XMLPUBFUN xmlChar *
93 xmlStrncatNew (const xmlChar *str1,
94 const xmlChar *str2,
95 int len);
96XMLPUBFUN int
97 xmlStrPrintf (xmlChar *buf,
98 int len,
99 const char *msg,
100 ...) LIBXML_ATTR_FORMAT(3,4);
101XMLPUBFUN int
102 xmlStrVPrintf (xmlChar *buf,
103 int len,
104 const char *msg,
105 va_list ap) LIBXML_ATTR_FORMAT(3,0);
106
107XMLPUBFUN int
108 xmlGetUTF8Char (const unsigned char *utf,
109 int *len);
110XMLPUBFUN int
111 xmlCheckUTF8 (const unsigned char *utf);
112XMLPUBFUN int
113 xmlUTF8Strsize (const xmlChar *utf,
114 int len);
115XMLPUBFUN xmlChar *
116 xmlUTF8Strndup (const xmlChar *utf,
117 int len);
118XMLPUBFUN const xmlChar *
119 xmlUTF8Strpos (const xmlChar *utf,
120 int pos);
121XMLPUBFUN int
122 xmlUTF8Strloc (const xmlChar *utf,
123 const xmlChar *utfchar);
124XMLPUBFUN xmlChar *
125 xmlUTF8Strsub (const xmlChar *utf,
126 int start,
127 int len);
128XMLPUBFUN int
129 xmlUTF8Strlen (const xmlChar *utf);
130XMLPUBFUN int
131 xmlUTF8Size (const xmlChar *utf);
132XMLPUBFUN int
133 xmlUTF8Charcmp (const xmlChar *utf1,
134 const xmlChar *utf2);
135
136#ifdef __cplusplus
137}
138#endif
139#endif /* __XML_STRING_H__ */
140