cpp-sdl2
C++ header-only SDL2 wrapper
sdl::Exception Class Reference

Define to deactivate exception support. More...

#include <exception.hpp>

+ Inheritance diagram for sdl::Exception:

Public Member Functions

 Exception (std::string const &function)
 Construct an exception object. More...
 
std::string function ()
 Return the string containing the name of the SDL function that failed. More...
 
std::string error ()
 Return the error message generated by SDL_GetError() at event object construction. More...
 
const char * what () const noexcept override
 
 Exception (std::string const &function)
 Constructor that will dump error informations to stderr, then kill the program. More...
 

Private Attributes

std::string function_
 storage for function name string More...
 
std::string error_
 storage for SDL_GetError() return string More...
 
std::string what_
 storage for the "what()" string. string is dynamically built when calling what() const More...
 

Detailed Description

Define to deactivate exception support.

Castrated exception class.

Custom exception object

Definition at line 21 of file exception.hpp.

Constructor & Destructor Documentation

◆ Exception() [1/2]

sdl::Exception::Exception ( std::string const &  function)
inline

Construct an exception object.

Will get the content of SDL_GetError() ont the '.what()' message

Parameters
functionstring containing the name of the SDL function

Definition at line 26 of file exception.hpp.

References error_.

◆ Exception() [2/2]

sdl::Exception::Exception ( std::string const &  function)
inline

Constructor that will dump error informations to stderr, then kill the program.

Definition at line 68 of file exception.hpp.

References error().

Member Function Documentation

◆ error()

std::string sdl::Exception::error ( )
inline

Return the error message generated by SDL_GetError() at event object construction.

Definition at line 34 of file exception.hpp.

References error_.

Referenced by Exception().

◆ function()

std::string sdl::Exception::function ( )
inline

Return the string containing the name of the SDL function that failed.

Definition at line 32 of file exception.hpp.

References function_.

◆ what()

const char* sdl::Exception::what ( ) const
inlineoverridenoexcept

Definition at line 36 of file exception.hpp.

References error_, function_, and what_.

Member Data Documentation

◆ error_

std::string sdl::Exception::error_
private

storage for SDL_GetError() return string

Definition at line 53 of file exception.hpp.

Referenced by error(), Exception(), and what().

◆ function_

std::string sdl::Exception::function_
private

storage for function name string

Definition at line 51 of file exception.hpp.

Referenced by function(), and what().

◆ what_

std::string sdl::Exception::what_
mutableprivate

storage for the "what()" string. string is dynamically built when calling what() const

Definition at line 55 of file exception.hpp.

Referenced by what().


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