xmlstring.h 5.1 KB

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