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

#include <position.hh>

Classes

struct  Stdin
struct  String
struct  LinesIterator

Public Types

typedef std::variant< std::monostate, Stdin, String, SourcePath > Origin

Public Member Functions

 Pos (uint32_t line, uint32_t column, Origin origin)
 operator bool () const
 operator std::shared_ptr< const Pos > () const
std::optional< std::string > getSource () const
void print (std::ostream &out, bool showOrigin) const
std::optional< LinesOfCode > getCodeLines () const
bool operator== (const Pos &rhs) const =default
auto operator<=> (const Pos &rhs) const =default
std::optional< std::string > getSnippetUpTo (const Pos &end) const
std::optional< SourcePath > getSourcePath () const

Public Attributes

uint32_t line = 0
uint32_t column = 0
Origin origin = std::monostate()

Detailed Description

A position and an origin for that position (like a source file).

Member Function Documentation

◆ getSource()

std::optional< std::string > nix::Pos::getSource ( ) const

Return the contents of the source file.

◆ getSourcePath()

std::optional< SourcePath > nix::Pos::getSourcePath ( ) const

Get the SourcePath, if the source was loaded from a file.


The documentation for this struct was generated from the following files:
  • libutil/include/nix/util/position.hh
  • libutil/position.cc