CppCommon 1.0.5.0
C++ Common Library
Loading...
Searching...
No Matches
Public Member Functions | Friends | List of all members
CppCommon::SourceLocation Class Reference

Source location. More...

#include <source_location.h>

Public Member Functions

 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
 
 ~SourceLocation () noexcept=default
 
SourceLocationoperator= (const SourceLocation &) noexcept=default
 
SourceLocationoperator= (SourceLocation &&) noexcept=default
 
const char * filename () const noexcept
 Get file name.
 
int line () const noexcept
 Get line number.
 
std::string string () const
 Get the string from the current source location.
 

Friends

class Exception
 
std::ostream & operator<< (std::ostream &os, const SourceLocation &source_location)
 Output source location into the given output stream.
 

Detailed Description

Source location.

Source location wraps file name and line number into single object with easy-to-use interface.

Thread-safe.

Definition at line 31 of file source_location.h.

Constructor & Destructor Documentation

◆ SourceLocation() [1/3]

CppCommon::SourceLocation::SourceLocation ( const char *  filename,
int  line 
)
inlineexplicitnoexcept

Create a new source location with the given file name and line number.

Parameters
filename- File name
line- Line number

Definition at line 41 of file source_location.h.

◆ SourceLocation() [2/3]

CppCommon::SourceLocation::SourceLocation ( const SourceLocation )
defaultnoexcept

◆ SourceLocation() [3/3]

CppCommon::SourceLocation::SourceLocation ( SourceLocation &&  )
defaultnoexcept

◆ ~SourceLocation()

CppCommon::SourceLocation::~SourceLocation ( )
defaultnoexcept

Member Function Documentation

◆ filename()

const char * CppCommon::SourceLocation::filename ( ) const
inlinenoexcept

Get file name.

Definition at line 50 of file source_location.h.

◆ line()

int CppCommon::SourceLocation::line ( ) const
inlinenoexcept

Get line number.

Definition at line 52 of file source_location.h.

◆ operator=() [1/2]

SourceLocation & CppCommon::SourceLocation::operator= ( const SourceLocation )
defaultnoexcept

◆ operator=() [2/2]

SourceLocation & CppCommon::SourceLocation::operator= ( SourceLocation &&  )
defaultnoexcept

◆ string()

std::string CppCommon::SourceLocation::string ( ) const
inline

Get the string from the current source location.

Definition at line 55 of file source_location.h.

Friends And Related Symbol Documentation

◆ Exception

friend class Exception
friend

Definition at line 33 of file source_location.h.

◆ operator<<

std::ostream & operator<< ( std::ostream &  os,
const SourceLocation source_location 
)
friend

Output source location into the given output stream.

Definition at line 11 of file source_location.inl.


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