HoverRace  2.0
NetExn.h
Go to the documentation of this file.
1 
2 // NetExn.h
3 // The base network exception.
4 //
5 // Copyright (c) 2009 Michael Imamura.
6 //
7 // Licensed under GrokkSoft HoverRace SourceCode License v1.0(the "License");
8 // you may not use this file except in compliance with the License.
9 //
10 // A copy of the license should have been attached to the package from which
11 // you have taken this file. If you can not find the license you can not use
12 // this file.
13 //
14 //
15 // The author makes no representations about the suitability of
16 // this software for any purpose. It is provided "as is" "AS IS",
17 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
18 // implied.
19 //
20 // See the License for the specific language governing permissions
21 // and limitations under the License.
22 
23 #pragma once
24 
25 #if defined(_WIN32) && defined(HR_ENGINE_SHARED)
26 # ifdef MR_ENGINE
27 # define MR_DllDeclare __declspec( dllexport )
28 # else
29 # define MR_DllDeclare __declspec( dllimport )
30 # endif
31 #else
32 # define MR_DllDeclare
33 #endif
34 
35 namespace HoverRace {
36 namespace Net {
37 
42 class MR_DllDeclare NetExn : public std::exception
43 {
44  typedef std::exception SUPER;
45 
46  public:
47  NetExn() : SUPER() { }
48  NetExn(const char* const &msg) : SUPER(), msg(msg) { }
49  NetExn(const std::string &msg) : SUPER(), msg(msg) { }
50  virtual ~NetExn() throw() { }
51 
52  virtual const char* what() const throw() { return msg.c_str(); }
53 
54  private:
55  std::string msg;
56 };
57 
65 {
66  public:
67  CanceledExn() : NetExn("Transfer canceled") { }
68  virtual ~CanceledExn() throw() { }
69 };
70 
71 } // namespace Net
72 } // namespace HoverRace
73 
74 #undef MR_DllDeclare
NetExn(const char *const &msg)
Definition: NetExn.h:48
A network exception.
Definition: NetExn.h:42
virtual const char * what() const
Definition: NetExn.h:52
NetExn(const std::string &msg)
Definition: NetExn.h:49
CanceledExn()
Definition: NetExn.h:67
#define MR_DllDeclare
Definition: NetExn.h:32
Thrown when the transfer is intentionally aborted (usually by CancelFlag).
Definition: NetExn.h:64
virtual ~NetExn()
Definition: NetExn.h:50
std::exception SUPER
Definition: NetExn.h:44
std::string msg
Definition: NetExn.h:55
Definition: Announcement.h:24
NetExn()
Definition: NetExn.h:47
virtual ~CanceledExn()
Definition: NetExn.h:68