Inviwo 0.9.12-pre
Inviwo documentation
Loading...
Searching...
No Matches
inviwo::SourceLocation Class Reference

#include <sourcecontext.h>

Public Member Functions

constexpr SourceLocation (std::string_view file, std::string_view function, int line)
 
constexpr std::string_view getFile () const noexcept
 
constexpr std::string_view getFunction () const noexcept
 
constexpr int getLine () const noexcept
 

Friends

constexpr bool operator== (const SourceLocation &a, const SourceLocation &b) noexcept
 
constexpr bool operator!= (const SourceLocation &a, const SourceLocation &b) noexcept
 

Detailed Description

Represents a location in source code, similar to SourceContext but much more lightweight. SourceLocation does not take ownership of its given string, and assumes they are in static storage, which is the case for the file and function macros used below. But care has to be taken if one uses this class directly. The reason for this it so allow it to be fast, lightweight and constexpr. And to avoid unnecessary copies of file and function names. For a owning version

See also
SourceContext

Constructor & Destructor Documentation

◆ SourceLocation()

inviwo::SourceLocation::SourceLocation ( std::string_view file,
std::string_view function,
int line )
inlineconstexpr

This function does now take ownership of file and function!

Parameters
filefilename path of the source file
functionname of the function in the current scope
lineline number in the current source file

Member Function Documentation

◆ getFile()

std::string_view inviwo::SourceLocation::getFile ( ) const
inlineconstexprnoexcept

The name and path of the source file

◆ getFunction()

std::string_view inviwo::SourceLocation::getFunction ( ) const
inlineconstexprnoexcept

Name of the function in the current scope

◆ getLine()

int inviwo::SourceLocation::getLine ( ) const
inlineconstexprnoexcept

Line number in the current source file


The documentation for this class was generated from the following file: