Class: FFI::Clang::CodeCompletion::String

Inherits:
Object
  • Object
show all
Defined in:
lib/ffi/clang/code_completion.rb

Overview

Represents a code completion string with chunks.

Instance Method Summary collapse

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

#annotationsObject

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

#availabilityObject

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

#chunksObject

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

#commentObject

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

#inspectObject

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_annotationsObject

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_chunksObject

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

#parentObject

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

#priorityObject

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