Class: FFI::Clang::SourceLocation

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

Overview

Represents a location in source code. This base class provides common functionality for source locations, with specific subclasses for different types of location information.

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(location) ⇒ SourceLocation

Create a new source location.



32
33
34
# File 'lib/ffi/clang/source_location.rb', line 32

def initialize(location)
  @location = location
end

Instance Attribute Details

#locationObject (readonly)

Returns the value of attribute location.



28
29
30
# File 'lib/ffi/clang/source_location.rb', line 28

def location
  @location
end

Class Method Details

.null_locationObject

Get a null source location.



22
23
24
# File 'lib/ffi/clang/source_location.rb', line 22

def self.null_location
  ExpansionLocation.new Lib.get_null_location
end

Instance Method Details

#==(other) ⇒ Object

Compare this location with another for equality.



57
58
59
# File 'lib/ffi/clang/source_location.rb', line 57

def ==(other)
  Lib.equal_locations(@location, other.location) != 0
end

#from_main_file?Boolean

Check if this location is from the main file.

Returns:

  • (Boolean)


44
45
46
# File 'lib/ffi/clang/source_location.rb', line 44

def from_main_file?
  Lib.location_is_from_main_file(@location) != 0
end

#in_system_header?Boolean

Check if this location is in a system header.

Returns:

  • (Boolean)


38
39
40
# File 'lib/ffi/clang/source_location.rb', line 38

def in_system_header?
  Lib.location_in_system_header(@location) != 0
end

#null?Boolean

Check if this location is null.

Returns:

  • (Boolean)


50
51
52
# File 'lib/ffi/clang/source_location.rb', line 50

def null?
  Lib.equal_locations(@location, Lib.get_null_location) != 0
end