blob: 1eb3442ccb24a4d100545f6e634e68599f8478bc [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
17#include "clang-c/Platform.h"
18
19#ifdef __cplusplus
20extern "C" {
21#endif
22
23/**
24 * \defgroup CINDEX_STRING String manipulation routines
25 * \ingroup CINDEX
26 *
27 * @{
28 */
29
30/**
Andrew Scullcdfcccc2018-10-05 20:58:37 +010031 * A character string.
Andrew Scull5e1ddfa2018-08-14 10:06:54 +010032 *
33 * The \c CXString type is used to return strings from the interface when
34 * the ownership of that string might differ from one call to the next.
35 * Use \c clang_getCString() to retrieve the string data and, once finished
36 * with the string data, call \c clang_disposeString() to free the string.
37 */
38typedef struct {
39 const void *data;
40 unsigned private_flags;
41} CXString;
42
43typedef struct {
44 CXString *Strings;
45 unsigned Count;
46} CXStringSet;
47
48/**
Andrew Scullcdfcccc2018-10-05 20:58:37 +010049 * Retrieve the character data associated with the given string.
Andrew Scull5e1ddfa2018-08-14 10:06:54 +010050 */
51CINDEX_LINKAGE const char *clang_getCString(CXString string);
52
53/**
Andrew Scullcdfcccc2018-10-05 20:58:37 +010054 * Free the given string.
Andrew Scull5e1ddfa2018-08-14 10:06:54 +010055 */
56CINDEX_LINKAGE void clang_disposeString(CXString string);
57
58/**
Andrew Scullcdfcccc2018-10-05 20:58:37 +010059 * Free the given string set.
Andrew Scull5e1ddfa2018-08-14 10:06:54 +010060 */
61CINDEX_LINKAGE void clang_disposeStringSet(CXStringSet *set);
62
63/**
64 * @}
65 */
66
67#ifdef __cplusplus
68}
69#endif
70#endif
71