Class: FFI::Clang::IndexAction::Entity

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

Overview

Represents an indexed entity.

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(info, translation_unit) ⇒ Entity

Build an entity wrapper from a libclang entity info pointer.



73
74
75
76
77
78
79
80
# File 'lib/ffi/clang/index_action.rb', line 73

def initialize(info, translation_unit)
	@kind = info[:kind]
	@template_kind = info[:template_kind]
	@language = info[:language]
	@name = self.class.string_from_pointer(info[:name])
	@usr = self.class.string_from_pointer(info[:usr])
	@cursor = Cursor.new(info[:cursor], translation_unit)
end

Instance Attribute Details

#cursorObject (readonly)

Returns the value of attribute cursor.



68
# File 'lib/ffi/clang/index_action.rb', line 68

attr_reader :kind, :template_kind, :language, :name, :usr, :cursor

#kindObject (readonly)



68
69
70
# File 'lib/ffi/clang/index_action.rb', line 68

def kind
  @kind
end

#languageObject (readonly)



68
# File 'lib/ffi/clang/index_action.rb', line 68

attr_reader :kind, :template_kind, :language, :name, :usr, :cursor

#nameObject (readonly)



68
# File 'lib/ffi/clang/index_action.rb', line 68

attr_reader :kind, :template_kind, :language, :name, :usr, :cursor

#template_kindObject (readonly)



68
# File 'lib/ffi/clang/index_action.rb', line 68

attr_reader :kind, :template_kind, :language, :name, :usr, :cursor

#usrObject (readonly)



68
# File 'lib/ffi/clang/index_action.rb', line 68

attr_reader :kind, :template_kind, :language, :name, :usr, :cursor

Class Method Details

.string_from_pointer(pointer) ⇒ Object



83
84
85
86
87
# File 'lib/ffi/clang/index_action.rb', line 83

def self.string_from_pointer(pointer)
	return nil if pointer.null?
	
	pointer.read_string
end