2 Copyright (C) 2014 Carl Hetherington <cth@carlh.net>
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.
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.
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.
20 #ifndef LIBSUB_STL_BINARY_TABLES_H
21 #define LIBSUB_STL_BINARY_TABLES_H
25 #include <boost/optional.hpp>
29 enum DisplayStandard {
30 DISPLAY_STANDARD_UNDEFINED,
31 DISPLAY_STANDARD_OPEN_SUBTITLING,
32 DISPLAY_STANDARD_LEVEL_1_TELETEXT,
33 DISPLAY_STANDARD_LEVEL_2_TELETEXT
38 LANGUAGE_GROUP_LATIN_CYRILLIC,
39 LANGUAGE_GROUP_LATIN_ARABIC,
40 LANGUAGE_GROUP_LATIN_GREEK,
41 LANGUAGE_GROUP_LATIN_HEBREW,
71 LANGUAGE_LUXEMBORGIAN,
96 LANGUAGE_BIELORUSSIAN,
133 LANGUAGE_SERBO_CROAT,
137 LANGUAGE_SRANAN_TONGO,
151 enum TimecodeStatus {
152 TIMECODE_STATUS_NOT_INTENDED_FOR_USE,
153 TIMECODE_STATUS_INTENDED_FOR_USE
156 enum CumulativeStatus {
157 CUMULATIVE_STATUS_NOT_CUMULATIVE,
158 CUMULATIVE_STATUS_FIRST,
159 CUMULATIVE_STATUS_INTERMEDIATE,
160 CUMULATIVE_STATUS_LAST
166 JUSTIFICATION_CENTRE,
175 /** @class STLBinaryCode
176 * @brief A value of some STL parameter and a human-readable description of what it means.
186 STLBinaryCode (T v, std::string d)
192 std::string description;
195 /** @class STLBinaryTables
196 * @brief A set of conversion tables for STL binary files.
198 class STLBinaryTables
203 DisplayStandard display_standard_file_to_enum (std::string) const;
204 LanguageGroup language_group_file_to_enum (std::string) const;
205 Language language_file_to_enum (std::string) const;
206 TimecodeStatus timecode_status_file_to_enum (std::string) const;
207 CumulativeStatus cumulative_status_file_to_enum (int) const;
208 Justification justification_file_to_enum (int) const;
209 Comment comment_file_to_enum (int) const;
211 std::string language_enum_to_file (Language) const;
212 int cumulative_status_enum_to_file (CumulativeStatus) const;
213 int justification_enum_to_file (Justification) const;
214 int comment_enum_to_file (Comment) const;
216 std::string display_standard_enum_to_description (DisplayStandard) const;
217 std::string language_group_enum_to_description (LanguageGroup) const;
218 std::string language_enum_to_description (Language) const;
219 std::string timecode_status_enum_to_description (TimecodeStatus) const;
220 std::string cumulative_status_enum_to_description (CumulativeStatus) const;
221 std::string justification_enum_to_description (Justification) const;
222 std::string comment_enum_to_description (Comment) const;
224 boost::optional<Language> language_description_to_enum (std::string) const;
227 std::map<std::string, STLBinaryCode<DisplayStandard> > _display_standard_map;
228 std::map<std::string, STLBinaryCode<LanguageGroup> > _language_group_map;
229 std::map<std::string, STLBinaryCode<Language> > _language_map;
230 std::map<std::string, STLBinaryCode<TimecodeStatus> > _timecode_status_map;
231 std::map<int, STLBinaryCode<CumulativeStatus> > _cumulative_status_map;
232 std::map<int, STLBinaryCode<Justification> > _justification_map;
233 std::map<int, STLBinaryCode<Comment> > _comment_map;