Class: FFI::Clang::CodeCompletion::String
- Inherits:
-
Object
- Object
- FFI::Clang::CodeCompletion::String
- Defined in:
- lib/ffi/clang/code_completion.rb
Overview
Represents a code completion string with chunks.
Instance Method Summary collapse
-
#annotation(i) ⇒ Object
Get an annotation by index.
-
#annotations ⇒ Object
Get all annotations.
-
#availability ⇒ Object
Get the availability of this completion.
-
#chunk_completion(i) ⇒ Object
Get the completion string of a chunk.
-
#chunk_kind(i) ⇒ Object
Get the kind of a chunk.
-
#chunk_text(i) ⇒ Object
Get the text of a chunk.
-
#chunks ⇒ Object
Get all chunks as an array of hashes.
-
#comment ⇒ Object
Get the brief comment.
-
#initialize(ptr) ⇒ String
constructor
Initialize a completion string.
-
#inspect ⇒ Object
Get a string representation of this completion string.
-
#num_annotations ⇒ Object
Get the number of annotations.
-
#num_chunks ⇒ Object
Get the number of chunks.
-
#parent ⇒ Object
Get the parent context.
-
#priority ⇒ Object
Get the priority of this completion.
Constructor Details
#initialize(ptr) ⇒ String
Initialize a completion string.
166 167 168 |
# File 'lib/ffi/clang/code_completion.rb', line 166 def initialize(ptr) @pointer = ptr end |
Instance Method Details
#annotation(i) ⇒ Object
Get an annotation by index.
226 227 228 |
# File 'lib/ffi/clang/code_completion.rb', line 226 def annotation(i) Lib.extract_string Lib.get_completion_annotation(@pointer, i) end |
#annotations ⇒ Object
Get all annotations.
232 233 234 235 236 |
# File 'lib/ffi/clang/code_completion.rb', line 232 def annotations num_annotations.times.map {|i| Lib.extract_string Lib.get_completion_annotation(@pointer, i) } end |
#availability ⇒ Object
Get the availability of this completion.
213 214 215 |
# File 'lib/ffi/clang/code_completion.rb', line 213 def availability Lib.get_completion_availability(@pointer) end |
#chunk_completion(i) ⇒ Object
Get the completion string of a chunk.
187 188 189 |
# File 'lib/ffi/clang/code_completion.rb', line 187 def chunk_completion(i) CodeCompletion::String.new Lib.get_completion_chunk_completion_string(@pointer, i) end |
#chunk_kind(i) ⇒ Object
Get the kind of a chunk.
173 174 175 |
# File 'lib/ffi/clang/code_completion.rb', line 173 def chunk_kind(i) Lib.get_completion_chunk_kind(@pointer, i) end |
#chunk_text(i) ⇒ Object
Get the text of a chunk.
180 181 182 |
# File 'lib/ffi/clang/code_completion.rb', line 180 def chunk_text(i) Lib.extract_string Lib.get_completion_text(@pointer, i) end |
#chunks ⇒ Object
Get all chunks as an array of hashes.
199 200 201 202 203 |
# File 'lib/ffi/clang/code_completion.rb', line 199 def chunks num_chunks.times.map {|i| { kind: chunk_kind(i), text: chunk_text(i), completion: chunk_completion(i) } } end |
#comment ⇒ Object
Get the brief comment.
246 247 248 |
# File 'lib/ffi/clang/code_completion.rb', line 246 def comment Lib.extract_string Lib.get_completion_brief_comment(@pointer) end |
#inspect ⇒ Object
Get a string representation of this completion string.
252 253 254 |
# File 'lib/ffi/clang/code_completion.rb', line 252 def inspect chunks.inspect end |
#num_annotations ⇒ Object
Get the number of annotations.
219 220 221 |
# File 'lib/ffi/clang/code_completion.rb', line 219 def num_annotations Lib.get_completion_num_annotations(@pointer) end |
#num_chunks ⇒ Object
Get the number of chunks.
193 194 195 |
# File 'lib/ffi/clang/code_completion.rb', line 193 def num_chunks Lib.get_num_completion_chunks(@pointer) end |
#parent ⇒ Object
Get the parent context.
240 241 242 |
# File 'lib/ffi/clang/code_completion.rb', line 240 def parent Lib.extract_string Lib.get_completion_parent(@pointer, nil) end |
#priority ⇒ Object
Get the priority of this completion.
207 208 209 |
# File 'lib/ffi/clang/code_completion.rb', line 207 def priority Lib.get_completion_priority(@pointer) end |