FFI::ClangSourceFFIClangIndexActionEntity

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.

attribute r

template_kind

returns Symbol

The C++ template kind.

attribute r

language

returns Symbol

The source language.

attribute r

name

returns String | Nil

The entity name.

attribute r

usr

returns String | Nil

The unified symbol resolution string.

attribute r

cursor

returns Cursor

The cursor describing the entity.

def initialize(info, translation_unit)

Build an entity wrapper from a libclang entity info pointer.

Signature

parameter info Lib::CXIdxEntityInfo

The low-level entity info.

parameter translation_unit TranslationUnit | 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