#include <sourcecontext.h>
|
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 |
|
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
◆ 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
-
file | filename path of the source file |
function | name of the function in the current scope |
line | line number in the current source file |
◆ 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: