Andrew Scull | 5e1ddfa | 2018-08-14 10:06:54 +0100 | [diff] [blame] | 1 | /*===-- clang-c/CXString.h - C Index strings --------------------*- C -*-===*\ |
| 2 | |* *| |
Andrew Walbran | 16937d0 | 2019-10-22 13:54:20 +0100 | [diff] [blame] | 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 *| |
Andrew Scull | 5e1ddfa | 2018-08-14 10:06:54 +0100 | [diff] [blame] | 7 | |* *| |
| 8 | |*===----------------------------------------------------------------------===*| |
| 9 | |* *| |
| 10 | |* This header provides the interface to C Index strings. *| |
| 11 | |* *| |
| 12 | \*===----------------------------------------------------------------------===*/ |
| 13 | |
| 14 | #ifndef LLVM_CLANG_C_CXSTRING_H |
| 15 | #define LLVM_CLANG_C_CXSTRING_H |
| 16 | |
Olivier Deprez | f4ef2d0 | 2021-04-20 13:36:24 +0200 | [diff] [blame] | 17 | #include "clang-c/ExternC.h" |
Andrew Scull | 5e1ddfa | 2018-08-14 10:06:54 +0100 | [diff] [blame] | 18 | #include "clang-c/Platform.h" |
| 19 | |
Olivier Deprez | f4ef2d0 | 2021-04-20 13:36:24 +0200 | [diff] [blame] | 20 | LLVM_CLANG_C_EXTERN_C_BEGIN |
Andrew Scull | 5e1ddfa | 2018-08-14 10:06:54 +0100 | [diff] [blame] | 21 | |
| 22 | /** |
| 23 | * \defgroup CINDEX_STRING String manipulation routines |
| 24 | * \ingroup CINDEX |
| 25 | * |
| 26 | * @{ |
| 27 | */ |
| 28 | |
| 29 | /** |
Andrew Scull | cdfcccc | 2018-10-05 20:58:37 +0100 | [diff] [blame] | 30 | * A character string. |
Andrew Scull | 5e1ddfa | 2018-08-14 10:06:54 +0100 | [diff] [blame] | 31 | * |
| 32 | * The \c CXString type is used to return strings from the interface when |
| 33 | * the ownership of that string might differ from one call to the next. |
| 34 | * Use \c clang_getCString() to retrieve the string data and, once finished |
| 35 | * with the string data, call \c clang_disposeString() to free the string. |
| 36 | */ |
| 37 | typedef struct { |
| 38 | const void *data; |
| 39 | unsigned private_flags; |
| 40 | } CXString; |
| 41 | |
| 42 | typedef struct { |
| 43 | CXString *Strings; |
| 44 | unsigned Count; |
| 45 | } CXStringSet; |
| 46 | |
| 47 | /** |
Andrew Scull | cdfcccc | 2018-10-05 20:58:37 +0100 | [diff] [blame] | 48 | * Retrieve the character data associated with the given string. |
Andrew Scull | 5e1ddfa | 2018-08-14 10:06:54 +0100 | [diff] [blame] | 49 | */ |
| 50 | CINDEX_LINKAGE const char *clang_getCString(CXString string); |
| 51 | |
| 52 | /** |
Andrew Scull | cdfcccc | 2018-10-05 20:58:37 +0100 | [diff] [blame] | 53 | * Free the given string. |
Andrew Scull | 5e1ddfa | 2018-08-14 10:06:54 +0100 | [diff] [blame] | 54 | */ |
| 55 | CINDEX_LINKAGE void clang_disposeString(CXString string); |
| 56 | |
| 57 | /** |
Andrew Scull | cdfcccc | 2018-10-05 20:58:37 +0100 | [diff] [blame] | 58 | * Free the given string set. |
Andrew Scull | 5e1ddfa | 2018-08-14 10:06:54 +0100 | [diff] [blame] | 59 | */ |
| 60 | CINDEX_LINKAGE void clang_disposeStringSet(CXStringSet *set); |
| 61 | |
| 62 | /** |
| 63 | * @} |
| 64 | */ |
| 65 | |
Olivier Deprez | f4ef2d0 | 2021-04-20 13:36:24 +0200 | [diff] [blame] | 66 | LLVM_CLANG_C_EXTERN_C_END |
| 67 | |
Andrew Scull | 5e1ddfa | 2018-08-14 10:06:54 +0100 | [diff] [blame] | 68 | #endif |
| 69 | |