xmlstring.h 4.5 KB

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