Porytiles
Loading...
Searching...
No Matches
source_position.hpp
Go to the documentation of this file.
1#pragma once
2
3#include <cstddef>
4#include <string>
5
6namespace porytiles {
7
17 std::size_t line{1};
18 std::size_t column{1};
19
25 [[nodiscard]] std::string to_string() const
26 {
27 return std::to_string(line) + ":" + std::to_string(column);
28 }
29
36 [[nodiscard]] bool operator==(const SourcePosition &other) const = default;
37};
38
39} // namespace porytiles
Represents a position within source content.
std::size_t line
1-based line number
std::size_t column
1-based column number
bool operator==(const SourcePosition &other) const =default
Compares two positions for equality.
std::string to_string() const
Formats the position as "line:column".