CXString.h 2.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869
  1. /*===-- clang-c/CXString.h - C Index strings --------------------*- C -*-===*\
  2. |* *|
  3. |* Part of the LLVM Project, under the Apache License v2.0 with LLVM *|
  4. |* Exceptions. *|
  5. |* See https://llvm.org/LICENSE.txt for license information. *|
  6. |* SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception *|
  7. |* *|
  8. |*===----------------------------------------------------------------------===*|
  9. |* *|
  10. |* This header provides the interface to C Index strings. *|
  11. |* *|
  12. \*===----------------------------------------------------------------------===*/
  13. #ifndef LLVM_CLANG_C_CXSTRING_H
  14. #define LLVM_CLANG_C_CXSTRING_H
  15. #include "clang-c/ExternC.h"
  16. #include "clang-c/Platform.h"
  17. LLVM_CLANG_C_EXTERN_C_BEGIN
  18. /**
  19. * \defgroup CINDEX_STRING String manipulation routines
  20. * \ingroup CINDEX
  21. *
  22. * @{
  23. */
  24. /**
  25. * A character string.
  26. *
  27. * The \c CXString type is used to return strings from the interface when
  28. * the ownership of that string might differ from one call to the next.
  29. * Use \c clang_getCString() to retrieve the string data and, once finished
  30. * with the string data, call \c clang_disposeString() to free the string.
  31. */
  32. typedef struct {
  33. const void *data;
  34. unsigned private_flags;
  35. } CXString;
  36. typedef struct {
  37. CXString *Strings;
  38. unsigned Count;
  39. } CXStringSet;
  40. /**
  41. * Retrieve the character data associated with the given string.
  42. */
  43. CINDEX_LINKAGE const char *clang_getCString(CXString string);
  44. /**
  45. * Free the given string.
  46. */
  47. CINDEX_LINKAGE void clang_disposeString(CXString string);
  48. /**
  49. * Free the given string set.
  50. */
  51. CINDEX_LINKAGE void clang_disposeStringSet(CXStringSet *set);
  52. /**
  53. * @}
  54. */
  55. LLVM_CLANG_C_EXTERN_C_END
  56. #endif