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.
216 217 218 |
# File 'lib/ffi/clang/code_completion.rb', line 216 def initialize(ptr) @pointer = ptr end |
Instance Method Details
#annotation(i) ⇒ Object
Get an annotation by index.
276 277 278 |
# File 'lib/ffi/clang/code_completion.rb', line 276 def annotation(i) Lib.extract_string Lib.get_completion_annotation(@pointer, i) end |
#annotations ⇒ Object
Get all annotations.
282 283 284 285 286 |
# File 'lib/ffi/clang/code_completion.rb', line 282 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.
263 264 265 |
# File 'lib/ffi/clang/code_completion.rb', line 263 def availability Lib.get_completion_availability(@pointer) end |
#chunk_completion(i) ⇒ Object
Get the completion string of a chunk.
237 238 239 |
# File 'lib/ffi/clang/code_completion.rb', line 237 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.
223 224 225 |
# File 'lib/ffi/clang/code_completion.rb', line 223 def chunk_kind(i) Lib.get_completion_chunk_kind(@pointer, i) end |
#chunk_text(i) ⇒ Object
Get the text of a chunk.
230 231 232 |
# File 'lib/ffi/clang/code_completion.rb', line 230 def chunk_text(i) Lib.extract_string Lib.get_completion_text(@pointer, i) end |
#chunks ⇒ Object
Get all chunks as an array of hashes.
249 250 251 252 253 |
# File 'lib/ffi/clang/code_completion.rb', line 249 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.
296 297 298 |
# File 'lib/ffi/clang/code_completion.rb', line 296 def comment Lib.extract_string Lib.get_completion_brief_comment(@pointer) end |
#inspect ⇒ Object
Get a string representation of this completion string.
302 303 304 |
# File 'lib/ffi/clang/code_completion.rb', line 302 def inspect chunks.inspect end |
#num_annotations ⇒ Object
Get the number of annotations.
269 270 271 |
# File 'lib/ffi/clang/code_completion.rb', line 269 def num_annotations Lib.get_completion_num_annotations(@pointer) end |
#num_chunks ⇒ Object
Get the number of chunks.
243 244 245 |
# File 'lib/ffi/clang/code_completion.rb', line 243 def num_chunks Lib.get_num_completion_chunks(@pointer) end |
#parent ⇒ Object
Get the parent context.
290 291 292 |
# File 'lib/ffi/clang/code_completion.rb', line 290 def parent Lib.extract_string Lib.get_completion_parent(@pointer, nil) end |
#priority ⇒ Object
Get the priority of this completion.
257 258 259 |
# File 'lib/ffi/clang/code_completion.rb', line 257 def priority Lib.get_completion_priority(@pointer) end |