FE 0.6.1
A header-only C++ library for writing frontends
Loading...
Searching...
No Matches

Location in a File. More...

#include <fe/loc.h>

Public Member Functions

 Loc ()=default
 Creates an invalid Location.
 Loc (const std::filesystem::path *path, Pos begin, Pos finis)
 Loc (const std::filesystem::path *file, Pos pos)
 Loc (Pos begin, Pos finis)
 Loc (Pos pos)
Loc anew_begin () const
Loc anew_finis () const
Loc operator+ (Pos pos) const
Loc operator+ (Loc loc) const
 operator bool () const
 Is a valid Location?
bool operator== (Loc other) const
void dump () const

Public Attributes

const std::filesystem::path * path = {}
Pos begin = {}
Pos finis = {}
 It's called finis because it refers to the last character within this Location.

Friends

std::ostream & operator<< (std::ostream &os, Loc loc)
 fe/loc.h only declares the stream output and dump helpers.

Detailed Description

Location in a File.

It's only two machine words on a 64 bit arch, so pass around as value.

Warning
Loc::path is only a pointer and it is your job to guarantee that the underlying std::filesystem::path outlives this Location.

Definition at line 35 of file loc.h.

Constructor & Destructor Documentation

◆ Loc() [1/5]

fe::Loc::Loc ( )
default

Creates an invalid Location.

Referenced by anew_begin(), anew_finis(), Loc(), Loc(), Loc(), operator+(), operator+(), operator<<, and operator==().

◆ Loc() [2/5]

fe::Loc::Loc ( const std::filesystem::path * path,
Pos begin,
Pos finis )
inline

Definition at line 37 of file loc.h.

References begin, finis, and path.

◆ Loc() [3/5]

fe::Loc::Loc ( const std::filesystem::path * file,
Pos pos )
inline

Definition at line 41 of file loc.h.

References Loc().

◆ Loc() [4/5]

fe::Loc::Loc ( Pos begin,
Pos finis )
inline

Definition at line 43 of file loc.h.

References begin, finis, and Loc().

◆ Loc() [5/5]

fe::Loc::Loc ( Pos pos)
inline

Definition at line 45 of file loc.h.

References Loc().

Member Function Documentation

◆ anew_begin()

Loc fe::Loc::anew_begin ( ) const
inline

Definition at line 48 of file loc.h.

References begin, Loc(), and path.

◆ anew_finis()

Loc fe::Loc::anew_finis ( ) const
inline

Definition at line 49 of file loc.h.

References finis, Loc(), and path.

◆ dump()

void fe::Loc::dump ( ) const

Definition at line 28 of file loc.cpp.h.

◆ operator bool()

fe::Loc::operator bool ( ) const
inlineexplicit

Is a valid Location?

Definition at line 52 of file loc.h.

References begin.

◆ operator+() [1/2]

Loc fe::Loc::operator+ ( Loc loc) const
inline

Definition at line 51 of file loc.h.

References begin, finis, Loc(), and path.

◆ operator+() [2/2]

Loc fe::Loc::operator+ ( Pos pos) const
inline

Definition at line 50 of file loc.h.

References begin, Loc(), and path.

◆ operator==()

bool fe::Loc::operator== ( Loc other) const
inline
Note
Loc::path is only checked via pointer equality.

Definition at line 54 of file loc.h.

References begin, finis, Loc(), and path.

◆ operator<<

std::ostream & operator<< ( std::ostream & os,
Loc loc )
friend

fe/loc.h only declares the stream output and dump helpers.

Include fe/loc.cpp.h in exactly one translation unit for the default implementation, or provide your own definitions instead.

Definition at line 18 of file loc.cpp.h.

References begin, finis, Loc(), and path.

Member Data Documentation

◆ begin

Pos fe::Loc::begin = {}

◆ finis

Pos fe::Loc::finis = {}

It's called finis because it refers to the last character within this Location.

In the STL the word end refers to the position of something that is one element past the end.

Definition at line 59 of file loc.h.

Referenced by anew_finis(), Loc(), Loc(), operator+(), operator<<, and operator==().

◆ path

const std::filesystem::path* fe::Loc::path = {}

Definition at line 57 of file loc.h.

Referenced by anew_begin(), anew_finis(), Loc(), operator+(), operator+(), operator<<, and operator==().


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