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