Itasca C++ Interface
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Modules Pages
baseexception.h
1 #pragma once
2 
3 #include "basestring.h"
4 
9 class iexception : public std::exception {
10 public:
11  template <typename... Args>
12  iexception(const string &s, Args&&... args) { message_ = fmt::format(s, args...); }
13 
15  BASE_EXPORT virtual const char *what() const throw() { return message_.data(); }
16 
18  void setMessage(const string &s) { message_ = s; }
19 
20 private:
21  string message_;
22 };
23 
24 // EoF
Base exception class for all Itasca code.
Definition: baseexception.h:9
#define BASE_EXPORT
Definition: basedef.h:21
virtual BASE_EXPORT const char * what() const
Returns the contents of the error message as a const char.
Definition: baseexception.h:15
QString helper functions, plus some additions.
void setMessage(const string &s)
Allows the message carried by the exception to be replaced with a new one.
Definition: baseexception.h:18