9 #ifndef CPPCOMMON_SYSTEM_SOURCE_LOCATION_H
10 #define CPPCOMMON_SYSTEM_SOURCE_LOCATION_H
23 #define __LOCATION__ CppCommon::SourceLocation(__FILE__, __LINE__)
50 const
char*
filename() const noexcept {
return _filename; }
52 int line() const noexcept {
return _line; }
56 { std::stringstream ss; ss << *
this;
return ss.str(); }
62 const char* _filename;
SourceLocation(const char *filename, int line) noexcept
Create a new source location with the given file name and line number.
SourceLocation(const SourceLocation &) noexcept=default
SourceLocation(SourceLocation &&) noexcept=default
int line() const noexcept
Get line number.
std::string string() const
Get the string from the current source location.
friend std::ostream & operator<<(std::ostream &os, const SourceLocation &source_location)
Output source location into the given output stream.
const char * filename() const noexcept
Get file name.
C++ Common project definitions.
Source location inline implementation.