HoverRace  2.0
Exception.h
Go to the documentation of this file.
1 
2 // Exception.h
3 //
4 // Copyright (c) 2010, 2014-2015 Michael Imamura.
5 //
6 // Licensed under GrokkSoft HoverRace SourceCode License v1.0(the "License");
7 // you may not use this file except in compliance with the License.
8 //
9 // A copy of the license should have been attached to the package from which
10 // you have taken this file. If you can not find the license you can not use
11 // this file.
12 //
13 //
14 // The author makes no representations about the suitability of
15 // this software for any purpose. It is provided "as is" "AS IS",
16 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
17 // implied.
18 //
19 // See the License for the specific language governing permissions
20 // and limitations under the License.
21 
22 #pragma once
23 
24 #include <exception>
25 
26 #if defined(_WIN32) && defined(HR_ENGINE_SHARED)
27 # ifdef MR_ENGINE
28 # define MR_DllDeclare __declspec( dllexport )
29 # else
30 # define MR_DllDeclare __declspec( dllimport )
31 # endif
32 #else
33 # define MR_DllDeclare
34 #endif
35 
36 namespace HoverRace {
37 
42 class MR_DllDeclare Exception : public std::exception
43 {
44  using SUPER = std::exception;
45 
46 public:
47  Exception() : SUPER() { }
48  Exception(const std::string &msg) : SUPER(), msg(msg) { }
49  Exception(const char *msg) : SUPER(), msg(msg) { }
50  virtual ~Exception() noexcept { }
51 
52  const char* what() const noexcept override { return msg.c_str(); }
53 
54 protected:
55  std::string &GetMessage() noexcept { return msg; }
56 
57 private:
58  std::string msg;
59 };
60 
66 {
67  using SUPER = Exception;
68 
69 public:
71  UnimplementedExn(const std::string &msg) : SUPER(msg) { }
72  UnimplementedExn(const char *msg) : SUPER(msg) { }
73  virtual ~UnimplementedExn() noexcept { }
74 };
75 
76 } // namespace HoverRace
77 
78 #undef MR_DllDeclare
std::string msg
Definition: Exception.h:58
UnimplementedExn()
Definition: Exception.h:70
const char * what() const noexceptoverride
Definition: Exception.h:52
std::exception SUPER
Definition: Exception.h:44
virtual ~UnimplementedExn() noexcept
Definition: Exception.h:73
#define MR_DllDeclare
Definition: Exception.h:33
UnimplementedExn(const std::string &msg)
Definition: Exception.h:71
std::string & GetMessage() noexcept
Definition: Exception.h:55
Exception indicating an unimplemented bit of code has been hit.
Definition: Exception.h:65
virtual ~Exception() noexcept
Definition: Exception.h:50
UnimplementedExn(const char *msg)
Definition: Exception.h:72
Definition: Announcement.h:24
Exception(const std::string &msg)
Definition: Exception.h:48
Exception(const char *msg)
Definition: Exception.h:49
Base exception, providing constructors for setting the message.
Definition: Exception.h:42
Exception()
Definition: Exception.h:47