1
0
Fork 0
mirror of https://github.com/NixOS/nix synced 2025-07-02 21:51:50 +02:00

Move PodIdx to pos-idx.hh and PosTable to pos-table.hh

This commit is contained in:
Rebecca Turner 2024-02-01 13:07:45 -08:00
parent 4072a8fea0
commit c62c21e29a
No known key found for this signature in database
3 changed files with 133 additions and 84 deletions

48
src/libexpr/pos-idx.hh Normal file
View file

@ -0,0 +1,48 @@
#pragma once
#include <cinttypes>
namespace nix {
class PosIdx
{
friend class PosTable;
private:
uint32_t id;
explicit PosIdx(uint32_t id)
: id(id)
{
}
public:
PosIdx()
: id(0)
{
}
explicit operator bool() const
{
return id > 0;
}
bool operator<(const PosIdx other) const
{
return id < other.id;
}
bool operator==(const PosIdx other) const
{
return id == other.id;
}
bool operator!=(const PosIdx other) const
{
return id != other.id;
}
};
inline PosIdx noPos = {};
}