HoverRace  2.0
ScriptExn.h
Go to the documentation of this file.
1 
2 // ScriptExn.h
3 //
4 // Copyright (c) 2009, 2014 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 #if defined(_WIN32) && defined(HR_ENGINE_SHARED)
25 # ifdef MR_ENGINE
26 # define MR_DllDeclare __declspec( dllexport )
27 # else
28 # define MR_DllDeclare __declspec( dllimport )
29 # endif
30 #else
31 # define MR_DllDeclare
32 #endif
33 
34 namespace HoverRace {
35 namespace Script {
36 
41 class MR_DllDeclare ScriptExn : public std::exception
42 {
43  using SUPER = std::exception;
44 
45 public:
46  ScriptExn() : SUPER() { }
47  ScriptExn(const char* const msg) : SUPER(), msg(msg) { }
48  ScriptExn(const std::string &msg) : SUPER(), msg(msg) { }
49  virtual ~ScriptExn() noexcept { }
50 
51  const char* what() const noexcept override { return msg.c_str(); }
52  virtual const std::string &GetMessage() const noexcept { return msg; }
53 
54 private:
55  std::string msg;
56 };
57 
58 } // namespace Script
59 } // namespace HoverRace
60 
61 #undef MR_DllDeclare
Generic script engine exception.
Definition: ScriptExn.h:41
ScriptExn()
Definition: ScriptExn.h:46
ScriptExn(const std::string &msg)
Definition: ScriptExn.h:48
#define MR_DllDeclare
Definition: ScriptExn.h:31
virtual ~ScriptExn() noexcept
Definition: ScriptExn.h:49
ScriptExn(const char *const msg)
Definition: ScriptExn.h:47
virtual const std::string & GetMessage() const noexcept
Definition: ScriptExn.h:52
const char * what() const noexceptoverride
Definition: ScriptExn.h:51
Definition: Announcement.h:24
std::string msg
Definition: ScriptExn.h:55
std::exception SUPER
Definition: ScriptExn.h:43