Inexor
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
Classes | Namespaces | Macros
InexorException.hpp File Reference
#include <exception>
#include <string>
#include <utility>
#include "inexor/util/StringFormatter.hpp"

Go to the source code of this file.

Classes

class  inexor::util::InexorException
 Basic exception type for use in inexor. More...
 

Namespaces

 inexor
 Show stacktrace on unix, do not include directly.
 
 inexor::util
 

Macros

#define EXCEPTION(name, base, __what)
 Create exceptions on the fly. More...
 
#define IEXCEPTION(name, __what)   EXCEPTION(name, ::inexor::util::InexorException, __what)
 Like EXCEPTION but uses InexorException as base, so no need to specify one manually. More...
 

Macro Definition Documentation

#define EXCEPTION (   name,
  base,
  __what 
)
Value:
class name : public base { \
public: \
name() : base(__what) {} \
name(const char *s) : base(s) {} \
name(const std::string &s) : base(s) {} \
name(const InexorException &e) : base(e) {} \
virtual const char* clazz() noexcept { \
return #name ; \
} \
}
char string[MAXSTRLEN]
cube-strings (char arrays of fixed size).
Definition: cube_types.hpp:18

Create exceptions on the fly.

EXCEPTION(IdioticException, InexorException, "Well, this is silly."); ... IdioticException a, b("Pow pow!"); a.what(); // => "Well, this is silly." b.what(); // => "Pow, pow!"

Parameters
nameThe name of the new exception class
baseThe name of the base exception class to extend
__whatThe default error message, when none is set on the fly
#define IEXCEPTION (   name,
  __what 
)    EXCEPTION(name, ::inexor::util::InexorException, __what)

Like EXCEPTION but uses InexorException as base, so no need to specify one manually.