Aleph-w 3.0
A C++ Library for Data Structures and Algorithms
Loading...
Searching...
No Matches
Aleph::Source_Position Struct Reference

Fully resolved source position. More...

#include <ah-source.H>

Collaboration diagram for Aleph::Source_Position:
[legend]

Public Member Functions

bool is_valid () const noexcept
 Returns whether the position refers to a registered file.
 
std::string to_string () const
 Formats the position as file:line:column or line:column.
 

Public Attributes

Source_File_Id file_id = 0
 Stable file identifier; 0 means invalid.
 
std::string file_name
 Human-readable file name.
 
Source_Offset offset = 0
 Byte offset in the file text.
 
size_t line = 1
 1-based line number.
 
size_t column = 1
 1-based column number.
 

Detailed Description

Fully resolved source position.

A position belongs to a file, keeps the absolute byte offset in that file, and caches 1-based line/column numbers for presentation.

Definition at line 69 of file ah-source.H.

Member Function Documentation

◆ is_valid()

bool Aleph::Source_Position::is_valid ( ) const
inlinenoexcept

Returns whether the position refers to a registered file.

Definition at line 78 of file ah-source.H.

References file_id.

◆ to_string()

std::string Aleph::Source_Position::to_string ( ) const
inline

Formats the position as file:line:column or line:column.

Definition at line 84 of file ah-source.H.

References Aleph::blossom_maximum_cardinality_matching(), column, file_name, line, and out.

Referenced by Aleph::Diagnostic_Engine::render_secondary_labels().

Member Data Documentation

◆ column

size_t Aleph::Source_Position::column = 1

1-based column number.

Definition at line 75 of file ah-source.H.

Referenced by to_string().

◆ file_id

Source_File_Id Aleph::Source_Position::file_id = 0

Stable file identifier; 0 means invalid.

Definition at line 71 of file ah-source.H.

Referenced by is_valid().

◆ file_name

std::string Aleph::Source_Position::file_name

Human-readable file name.

Definition at line 72 of file ah-source.H.

Referenced by to_string().

◆ line

size_t Aleph::Source_Position::line = 1

1-based line number.

Definition at line 74 of file ah-source.H.

Referenced by to_string().

◆ offset

Source_Offset Aleph::Source_Position::offset = 0

Byte offset in the file text.

Definition at line 73 of file ah-source.H.


The documentation for this struct was generated from the following file: