]> git.tdb.fi Git - libs/datafile.git/blob - source/except.h
Add a missing include
[libs/datafile.git] / source / except.h
1 #ifndef MSP_DATAFILE_EXCEPT_H_
2 #define MSP_DATAFILE_EXCEPT_H_
3
4 #include <stdexcept>
5 #include <string>
6 #include <typeinfo>
7
8 namespace Msp {
9 namespace DataFile {
10
11 class data_error: public std::runtime_error
12 {
13 private:
14         std::string source;
15         unsigned line;
16
17 public:
18         data_error(const std::string &, unsigned, const std::string &);
19         data_error(const std::string &, unsigned, const std::exception &);
20         virtual ~data_error() throw() { }
21
22         const std::string &get_source() const { return source; }
23         unsigned get_line() const { return line; }
24
25 private:
26         std::string make_what(const std::string &, unsigned, const std::string &);
27 };
28
29
30 class parse_error: public std::runtime_error
31 {
32 public:
33         parse_error(const std::string &);
34         virtual ~parse_error() throw() { }
35 };
36
37
38 class syntax_error: public std::runtime_error
39 {
40 public:
41         syntax_error(const std::string &t);
42         virtual ~syntax_error() throw() { }
43 };
44
45
46 class bad_definition: public std::runtime_error
47 {
48 public:
49         bad_definition(const std::string &w);
50         virtual ~bad_definition() throw() { }
51 };
52
53
54 class nesting_error: public std::logic_error
55 {
56 public:
57         nesting_error(const std::string &);
58         virtual ~nesting_error() throw() { }
59 };
60
61
62 class unknown_keyword: public std::runtime_error
63 {
64 public:
65         unknown_keyword(const std::string &);
66         virtual ~unknown_keyword() throw() { }
67 };
68
69
70 class invalid_signature: public std::runtime_error
71 {
72 public:
73         invalid_signature(const std::string &, const std::string &);
74         virtual ~invalid_signature() throw() { }
75 };
76
77
78 class no_collection: public std::runtime_error
79 {
80 public:
81         no_collection(const std::type_info &);
82 };
83
84 } // namespace DataFile
85 } // namespace Msp
86
87 #endif