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

#include <position.hh>

Classes

struct  LinesIterator
 
struct  Stdin
 
struct  String
 

Public Types

typedef std::variant< std::monostate, Stdin, String, SourcePathOrigin
 

Public Member Functions

 Pos (uint32_t line, uint32_t column, Origin origin)
 
 Pos (Pos &other)=default
 
 Pos (const Pos &other)=default
 
 Pos (Pos &&other)=default
 
 Pos (const Pos *other)
 
 operator bool () const
 
 operator std::shared_ptr< Pos > () const
 
std::optional< std::string > getSource () const
 
void print (std::ostream &out, bool showOrigin) const
 
std::optional< LinesOfCodegetCodeLines () 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< SourcePathgetSourcePath () 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
inline

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


The documentation for this struct was generated from the following files: