Nix 2.36.0
Nix, the purely functional package manager; unstable internal interfaces
Loading...
Searching...
No Matches
nix::PosTable Class Reference

Classes

class  Origin

Public Member Functions

 PosTable (std::size_t linesCacheCapacity=65536)
Origin addOrigin (Pos::Origin origin, size_t size)
PosIdx add (const Origin &origin, size_t offset)
Pos operator[] (PosIdx p) const
Pos::Origin originOf (PosIdx p) const
void clear ()

Member Function Documentation

◆ clear()

void nix::PosTable::clear ( )
inline

Remove all origins from the table.

◆ operator[]()

Pos nix::PosTable::operator[] ( PosIdx p) const

Convert a byte-offset PosIdx into a Pos with line/column information.

Parameters
pByte offset into the virtual concatenation of all parsed contents
Returns
Position
Warning
Very expensive to call, as this has to read the entire source into memory each time. Call this only if absolutely necessary. Prefer to keep PosIdx around instead of needlessly converting it into Pos by using this lookup method.

The documentation for this class was generated from the following files:
  • libutil/include/nix/util/pos-table.hh
  • libutil/pos-table.cc