![]() |
Scarab
v3.9.4
Project 8 C++ Utility Library
|
Base class for exceptions with streaming operators and filename/line number location. More...
#include <base_exception.hh>
Public Member Functions | |
typed_exception () noexcept | |
typed_exception (const std::string &a_filename, int a_line) noexcept | |
typed_exception (const typed_exception< x_derived > &a_orig) noexcept | |
virtual | ~typed_exception () noexcept |
typed_exception< x_derived > & | operator= (const typed_exception< x_derived > &a_orig) |
template<class x_streamable > | |
x_derived & | operator<< (x_streamable a_fragment) |
x_derived & | operator<< (const std::string &a_fragment) |
x_derived & | operator<< (const char *a_fragment) |
x_derived & | operator() (const std::string &a_filename, int a_line) |
virtual const char * | what () const noexcept |
virtual const char * | where () const noexcept |
const std::string & | filename () const |
int | line () const |
![]() | |
base_exception () noexcept=default | |
virtual | ~base_exception () noexcept=default |
Protected Attributes | |
std::string | f_what |
std::string | f_where |
std::string | f_filename |
int | f_line |
Base class for exceptions with streaming operators and filename/line number location.
This class provides streaming operators for building up the what()
message. It's meant to be the base class for any exceptions wanting to use that feature.
The where()
message can be filled with the filename and line number using a constructor or operator().
This class uses the Curiously Recurring Template Pattern (CRTP) to get the derived class type to appear in the base class. In particular, we need to return x_derived& from the various operator<<() so that those functions can be used in a throw statement and the user can still catch the derived type.
Definition at line 55 of file base_exception.hh.
|
noexcept |
Definition at line 87 of file base_exception.hh.
|
noexcept |
Definition at line 96 of file base_exception.hh.
|
noexcept |
Definition at line 114 of file base_exception.hh.
|
virtualnoexcept |
Definition at line 132 of file base_exception.hh.
const std::string & filename | ( | ) | const |
Definition at line 195 of file base_exception.hh.
int line | ( | ) | const |
Definition at line 201 of file base_exception.hh.
x_derived & operator() | ( | const std::string & | a_filename, |
int | a_line | ||
) |
Definition at line 187 of file base_exception.hh.
x_derived & operator<< | ( | x_streamable | a_fragment | ) |
Definition at line 164 of file base_exception.hh.
x_derived & operator<< | ( | const std::string & | a_fragment | ) |
Definition at line 173 of file base_exception.hh.
x_derived & operator<< | ( | const char * | a_fragment | ) |
Definition at line 180 of file base_exception.hh.
typed_exception< x_derived > & operator= | ( | const typed_exception< x_derived > & | a_orig | ) |
Definition at line 136 of file base_exception.hh.
|
virtualnoexcept |
Definition at line 143 of file base_exception.hh.
|
virtualnoexcept |
Implements base_exception.
Definition at line 149 of file base_exception.hh.
|
protected |
Definition at line 82 of file base_exception.hh.
|
protected |
Definition at line 83 of file base_exception.hh.
|
mutableprotected |
Definition at line 79 of file base_exception.hh.
|
mutableprotected |
Definition at line 80 of file base_exception.hh.