libsub
 All Classes Files Functions Variables
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 MessageError : public std::exception
29 {
30 public:
31  MessageError (std::string const & message)
32  : _message (message) {}
33  ~MessageError () throw () {}
34 
36  char const * what () const throw () {
37  return _message.c_str ();
38  }
39 
40 private:
42  std::string _message;
43 };
44 
48 class XMLError : public MessageError
49 {
50 public:
51  XMLError (std::string const & message)
52  : MessageError (message)
53  {}
54 };
55 
59 class STLError : public MessageError
60 {
61 public:
62  STLError (std::string const & message)
63  : MessageError (message)
64  {}
65 };
66 
70 class SubripError : public MessageError
71 {
72 public:
73  SubripError (std::string saw, std::string expecting)
74  : MessageError ("Error in SubRip file: saw " + saw + " while expecting " + expecting)
75  {}
76 };
77 
78 class MXFError : public MessageError
79 {
80 public:
81  MXFError (std::string const & message)
82  : MessageError (message)
83  {}
84 };
85 
87 {
88 public:
90  : MessageError ("unknown frame rate")
91  {}
92 };
93 
94 class DCPError : public MessageError
95 {
96 public:
97  DCPError (std::string const & message)
98  : MessageError (message)
99  {}
100 };
101 
102 }
103 
104 #endif
Definition: exceptions.h:94
An error raised when reading an XML file.
Definition: exceptions.h:48
Definition: exceptions.h:28
Definition: collect.h:26
An error raised when reading a Subrip file.
Definition: exceptions.h:70
Definition: exceptions.h:78
An error raised when reading a binary STL file.
Definition: exceptions.h:59
char const * what() const
Definition: exceptions.h:36
Definition: exceptions.h:86