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
Returns the value of attribute column.
- #filename ⇒ Object readonly
- #line ⇒ Object readonly
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.
136 137 138 139 140 141 142 143 144 145 146 147 148 |
# File 'lib/ffi/clang/source_location.rb', line 136 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)
Returns the value of attribute column.
132 |
# File 'lib/ffi/clang/source_location.rb', line 132 attr_reader :filename, :line, :column |
#filename ⇒ Object (readonly)
132 133 134 |
# File 'lib/ffi/clang/source_location.rb', line 132 def filename @filename end |
#line ⇒ Object (readonly)
132 |
# File 'lib/ffi/clang/source_location.rb', line 132 attr_reader :filename, :line, :column |
Instance Method Details
#as_string ⇒ Object
Get a string representation of this location.
152 153 154 |
# File 'lib/ffi/clang/source_location.rb', line 152 def as_string "#{@filename}:#{@line}:#{@column}" end |
#to_s ⇒ Object
Get a detailed string representation.
158 159 160 |
# File 'lib/ffi/clang/source_location.rb', line 158 def to_s "PresumedLocation <#{self.as_string}>" end |