class Entity
Represents an indexed entity.
Definitions
attr_reader :kind, :template_kind, :language, :name, :usr, :cursor
Signature
-
attribute
r kind
-
returns
Symbol The entity kind.
-
returns
-
attribute
r template_kind
-
returns
Symbol The C++ template kind.
-
returns
-
attribute
r language
-
returns
Symbol The source language.
-
returns
-
attribute
r name
-
returns
String | Nil The entity name.
-
returns
-
attribute
r usr
-
returns
String | Nil The unified symbol resolution string.
-
returns
-
attribute
r cursor
-
returns
Cursor The cursor describing the entity.
-
returns
def initialize(info, translation_unit)
Build an entity wrapper from a libclang entity info pointer.
Signature
-
parameter
infoLib::CXIdxEntityInfo The low-level entity info.
-
parameter
translation_unitTranslationUnit | Nil The translation unit for derived cursors.
Implementation
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
def self.string_from_pointer(pointer)
- private
Signature
- private
Implementation
def self.string_from_pointer(pointer)
return nil if pointer.null?
pointer.read_string
end