]> Dogcows Code - chaz/yoink/blob - src/moof/stlplus/exceptions.hpp
fixes for newer versions of g++
[chaz/yoink] / src / moof / stlplus / exceptions.hpp
1 #ifndef STLPLUS_EXCEPTIONS
2 #define STLPLUS_EXCEPTIONS
3 ////////////////////////////////////////////////////////////////////////////////
4
5 // Author: Andy Rushton
6 // Copyright: (c) Southampton University 1999-2004
7 // (c) Andy Rushton 2004-2009
8 // License: BSD License, see ../docs/license.html
9
10 // The set of general exceptions thrown by STLplus components
11
12 ////////////////////////////////////////////////////////////////////////////////
13 #include "containers_fixes.hpp"
14 #include <stdexcept>
15 #include <string>
16
17 namespace stlplus
18 {
19
20 ////////////////////////////////////////////////////////////////////////////////
21 // Thrown if a pointer or an iterator is dereferenced when it is null
22
23 class null_dereference : public std::logic_error
24 {
25 public:
26 null_dereference(const std::string& description) throw() :
27 std::logic_error(std::string("stlplus::null_dereference: ") + description) {}
28 ~null_dereference(void) throw() {}
29 };
30
31 ////////////////////////////////////////////////////////////////////////////////
32 // Thrown if an iterator is dereferenced when it is pointing to the end element
33
34 class end_dereference : public std::logic_error
35 {
36 public:
37 end_dereference(const std::string& description) throw() :
38 std::logic_error("stlplus::end_dereference: " + description) {}
39 ~end_dereference(void) throw() {}
40 };
41
42 ////////////////////////////////////////////////////////////////////////////////
43 // Thrown if an iterator is used with the wrong container. In other words, an
44 // iterator is created as a pointer to a sub-object within a container. If
45 // that iterator is then used with a different container, this exception is
46 // thrown.
47
48 class wrong_object : public std::logic_error
49 {
50 public:
51 wrong_object(const std::string& description) throw() :
52 std::logic_error("stlplus::wrong_object: " + description) {}
53 ~wrong_object(void) throw() {}
54 };
55
56 ////////////////////////////////////////////////////////////////////////////////
57 // Thrown if an attempt is made to copy an object that is uncopyable
58
59 class illegal_copy : public std::logic_error
60 {
61 public:
62 illegal_copy(const std::string& description) throw() :
63 std::logic_error("stlplus::illegal_copy: " + description) {}
64 ~illegal_copy(void) throw() {}
65 };
66
67 ////////////////////////////////////////////////////////////////////////////////
68
69 } // end namespace stlplus
70
71 #endif
This page took 0.032029 seconds and 4 git commands to generate.