clangc 1.0.0.pre
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/ext/clangc/_clangc_functions.c +303 -0
- data/ext/clangc/_clangc_functions.h +51 -0
- data/ext/clangc/clangc.c +376 -0
- data/ext/clangc/class_CodeCompleteResults.c +186 -0
- data/ext/clangc/class_CodeCompleteResults.h +51 -0
- data/ext/clangc/class_CompletionResult.c +98 -0
- data/ext/clangc/class_CompletionResult.h +36 -0
- data/ext/clangc/class_CompletionString.c +231 -0
- data/ext/clangc/class_CompletionString.h +57 -0
- data/ext/clangc/class_Cursor.c +1677 -0
- data/ext/clangc/class_Cursor.h +259 -0
- data/ext/clangc/class_CursorSet.c +109 -0
- data/ext/clangc/class_CursorSet.h +39 -0
- data/ext/clangc/class_Diagnostic.c +322 -0
- data/ext/clangc/class_Diagnostic.h +66 -0
- data/ext/clangc/class_File.c +145 -0
- data/ext/clangc/class_File.h +45 -0
- data/ext/clangc/class_Index.c +461 -0
- data/ext/clangc/class_Index.h +58 -0
- data/ext/clangc/class_Module.c +181 -0
- data/ext/clangc/class_Module.h +51 -0
- data/ext/clangc/class_OverriddenCursor.c +51 -0
- data/ext/clangc/class_OverriddenCursor.h +31 -0
- data/ext/clangc/class_SourceLocation.c +197 -0
- data/ext/clangc/class_SourceLocation.h +45 -0
- data/ext/clangc/class_SourceRange.c +123 -0
- data/ext/clangc/class_SourceRange.h +42 -0
- data/ext/clangc/class_TranslationUnit.c +457 -0
- data/ext/clangc/class_TranslationUnit.h +63 -0
- data/ext/clangc/class_Type.c +564 -0
- data/ext/clangc/class_Type.h +108 -0
- data/ext/clangc/constants.c +660 -0
- data/ext/clangc/constants.h +21 -0
- data/ext/clangc/extconf.rb +34 -0
- data/ext/clangc/macros.h +230 -0
- data/lib/clangc.rb +397 -0
- metadata +95 -0
@@ -0,0 +1,186 @@
|
|
1
|
+
/*
|
2
|
+
* ruby-clangc ruby bindings for the C interface of Clang
|
3
|
+
* Copyright (C) 2016 Cedric Le Moigne <cedlemo@gmx.com>
|
4
|
+
*
|
5
|
+
* This program is free software: you can redistribute it and/or modify
|
6
|
+
* it under the terms of the GNU General Public License as published by
|
7
|
+
* the Free Software Foundation, either version 3 of the License, or
|
8
|
+
* (at your option) any later version.
|
9
|
+
*
|
10
|
+
* This program is distributed in the hope that it will be useful,
|
11
|
+
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
12
|
+
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
13
|
+
* GNU General Public License for more details.
|
14
|
+
*
|
15
|
+
* You should have received a copy of the GNU General Public License
|
16
|
+
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
17
|
+
*/
|
18
|
+
/*CodeCompleteResults ruby class*/
|
19
|
+
#include "class_CodeCompleteResults.h"
|
20
|
+
#include "class_CompletionResult.h"
|
21
|
+
#include "class_Diagnostic.h"
|
22
|
+
#include "macros.h"
|
23
|
+
|
24
|
+
static void c_CodeCompleteResults_struct_free(CodeCompleteResults_t *s)
|
25
|
+
{
|
26
|
+
if (s)
|
27
|
+
{
|
28
|
+
if (s->data) clang_disposeCodeCompleteResults(s->data);
|
29
|
+
ruby_xfree(s);
|
30
|
+
}
|
31
|
+
}
|
32
|
+
|
33
|
+
static void c_CodeCompleteResults_mark(void *s)
|
34
|
+
{
|
35
|
+
if (s)
|
36
|
+
{
|
37
|
+
CodeCompleteResults_t *t = (CodeCompleteResults_t *) s;
|
38
|
+
rb_gc_mark(t->parent);
|
39
|
+
}
|
40
|
+
}
|
41
|
+
|
42
|
+
VALUE
|
43
|
+
c_CodeCompleteResults_struct_alloc(VALUE klass)
|
44
|
+
{
|
45
|
+
|
46
|
+
CodeCompleteResults_t *ptr;
|
47
|
+
ptr = (CodeCompleteResults_t *) ruby_xmalloc(sizeof(CodeCompleteResults_t));
|
48
|
+
ptr->data = NULL;
|
49
|
+
ptr->parent = Qnil;
|
50
|
+
|
51
|
+
return Data_Wrap_Struct(
|
52
|
+
klass, NULL, c_CodeCompleteResults_struct_free, (void *) ptr);
|
53
|
+
}
|
54
|
+
|
55
|
+
/**
|
56
|
+
* call-seq:
|
57
|
+
* Clangc::CodeCompleteResults#num_results => Number
|
58
|
+
*
|
59
|
+
* Retrieve the number of Clangc::CompletionResult
|
60
|
+
*
|
61
|
+
* Not based on libclang function
|
62
|
+
*/
|
63
|
+
VALUE
|
64
|
+
c_CodeCompleteResults_get_num_results(VALUE self)
|
65
|
+
{
|
66
|
+
CodeCompleteResults_t *c;
|
67
|
+
Data_Get_Struct(self, CodeCompleteResults_t, c);
|
68
|
+
|
69
|
+
return CUINT_2_NUM(c->data->NumResults);
|
70
|
+
}
|
71
|
+
|
72
|
+
/**
|
73
|
+
* call-seq:
|
74
|
+
* Clangc::CodeCompleteResults#results(index) => Clangc::CompletionResult
|
75
|
+
*
|
76
|
+
* Retrieve Clangc::CompletionResult instance a index
|
77
|
+
*
|
78
|
+
* Return nil if index < 0 or index >= num results
|
79
|
+
* Not based on libclang function
|
80
|
+
*/
|
81
|
+
VALUE
|
82
|
+
c_CodeCompleteResults_get_result(VALUE self, VALUE index)
|
83
|
+
{
|
84
|
+
CodeCompleteResults_t *c;
|
85
|
+
Data_Get_Struct(self, CodeCompleteResults_t, c);
|
86
|
+
unsigned i = NUM2UINT(index);
|
87
|
+
|
88
|
+
if (i < 0 || i > c->data->NumResults) return Qnil;
|
89
|
+
|
90
|
+
VALUE result;
|
91
|
+
CompletionResult_t *cr;
|
92
|
+
R_GET_CLASS_DATA("Clangc", CompletionResult, result, cr);
|
93
|
+
cr->data = &(c->data->Results[i]);
|
94
|
+
cr->parent = self;
|
95
|
+
|
96
|
+
return result;
|
97
|
+
}
|
98
|
+
|
99
|
+
/**
|
100
|
+
* call-seq:
|
101
|
+
* Clangc::CodeCompleteResults#container_usr => String
|
102
|
+
*
|
103
|
+
* Returns the USR for the container for the current code completion
|
104
|
+
* context. If there is not a container for the current context, this
|
105
|
+
* function will return the empty string.
|
106
|
+
*/
|
107
|
+
VALUE
|
108
|
+
c_CodeCompleteResults_get_container_usr(VALUE self)
|
109
|
+
{
|
110
|
+
CodeCompleteResults_t *c;
|
111
|
+
Data_Get_Struct(self, CodeCompleteResults_t, c);
|
112
|
+
|
113
|
+
return CXSTR_2_RVAL(clang_codeCompleteGetContainerUSR(c->data));
|
114
|
+
}
|
115
|
+
/**
|
116
|
+
* call-seq:
|
117
|
+
* Clangc::CodeCompleteResults#num_diagnostics => Number
|
118
|
+
*
|
119
|
+
* Determine the number of diagnostics produced prior to the
|
120
|
+
* location where code completion was performed.
|
121
|
+
*/
|
122
|
+
VALUE
|
123
|
+
c_CodeCompleteResults_get_num_diagnostics(VALUE self)
|
124
|
+
{
|
125
|
+
CodeCompleteResults_t *c;
|
126
|
+
Data_Get_Struct(self, CodeCompleteResults_t, c);
|
127
|
+
|
128
|
+
return CUINT_2_NUM(clang_codeCompleteGetNumDiagnostics(c->data));
|
129
|
+
}
|
130
|
+
|
131
|
+
/**
|
132
|
+
* call-seq:
|
133
|
+
* Clangc::CodeCompleteResults#diagnostic(index) => Clangc::Diagnostic
|
134
|
+
*
|
135
|
+
* Retrieve a diagnostic associated with the given code completion.
|
136
|
+
*/
|
137
|
+
VALUE
|
138
|
+
c_CodeCompleteResults_get_diagnostic(VALUE self, VALUE index)
|
139
|
+
{
|
140
|
+
CodeCompleteResults_t *c;
|
141
|
+
Data_Get_Struct(self, CodeCompleteResults_t, c);
|
142
|
+
|
143
|
+
VALUE diagnostic;
|
144
|
+
Diagnostic_t *d;
|
145
|
+
R_GET_CLASS_DATA("Clangc", Diagnostic, diagnostic, d);
|
146
|
+
|
147
|
+
d->data = clang_codeCompleteGetDiagnostic(c->data, NUM2UINT(index));
|
148
|
+
d->parent = c->parent;
|
149
|
+
|
150
|
+
return diagnostic;
|
151
|
+
}
|
152
|
+
|
153
|
+
/**
|
154
|
+
* call-seq:
|
155
|
+
* Clangc::CodeCompleteResults#sort_results => nil
|
156
|
+
*
|
157
|
+
* Sort the code-completion results in case-insensitive alphabetical
|
158
|
+
* order.
|
159
|
+
*/
|
160
|
+
VALUE
|
161
|
+
c_CodeCompleteResults_sort_results(VALUE self)
|
162
|
+
{
|
163
|
+
CodeCompleteResults_t *c;
|
164
|
+
Data_Get_Struct(self, CodeCompleteResults_t, c);
|
165
|
+
|
166
|
+
clang_sortCodeCompletionResults(c->data->Results, c->data->NumResults);
|
167
|
+
return Qnil;
|
168
|
+
}
|
169
|
+
|
170
|
+
/**
|
171
|
+
* call-seq:
|
172
|
+
* Clangc::CodeCompleteResults#contexts => Number
|
173
|
+
*
|
174
|
+
* Determines what completions are appropriate for the context
|
175
|
+
* the given code completion.
|
176
|
+
*
|
177
|
+
* the kinds of completions that are appropriate for use
|
178
|
+
* along with the given code completion results.
|
179
|
+
*/
|
180
|
+
VALUE
|
181
|
+
c_CodeCompleteResults_get_contexts(VALUE self)
|
182
|
+
{
|
183
|
+
CodeCompleteResults_t *c;
|
184
|
+
Data_Get_Struct(self, CodeCompleteResults_t, c);
|
185
|
+
CULLONG_2_NUM(clang_codeCompleteGetContexts(c->data));
|
186
|
+
}
|
@@ -0,0 +1,51 @@
|
|
1
|
+
/*
|
2
|
+
* ruby-clangc ruby bindings for the C interface of Clang
|
3
|
+
* Copyright (C) 2016 Cedric Le Moigne <cedlemo@gmx.com>
|
4
|
+
*
|
5
|
+
* This program is free software: you can redistribute it and/or modify
|
6
|
+
* it under the terms of the GNU General Public License as published by
|
7
|
+
* the Free Software Foundation, either version 3 of the License, or
|
8
|
+
* (at your option) any later version.
|
9
|
+
*
|
10
|
+
* This program is distributed in the hope that it will be useful,
|
11
|
+
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
12
|
+
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
13
|
+
* GNU General Public License for more details.
|
14
|
+
*
|
15
|
+
* You should have received a copy of the GNU General Public License
|
16
|
+
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
17
|
+
*/
|
18
|
+
#ifndef CODECOMPLETERESULTS_H
|
19
|
+
#define CODECOMPLETERESULTS_H
|
20
|
+
#include <ruby/ruby.h>
|
21
|
+
#include "clang-c/Index.h"
|
22
|
+
typedef struct CodeCompleteResults_t
|
23
|
+
{
|
24
|
+
CXCodeCompleteResults *data;
|
25
|
+
VALUE parent;
|
26
|
+
} CodeCompleteResults_t;
|
27
|
+
|
28
|
+
VALUE
|
29
|
+
c_CodeCompleteResults_struct_alloc(VALUE);
|
30
|
+
|
31
|
+
VALUE
|
32
|
+
c_CodeCompleteResults_get_num_results(VALUE);
|
33
|
+
|
34
|
+
VALUE
|
35
|
+
c_CodeCompleteResults_get_result(VALUE, VALUE);
|
36
|
+
|
37
|
+
VALUE
|
38
|
+
c_CodeCompleteResults_get_container_usr(VALUE);
|
39
|
+
|
40
|
+
VALUE
|
41
|
+
c_CodeCompleteResults_get_num_diagnostics(VALUE);
|
42
|
+
|
43
|
+
VALUE
|
44
|
+
c_CodeCompleteResults_get_diagnostic(VALUE, VALUE);
|
45
|
+
|
46
|
+
VALUE
|
47
|
+
c_CodeCompleteResults_sort_results(VALUE);
|
48
|
+
|
49
|
+
VALUE
|
50
|
+
c_CodeCompleteResults_get_contexts(VALUE);
|
51
|
+
#endif // CODECOMPLETERESULTS_H
|
@@ -0,0 +1,98 @@
|
|
1
|
+
/*
|
2
|
+
* ruby-clangc ruby bindings for the C interface of Clang
|
3
|
+
* Copyright (C) 2016 Cedric Le Moigne <cedlemo@gmx.com>
|
4
|
+
*
|
5
|
+
* This program is free software: you can redistribute it and/or modify
|
6
|
+
* it under the terms of the GNU General Public License as published by
|
7
|
+
* the Free Software Foundation, either version 3 of the License, or
|
8
|
+
* (at your option) any later version.
|
9
|
+
*
|
10
|
+
* This program is distributed in the hope that it will be useful,
|
11
|
+
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
12
|
+
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
13
|
+
* GNU General Public License for more details.
|
14
|
+
*
|
15
|
+
* You should have received a copy of the GNU General Public License
|
16
|
+
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
17
|
+
*/
|
18
|
+
/*CompletionResult ruby class*/
|
19
|
+
#include "class_CompletionResult.h"
|
20
|
+
#include "class_CompletionString.h"
|
21
|
+
#include "macros.h"
|
22
|
+
|
23
|
+
static void c_CompletionResult_struct_free(CompletionResult_t *s)
|
24
|
+
{
|
25
|
+
if (s)
|
26
|
+
{
|
27
|
+
|
28
|
+
ruby_xfree(s);
|
29
|
+
}
|
30
|
+
}
|
31
|
+
|
32
|
+
static void c_CompletionResult_mark(void *s)
|
33
|
+
{
|
34
|
+
if (s)
|
35
|
+
{
|
36
|
+
CompletionResult_t *t = (CompletionResult_t *) s;
|
37
|
+
rb_gc_mark(t->parent);
|
38
|
+
}
|
39
|
+
}
|
40
|
+
|
41
|
+
VALUE
|
42
|
+
c_CompletionResult_struct_alloc(VALUE klass)
|
43
|
+
{
|
44
|
+
|
45
|
+
CompletionResult_t *ptr;
|
46
|
+
ptr = (CompletionResult_t *) ruby_xmalloc(sizeof(CompletionResult_t));
|
47
|
+
ptr->data = NULL;
|
48
|
+
ptr->parent = Qnil;
|
49
|
+
|
50
|
+
return Data_Wrap_Struct(
|
51
|
+
klass, NULL, c_CompletionResult_struct_free, (void *) ptr);
|
52
|
+
}
|
53
|
+
|
54
|
+
/*
|
55
|
+
* call-seq:
|
56
|
+
* Clangc::CompletionResult#cursor_kind => Clangc::CursorKind
|
57
|
+
*
|
58
|
+
* \brief The kind of entity that this completion refers to.
|
59
|
+
*
|
60
|
+
* The cursor kind will be a macro, keyword, or a declaration (one of the
|
61
|
+
* *Decl cursor kinds), describing the entity that the completion is
|
62
|
+
* referring to.
|
63
|
+
*
|
64
|
+
* In the future, we would like to provide a full cursor, to allow
|
65
|
+
* the client to extract additional information from declaration.
|
66
|
+
* Get
|
67
|
+
* */
|
68
|
+
VALUE
|
69
|
+
c_CompletionResult_get_cursor_kind(VALUE self)
|
70
|
+
{
|
71
|
+
CompletionResult_t *c;
|
72
|
+
Data_Get_Struct(self, CompletionResult_t, c);
|
73
|
+
|
74
|
+
return CUINT_2_NUM(c->data->CursorKind);
|
75
|
+
}
|
76
|
+
|
77
|
+
/*
|
78
|
+
* call-seq:
|
79
|
+
* Clangc::CompletionResult#completion_string => Clangc::CompetionString
|
80
|
+
*
|
81
|
+
* The code-completion string that describes how to insert this
|
82
|
+
* code-completion result into the editing buffer.
|
83
|
+
* */
|
84
|
+
VALUE
|
85
|
+
c_CompletionResult_get_completion_string(VALUE self)
|
86
|
+
{
|
87
|
+
CompletionResult_t *c;
|
88
|
+
Data_Get_Struct(self, CompletionResult_t, c);
|
89
|
+
|
90
|
+
CompletionString_t *cs;
|
91
|
+
VALUE completion_string;
|
92
|
+
R_GET_CLASS_DATA("Clangc", CompletionString, completion_string, cs);
|
93
|
+
|
94
|
+
cs->data = c->data->CompletionString;
|
95
|
+
cs->parent = self;
|
96
|
+
|
97
|
+
return completion_string;
|
98
|
+
}
|
@@ -0,0 +1,36 @@
|
|
1
|
+
/*
|
2
|
+
* ruby-clangc ruby bindings for the C interface of Clang
|
3
|
+
* Copyright (C) 2016 Cedric Le Moigne <cedlemo@gmx.com>
|
4
|
+
*
|
5
|
+
* This program is free software: you can redistribute it and/or modify
|
6
|
+
* it under the terms of the GNU General Public License as published by
|
7
|
+
* the Free Software Foundation, either version 3 of the License, or
|
8
|
+
* (at your option) any later version.
|
9
|
+
*
|
10
|
+
* This program is distributed in the hope that it will be useful,
|
11
|
+
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
12
|
+
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
13
|
+
* GNU General Public License for more details.
|
14
|
+
*
|
15
|
+
* You should have received a copy of the GNU General Public License
|
16
|
+
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
17
|
+
*/
|
18
|
+
#ifndef COMPLETIONRESULT_H
|
19
|
+
#define COMPLETIONRESULT_H
|
20
|
+
#include <ruby/ruby.h>
|
21
|
+
#include "clang-c/Index.h"
|
22
|
+
typedef struct CompletionResult_t
|
23
|
+
{
|
24
|
+
CXCompletionResult *data;
|
25
|
+
VALUE parent;
|
26
|
+
} CompletionResult_t;
|
27
|
+
|
28
|
+
VALUE
|
29
|
+
c_CompletionResult_struct_alloc(VALUE);
|
30
|
+
|
31
|
+
VALUE
|
32
|
+
c_CompletionResult_get_cursor_kind(VALUE);
|
33
|
+
|
34
|
+
VALUE
|
35
|
+
c_CompletionResult_get_completion_string(VALUE);
|
36
|
+
#endif // COMPLETIONRESULT_H
|
@@ -0,0 +1,231 @@
|
|
1
|
+
/*
|
2
|
+
* ruby-clangc ruby bindings for the C interface of Clang
|
3
|
+
* Copyright (C) 2015-2016 Cedric Le Moigne cedlemo <cedlemo@gmx.com>
|
4
|
+
*
|
5
|
+
* This program is free software: you can redistribute it and/or modify
|
6
|
+
* it under the terms of the GNU General Public License as published by
|
7
|
+
* the Free Software Foundation, either version 3 of the License, or
|
8
|
+
* (at your option) any later version.
|
9
|
+
*
|
10
|
+
* This program is distributed in the hope that it will be useful,
|
11
|
+
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
12
|
+
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
13
|
+
* GNU General Public License for more details.
|
14
|
+
*
|
15
|
+
* You should have received a copy of the GNU General Public License
|
16
|
+
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
17
|
+
*/
|
18
|
+
/*CompletionString ruby class*/
|
19
|
+
#include "class_CompletionString.h"
|
20
|
+
#include "macros.h"
|
21
|
+
|
22
|
+
static void c_CompletionString_struct_free(CompletionString_t *s)
|
23
|
+
{
|
24
|
+
if (s)
|
25
|
+
{
|
26
|
+
ruby_xfree(s);
|
27
|
+
}
|
28
|
+
}
|
29
|
+
|
30
|
+
static void c_CompletionString_mark(void *s)
|
31
|
+
{
|
32
|
+
if (s)
|
33
|
+
{
|
34
|
+
CompletionString_t *t = (CompletionString_t *) s;
|
35
|
+
rb_gc_mark(t->parent);
|
36
|
+
}
|
37
|
+
}
|
38
|
+
|
39
|
+
VALUE
|
40
|
+
c_CompletionString_struct_alloc(VALUE klass)
|
41
|
+
{
|
42
|
+
|
43
|
+
CompletionString_t *ptr;
|
44
|
+
ptr = (CompletionString_t *) ruby_xmalloc(sizeof(CompletionString_t));
|
45
|
+
ptr->data = NULL;
|
46
|
+
ptr->parent = Qnil;
|
47
|
+
|
48
|
+
return Data_Wrap_Struct(
|
49
|
+
klass, NULL, c_CompletionString_struct_free, (void *) ptr);
|
50
|
+
}
|
51
|
+
|
52
|
+
/**
|
53
|
+
* Clangc::CompletionString#availability => Clangc::AvailabilityKind
|
54
|
+
*
|
55
|
+
* Determine the availability of the entity that this code-completion
|
56
|
+
* string refers to.
|
57
|
+
*
|
58
|
+
* The availability of the completion string which is one of the
|
59
|
+
* Clangc::AvailabilityKind constants.
|
60
|
+
*/
|
61
|
+
VALUE
|
62
|
+
c_CompletionString_get_availability(VALUE self)
|
63
|
+
{
|
64
|
+
CompletionString_t *c;
|
65
|
+
Data_Get_Struct(self, CompletionString_t, c);
|
66
|
+
|
67
|
+
return CUINT_2_NUM(clang_getCompletionAvailability(c->data));
|
68
|
+
}
|
69
|
+
|
70
|
+
/**
|
71
|
+
* call-seq:
|
72
|
+
* Clangc::CompletionString#priority => Number
|
73
|
+
*
|
74
|
+
* Determine the priority of this code completion.
|
75
|
+
*
|
76
|
+
* The priority of a code completion indicates how likely it is that this
|
77
|
+
* particular completion is the completion that the user will select. The
|
78
|
+
* priority is selected by various internal heuristics.
|
79
|
+
*
|
80
|
+
* Rreturns The priority of this completion string. Smaller values indicate
|
81
|
+
* higher-priority (more likely) completions.
|
82
|
+
*/
|
83
|
+
VALUE
|
84
|
+
c_CompletionString_get_priority(VALUE self)
|
85
|
+
{
|
86
|
+
CompletionString_t *c;
|
87
|
+
Data_Get_Struct(self, CompletionString_t, c);
|
88
|
+
|
89
|
+
return CUINT_2_NUM(clang_getCompletionPriority(c->data));
|
90
|
+
}
|
91
|
+
|
92
|
+
/**
|
93
|
+
* call-seq:
|
94
|
+
* Clangc::CompletionString#num_chunks => Number
|
95
|
+
*
|
96
|
+
* Retrieve the number of chunks in the given code-completion string.
|
97
|
+
*/
|
98
|
+
VALUE
|
99
|
+
c_CompletionString_get_num_chunks(VALUE self)
|
100
|
+
{
|
101
|
+
CompletionString_t *c;
|
102
|
+
Data_Get_Struct(self, CompletionString_t, c);
|
103
|
+
|
104
|
+
return CUINT_2_NUM(clang_getNumCompletionChunks(c->data));
|
105
|
+
}
|
106
|
+
|
107
|
+
/**
|
108
|
+
* call-seq:
|
109
|
+
* Clangc::CompletionString#chunk_kind(Number) => Clangc::CompletionChunkKind
|
110
|
+
*
|
111
|
+
* Determine the kind of a particular chunk within a completion string.
|
112
|
+
*
|
113
|
+
* chunk_number the 0-based index of the chunk in the completion string.
|
114
|
+
*
|
115
|
+
* It returns the kind of the chunk at the index chunk_number (a
|
116
|
+
* Clangc::CompletionChunkKind constant).
|
117
|
+
*/
|
118
|
+
VALUE
|
119
|
+
c_CompletionString_get_chunk_kind(VALUE self, VALUE index)
|
120
|
+
{
|
121
|
+
CompletionString_t *c;
|
122
|
+
Data_Get_Struct(self, CompletionString_t, c);
|
123
|
+
|
124
|
+
return CUINT_2_NUM(clang_getCompletionChunkKind(c->data, NUM2UINT(index)));
|
125
|
+
}
|
126
|
+
|
127
|
+
/**
|
128
|
+
* call-seq
|
129
|
+
* Clangc::CompletionString#chunk_text(Number) => String
|
130
|
+
*
|
131
|
+
* Retrieve the text associated with a particular chunk within a
|
132
|
+
* completion string.
|
133
|
+
*
|
134
|
+
* chunk_number the 0-based index of the chunk in the completion string.
|
135
|
+
*
|
136
|
+
* Returns the text associated with the chunk at index chunk_number.
|
137
|
+
*/
|
138
|
+
VALUE
|
139
|
+
c_CompletionString_get_chunk_text(VALUE self, VALUE index)
|
140
|
+
{
|
141
|
+
CompletionString_t *c;
|
142
|
+
Data_Get_Struct(self, CompletionString_t, c);
|
143
|
+
|
144
|
+
return CXSTR_2_RVAL(clang_getCompletionChunkText(c->data, NUM2UINT(index)));
|
145
|
+
}
|
146
|
+
|
147
|
+
/**
|
148
|
+
* call-seq:
|
149
|
+
* Clangc::CompletionString#num_annotations => Number
|
150
|
+
*
|
151
|
+
* Retrieve the number of annotations associated with the given
|
152
|
+
* completion string.
|
153
|
+
*
|
154
|
+
* Returns the number of annotations associated with the given completion
|
155
|
+
* string.
|
156
|
+
*/
|
157
|
+
VALUE
|
158
|
+
c_CompletionString_get_num_annotations(VALUE self)
|
159
|
+
{
|
160
|
+
CompletionString_t *c;
|
161
|
+
Data_Get_Struct(self, CompletionString_t, c);
|
162
|
+
|
163
|
+
return CUINT_2_NUM(clang_getCompletionNumAnnotations(c->data));
|
164
|
+
}
|
165
|
+
|
166
|
+
/**
|
167
|
+
* call-seq:
|
168
|
+
* Clangc::CompletionString#annotation(Number) => String
|
169
|
+
*
|
170
|
+
* Retrieve the annotation associated with the given completion string.
|
171
|
+
*
|
172
|
+
* annotation_number the 0-based index of the annotation of the
|
173
|
+
* completion string.
|
174
|
+
*
|
175
|
+
* Returns annotation string associated with the completion at index
|
176
|
+
* annotation_number, or a NULL string if that annotation is not available.
|
177
|
+
*/
|
178
|
+
VALUE
|
179
|
+
c_CompletionString_get_annotation(VALUE self, VALUE index)
|
180
|
+
{
|
181
|
+
CompletionString_t *c;
|
182
|
+
Data_Get_Struct(self, CompletionString_t, c);
|
183
|
+
|
184
|
+
return CXSTR_2_RVAL(
|
185
|
+
clang_getCompletionAnnotation(c->data, NUM2UINT(index)));
|
186
|
+
}
|
187
|
+
|
188
|
+
/**
|
189
|
+
* Call-seq:
|
190
|
+
* Clangc::CompletionString#brief_comment => String
|
191
|
+
*
|
192
|
+
* Retrieve the brief documentation comment attached to the declaration
|
193
|
+
* that corresponds to the given completion string.
|
194
|
+
*/
|
195
|
+
VALUE
|
196
|
+
c_CompletionString_get_brief_comment(VALUE self)
|
197
|
+
{
|
198
|
+
CompletionString_t *c;
|
199
|
+
Data_Get_Struct(self, CompletionString_t, c);
|
200
|
+
|
201
|
+
return CXSTR_2_RVAL(clang_getCompletionBriefComment(c->data));
|
202
|
+
}
|
203
|
+
|
204
|
+
/**
|
205
|
+
* call-seq:
|
206
|
+
* Clangc::CompletionString#chunk_completion_string(index) =>
|
207
|
+
* Clangc::CompletionString
|
208
|
+
*
|
209
|
+
* Retrieve the completion string associated with a particular chunk
|
210
|
+
* within a completion string.
|
211
|
+
*
|
212
|
+
* 0-based index of the chunk in the completion string.
|
213
|
+
*
|
214
|
+
* Returns the completion string associated with the chunk at index
|
215
|
+
* \c chunk_number.
|
216
|
+
*/
|
217
|
+
VALUE
|
218
|
+
c_CompletionString_get_chunk_completion_string(VALUE self, VALUE index)
|
219
|
+
{
|
220
|
+
CompletionString_t *c;
|
221
|
+
Data_Get_Struct(self, CompletionString_t, c);
|
222
|
+
|
223
|
+
VALUE completion_string;
|
224
|
+
CompletionString_t *cs;
|
225
|
+
R_GET_CLASS_DATA("Clangc", CompletionString, completion_string, cs);
|
226
|
+
cs->data =
|
227
|
+
clang_getCompletionChunkCompletionString(c->data, NUM2UINT(index));
|
228
|
+
cs->parent = c->parent;
|
229
|
+
|
230
|
+
return completion_string;
|
231
|
+
}
|