Class: FFI::Clang::IndexAction::IncludedFile

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

Overview

Represents an include directive encountered during indexing.

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(info, translation_unit) ⇒ IncludedFile

Build an include wrapper from a libclang include info pointer.



103
104
105
106
107
108
109
110
# File 'lib/ffi/clang/index_action.rb', line 103

def initialize(info, translation_unit)
	@filename = Entity.string_from_pointer(info[:filename])
	@file = self.class.file_from_pointer(info[:file], translation_unit)
	@location = ExpansionLocation.new(Lib.index_loc_get_source_location(info[:hash_loc]))
	@import = info[:is_import] != 0
	@angled = info[:is_angled] != 0
	@module_import = info[:is_module_import] != 0
end

Instance Attribute Details

#fileObject (readonly)



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

attr_reader :filename, :file, :location

#filenameObject (readonly)



98
99
100
# File 'lib/ffi/clang/index_action.rb', line 98

def filename
  @filename
end

#locationObject (readonly)

Returns the value of attribute location.



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

attr_reader :filename, :file, :location

Class Method Details

.file_from_pointer(pointer, translation_unit) ⇒ Object



131
132
133
134
135
# File 'lib/ffi/clang/index_action.rb', line 131

def self.file_from_pointer(pointer, translation_unit)
	return nil if pointer.null?
	
	FFI::Clang::File.new(pointer, translation_unit)
end

Instance Method Details

#angled?Boolean

Check if the include used angle brackets.

Returns:

  • (Boolean)


120
121
122
# File 'lib/ffi/clang/index_action.rb', line 120

def angled?
	@angled
end

#import?Boolean

Check if the directive was an import.

Returns:

  • (Boolean)


114
115
116
# File 'lib/ffi/clang/index_action.rb', line 114

def import?
	@import
end

#module_import?Boolean

Check if the include was converted into a module import by clang.

Returns:

  • (Boolean)


126
127
128
# File 'lib/ffi/clang/index_action.rb', line 126

def module_import?
	@module_import
end