Support rgba() colour specifiers in Subrip files; not sure if they are strictly allow...
[libsub.git] / src / subrip_reader.h
1 /*
2     Copyright (C) 2014-2019 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 /** @file  src/subrip_reader.h
21  *  @brief SubripReader class.
22  */
23
24 #ifndef LIBSUB_SUBRIP_READER_H
25 #define LIBSUB_SUBRIP_READER_H
26
27 #include "reader.h"
28 #include <boost/function.hpp>
29
30 struct subrip_reader_convert_line_test;
31 struct subrip_reader_convert_time_test;
32 struct subrip_reader_test5;
33
34 namespace sub {
35
36 class SubripReader : public Reader
37 {
38 public:
39         SubripReader (FILE* f);
40         SubripReader (std::string subs);
41
42 private:
43         /* For tests */
44         friend struct ::subrip_reader_convert_line_test;
45         friend struct ::subrip_reader_convert_time_test;
46         friend struct ::subrip_reader_test5;
47         SubripReader () {}
48
49         Time convert_time (std::string t);
50         void convert_line (std::string t, RawSubtitle& p);
51         void maybe_content (RawSubtitle& p);
52         void read (boost::function<boost::optional<std::string> ()> get_line);
53
54         std::list<std::string> _context;
55 };
56
57 }
58
59 #endif