Class: FFI::Clang::IndexAction::Declaration
- Inherits:
-
Object
- Object
- FFI::Clang::IndexAction::Declaration
- Defined in:
- lib/ffi/clang/index_action.rb
Overview
Represents a declaration event reported during indexing.
Instance Attribute Summary collapse
- #cursor ⇒ Object readonly
- #declaration_container ⇒ Object readonly
- #entity ⇒ Object readonly
-
#flags ⇒ Object
readonly
Returns the value of attribute flags.
- #lexical_container ⇒ Object readonly
- #location ⇒ Object readonly
- #semantic_container ⇒ Object readonly
Class Method Summary collapse
- .container_from_pointer(pointer, translation_unit) ⇒ Object
- .entity_from_pointer(pointer, translation_unit) ⇒ Object
Instance Method Summary collapse
-
#container? ⇒ Boolean
Check if this declaration is itself a container.
-
#definition? ⇒ Boolean
Check if this declaration is a definition.
-
#implicit? ⇒ Boolean
Check if this declaration was implicit.
-
#initialize(info, translation_unit) ⇒ Declaration
constructor
Build a declaration wrapper from low-level info.
-
#redeclaration? ⇒ Boolean
Check if this declaration is a redeclaration.
Constructor Details
#initialize(info, translation_unit) ⇒ Declaration
Build a declaration wrapper from low-level info.
183 184 185 186 187 188 189 190 191 192 193 194 195 |
# File 'lib/ffi/clang/index_action.rb', line 183 def initialize(info, translation_unit) @cursor = Cursor.new(info[:cursor], translation_unit) @location = ExpansionLocation.new(Lib.index_loc_get_source_location(info[:loc])) @entity = self.class.entity_from_pointer(info[:entity_info], translation_unit) @semantic_container = self.class.container_from_pointer(info[:semantic_container], translation_unit) @lexical_container = self.class.container_from_pointer(info[:lexical_container], translation_unit) @declaration_container = self.class.container_from_pointer(info[:decl_as_container], translation_unit) @redeclaration = info[:is_redeclaration] != 0 @definition = info[:is_definition] != 0 @container = info[:is_container] != 0 @implicit = info[:is_implicit] != 0 @flags = Lib.opts_from(Lib::IdxDeclInfoFlags, info[:flags]) end |
Instance Attribute Details
#cursor ⇒ Object (readonly)
178 179 180 |
# File 'lib/ffi/clang/index_action.rb', line 178 def cursor @cursor end |
#declaration_container ⇒ Object (readonly)
178 |
# File 'lib/ffi/clang/index_action.rb', line 178 attr_reader :cursor, :location, :entity, :semantic_container, :lexical_container, :declaration_container, :flags |
#entity ⇒ Object (readonly)
178 |
# File 'lib/ffi/clang/index_action.rb', line 178 attr_reader :cursor, :location, :entity, :semantic_container, :lexical_container, :declaration_container, :flags |
#flags ⇒ Object (readonly)
Returns the value of attribute flags.
178 |
# File 'lib/ffi/clang/index_action.rb', line 178 attr_reader :cursor, :location, :entity, :semantic_container, :lexical_container, :declaration_container, :flags |
#lexical_container ⇒ Object (readonly)
178 |
# File 'lib/ffi/clang/index_action.rb', line 178 attr_reader :cursor, :location, :entity, :semantic_container, :lexical_container, :declaration_container, :flags |
#location ⇒ Object (readonly)
178 |
# File 'lib/ffi/clang/index_action.rb', line 178 attr_reader :cursor, :location, :entity, :semantic_container, :lexical_container, :declaration_container, :flags |
#semantic_container ⇒ Object (readonly)
178 |
# File 'lib/ffi/clang/index_action.rb', line 178 attr_reader :cursor, :location, :entity, :semantic_container, :lexical_container, :declaration_container, :flags |
Class Method Details
.container_from_pointer(pointer, translation_unit) ⇒ Object
229 230 231 232 233 |
# File 'lib/ffi/clang/index_action.rb', line 229 def self.container_from_pointer(pointer, translation_unit) return nil if pointer.null? Container.new(Lib::CXIdxContainerInfo.new(pointer), translation_unit) end |
.entity_from_pointer(pointer, translation_unit) ⇒ Object
222 223 224 225 226 |
# File 'lib/ffi/clang/index_action.rb', line 222 def self.entity_from_pointer(pointer, translation_unit) return nil if pointer.null? Entity.new(Lib::CXIdxEntityInfo.new(pointer), translation_unit) end |
Instance Method Details
#container? ⇒ Boolean
Check if this declaration is itself a container.
211 212 213 |
# File 'lib/ffi/clang/index_action.rb', line 211 def container? @container end |
#definition? ⇒ Boolean
Check if this declaration is a definition.
205 206 207 |
# File 'lib/ffi/clang/index_action.rb', line 205 def definition? @definition end |
#implicit? ⇒ Boolean
Check if this declaration was implicit.
217 218 219 |
# File 'lib/ffi/clang/index_action.rb', line 217 def implicit? @implicit end |
#redeclaration? ⇒ Boolean
Check if this declaration is a redeclaration.
199 200 201 |
# File 'lib/ffi/clang/index_action.rb', line 199 def redeclaration? @redeclaration end |