]> git.tdb.fi Git - libs/datafile.git/blob - source/except.h
Move the definition of Input's operator bool to the header
[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 #include "mspdatafile_api.h"
8
9 namespace Msp {
10 namespace DataFile {
11
12 class MSPDATAFILE_API data_error: public std::runtime_error
13 {
14 private:
15         std::string source;
16         unsigned line = 0;
17
18 public:
19         data_error(const std::string &, unsigned, const std::string &);
20         data_error(const std::string &, unsigned, const std::exception &);
21         data_error(const std::string &, unsigned, const data_error &);
22
23         const std::string &get_source() const { return source; }
24         unsigned get_line() const { return line; }
25
26 private:
27         std::string make_what(const std::string &, unsigned, const std::string &);
28 };
29
30
31 class MSPDATAFILE_API parse_error: public std::runtime_error
32 {
33 public:
34         parse_error(const std::string &);
35 };
36
37
38 class MSPDATAFILE_API syntax_error: public std::runtime_error
39 {
40 public:
41         syntax_error(const std::string &t);
42 };
43
44
45 class MSPDATAFILE_API bad_definition: public std::runtime_error
46 {
47 public:
48         bad_definition(const std::string &w);
49 };
50
51
52 class MSPDATAFILE_API nesting_error: public std::logic_error
53 {
54 public:
55         nesting_error(const std::string &);
56 };
57
58
59 class MSPDATAFILE_API unknown_keyword: public std::runtime_error
60 {
61 public:
62         unknown_keyword(const std::string &);
63 };
64
65
66 class MSPDATAFILE_API invalid_signature: public std::runtime_error
67 {
68 public:
69         invalid_signature(const std::string &, const std::string &);
70 };
71
72
73 class MSPDATAFILE_API no_collection: public std::runtime_error
74 {
75 public:
76         no_collection(const std::type_info &);
77 };
78
79 } // namespace DataFile
80 } // namespace Msp
81
82 #endif