diff options
| author | Carl Hetherington <cth@carlh.net> | 2024-05-22 23:04:40 +0200 |
|---|---|---|
| committer | Carl Hetherington <cth@carlh.net> | 2024-05-22 23:30:01 +0200 |
| commit | affaca1e5bc1c4dfdd7f2bd0f0dbbd9ec825b157 (patch) | |
| tree | 8c4e41da0df0cde983a3c85a8312c61c31e560cb /src/ssa_reader.h | |
| parent | 607ba59181708568c23295aa1069ebbfc78f2e9c (diff) | |
Add a Context class to manage some state.
Diffstat (limited to 'src/ssa_reader.h')
| -rw-r--r-- | src/ssa_reader.h | 18 |
1 files changed, 16 insertions, 2 deletions
diff --git a/src/ssa_reader.h b/src/ssa_reader.h index d47d8cb..5de660c 100644 --- a/src/ssa_reader.h +++ b/src/ssa_reader.h @@ -41,8 +41,22 @@ public: SSAReader (FILE* f); SSAReader (std::string subs); - static std::vector<RawSubtitle> parse_line(RawSubtitle base, std::string line, int play_res_x, int play_res_y, Colour primary_colour); - static void parse_tag(RawSubtitle& sub, std::string style, int play_res_x, int play_res_y, Colour primary_colour); + class Context + { + public: + Context(int play_res_x_, int play_res_y_, Colour primary_colour_) + : play_res_x(play_res_x_) + , play_res_y(play_res_y_) + , primary_colour(primary_colour_) + {} + + int play_res_x; + int play_res_y; + Colour primary_colour; + }; + + static std::vector<RawSubtitle> parse_line(RawSubtitle base, std::string line, Context const& context); + static void parse_tag(RawSubtitle& sub, std::string style, Context const& context); private: void read (boost::function<boost::optional<std::string> ()> get_line); |
