20 lines
672 B
C++
20 lines
672 B
C++
#ifndef MALACHSCRIPT_TEXTSPAN_HPP
|
|
#define MALACHSCRIPT_TEXTSPAN_HPP
|
|
|
|
#include <cstddef>
|
|
namespace MalachScript {
|
|
class TextSpan {
|
|
size_t _start;
|
|
size_t _end;
|
|
|
|
public:
|
|
inline TextSpan(size_t start, size_t end) : _start(start), _end(end) {}
|
|
[[nodiscard]] inline size_t GetStart() const noexcept { return _start; }
|
|
[[nodiscard]] inline size_t GetEnd() const noexcept { return _end; }
|
|
inline bool operator==(const TextSpan& rhs) const { return _start == rhs._start && _end == rhs._end; }
|
|
inline bool operator!=(const TextSpan& rhs) const { return !(rhs == *this); }
|
|
};
|
|
}
|
|
|
|
#endif // MALACHSCRIPT_TEXTSPAN_HPP
|