Class: FFI::Clang::PresumedLocation
- Inherits:
-
SourceLocation
- Object
- SourceLocation
- FFI::Clang::PresumedLocation
- Defined in:
- lib/ffi/clang/source_location.rb
Overview
Represents a presumed location in source code. This is the location that appears to the user after macro expansion and #line directives.
Instance Attribute Summary collapse
- #column ⇒ Object readonly
- #filename ⇒ Object readonly
- #line ⇒ Object readonly
-
#offset ⇒ Object
readonly
Returns the value of attribute offset.
Attributes inherited from SourceLocation
Instance Method Summary collapse
-
#as_string ⇒ Object
Get a string representation of this location.
-
#initialize(location) ⇒ PresumedLocation
constructor
Create a new presumed location and extract its components.
-
#to_s ⇒ Object
Get a detailed string representation.
Methods inherited from SourceLocation
#==, #from_main_file?, #in_system_header?, #null?, null_location
Constructor Details
#initialize(location) ⇒ PresumedLocation
Create a new presumed location and extract its components.
121 122 123 124 125 126 127 128 129 130 131 132 133 |
# File 'lib/ffi/clang/source_location.rb', line 121 def initialize(location) super(location) cxstring = MemoryPointer.new Lib::CXString line = MemoryPointer.new :uint column = MemoryPointer.new :uint Lib::get_presumed_location(@location, cxstring, line, column) @filename = Lib.extract_string cxstring @line = line.get_uint(0) @column = column.get_uint(0) end |
Instance Attribute Details
#column ⇒ Object (readonly)
117 |
# File 'lib/ffi/clang/source_location.rb', line 117 attr_reader :filename, :line, :column, :offset |
#filename ⇒ Object (readonly)
117 118 119 |
# File 'lib/ffi/clang/source_location.rb', line 117 def filename @filename end |
#line ⇒ Object (readonly)
117 |
# File 'lib/ffi/clang/source_location.rb', line 117 attr_reader :filename, :line, :column, :offset |
#offset ⇒ Object (readonly)
Returns the value of attribute offset.
117 |
# File 'lib/ffi/clang/source_location.rb', line 117 attr_reader :filename, :line, :column, :offset |
Instance Method Details
#as_string ⇒ Object
Get a string representation of this location.
137 138 139 |
# File 'lib/ffi/clang/source_location.rb', line 137 def as_string "#{@filename}:#{@line}:#{@column}" end |
#to_s ⇒ Object
Get a detailed string representation.
143 144 145 |
# File 'lib/ffi/clang/source_location.rb', line 143 def to_s "PresumedLocation <#{self.as_string}>" end |