blob: f117010c71a462b3bfc5cf7837fcb2c928e2f13b [file] [log] [blame]
Andrew Scull5e1ddfa2018-08-14 10:06:54 +01001/*===-- clang-c/CXString.h - C Index strings --------------------*- C -*-===*\
2|* *|
Andrew Walbran16937d02019-10-22 13:54:20 +01003|* 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 Scull5e1ddfa2018-08-14 10:06:54 +01007|* *|
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 Deprezf4ef2d02021-04-20 13:36:24 +020017#include "clang-c/ExternC.h"
Andrew Scull5e1ddfa2018-08-14 10:06:54 +010018#include "clang-c/Platform.h"
19
Olivier Deprezf4ef2d02021-04-20 13:36:24 +020020LLVM_CLANG_C_EXTERN_C_BEGIN
Andrew Scull5e1ddfa2018-08-14 10:06:54 +010021
22/**
23 * \defgroup CINDEX_STRING String manipulation routines
24 * \ingroup CINDEX
25 *
26 * @{
27 */
28
29/**
Andrew Scullcdfcccc2018-10-05 20:58:37 +010030 * A character string.
Andrew Scull5e1ddfa2018-08-14 10:06:54 +010031 *
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 */
37typedef struct {
38 const void *data;
39 unsigned private_flags;
40} CXString;
41
42typedef struct {
43 CXString *Strings;
44 unsigned Count;
45} CXStringSet;
46
47/**
Andrew Scullcdfcccc2018-10-05 20:58:37 +010048 * Retrieve the character data associated with the given string.
Andrew Scull5e1ddfa2018-08-14 10:06:54 +010049 */
50CINDEX_LINKAGE const char *clang_getCString(CXString string);
51
52/**
Andrew Scullcdfcccc2018-10-05 20:58:37 +010053 * Free the given string.
Andrew Scull5e1ddfa2018-08-14 10:06:54 +010054 */
55CINDEX_LINKAGE void clang_disposeString(CXString string);
56
57/**
Andrew Scullcdfcccc2018-10-05 20:58:37 +010058 * Free the given string set.
Andrew Scull5e1ddfa2018-08-14 10:06:54 +010059 */
60CINDEX_LINKAGE void clang_disposeStringSet(CXStringSet *set);
61
62/**
63 * @}
64 */
65
Olivier Deprezf4ef2d02021-04-20 13:36:24 +020066LLVM_CLANG_C_EXTERN_C_END
67
Andrew Scull5e1ddfa2018-08-14 10:06:54 +010068#endif
69