Tweak ISO6937 mapping to put $ sign on 0xa4 (164) (from master).
[libsub.git] / src / exceptions.h
1 /*
2     Copyright (C) 2014 Carl Hetherington <cth@carlh.net>
3
4     This program is free software; you can redistribute it and/or modify
5     it under the terms of the GNU General Public License as published by
6     the Free Software Foundation; either version 2 of the License, or
7     (at your option) any later version.
8
9     This program is distributed in the hope that it will be useful,
10     but WITHOUT ANY WARRANTY; without even the implied warranty of
11     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
12     GNU General Public License for more details.
13
14     You should have received a copy of the GNU General Public License
15     along with this program; if not, write to the Free Software
16     Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
17
18 */
19
20 #ifndef LIBSUB_EXCEPTIONS_H
21 #define LIBSUB_EXCEPTIONS_H
22
23 #include <stdexcept>
24 #include <string>
25
26 namespace sub {
27
28 /** @class XMLError
29  *  @brief An error raised when reading an XML file.
30  */
31 class XMLError : public std::runtime_error
32 {
33 public:
34         XMLError (std::string const & message)
35                 : std::runtime_error (message)
36         {}
37 };
38
39 /** @class STLError
40  *  @brief An error raised when reading a binary STL file.
41  */
42 class STLError : public std::runtime_error
43 {
44 public:
45         STLError (std::string const & message)
46                 : std::runtime_error (message)
47         {}
48 };
49
50 /** @class SubripError
51  *  @brief An error raised when reading a Subrip file.
52  */
53 class SubripError : public std::runtime_error
54 {
55 public:
56         SubripError (std::string saw, std::string expecting)
57                 : std::runtime_error ("Error in SubRip file: saw " + saw + " while expecting " + expecting)
58         {}
59 };
60
61 class MXFError : public std::runtime_error
62 {
63 public:
64         MXFError (std::string const & message)
65                 : std::runtime_error (message)
66         {}
67 };
68
69 class UnknownFrameRateError : public std::runtime_error
70 {
71 public:
72         UnknownFrameRateError ()
73                 : std::runtime_error ("unknown frame rate")
74         {}
75 };
76
77 class DCPError : public std::runtime_error
78 {
79 public:
80         DCPError (std::string const & message)
81                 : std::runtime_error (message)
82         {}
83 };
84
85 class ProgrammingError : public std::runtime_error
86 {
87 public:
88         ProgrammingError (std::string file, int line);
89 };
90
91 }
92
93 #endif