Replace list with vector in most of the API.
[libsub.git] / src / raw_subtitle.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_RAW_SUBTITLE_H
21 #define LIBSUB_RAW_SUBTITLE_H
22
23 #include "sub_time.h"
24 #include "colour.h"
25 #include "vertical_reference.h"
26 #include "effect.h"
27 #include "font_size.h"
28 #include "vertical_position.h"
29 #include "horizontal_position.h"
30 #include <boost/optional.hpp>
31 #include <string>
32 #include <vector>
33
34 namespace sub {
35
36 /** @class RawSubtitle
37  *  @brief A bit of a subtitle, created with no regard for any nearby bits.
38  */
39 class RawSubtitle
40 {
41 public:
42         RawSubtitle ()
43                 : colour (1, 1, 1)
44                 , bold (false)
45                 , italic (false)
46                 , underline (false)
47         {}
48
49         /** Subtitle text in UTF-8 */
50         std::string text;
51         boost::optional<std::string> font;
52
53         /** font size */
54         FontSize font_size;
55
56         boost::optional<Effect> effect;
57         boost::optional<Colour> effect_colour;
58
59         Colour colour;
60         bool bold;      ///< true to use a bold version of font
61         bool italic;    ///< true to use an italic version of font
62         bool underline; ///< true to underline
63
64         HorizontalPosition horizontal_position;
65
66         /** vertical position of the baseline of the text */
67         VerticalPosition vertical_position;
68
69         /** from time */
70         Time from;
71         /** to time */
72         Time to;
73
74         boost::optional<Time> fade_up;
75         boost::optional<Time> fade_down;
76 };
77
78 bool operator< (RawSubtitle const &, RawSubtitle const &);
79
80 }
81
82 #endif