diff options
| author | Carl Hetherington <cth@carlh.net> | 2022-01-09 16:29:21 +0100 |
|---|---|---|
| committer | Carl Hetherington <cth@carlh.net> | 2022-01-09 16:29:21 +0100 |
| commit | 92b7d1cffbd0d457f8b4b23cc72937bcf8e5ed5e (patch) | |
| tree | b175db682422765468991702e8563bcd89713b70 /src/lib/string_text_file.cc | |
| parent | 7392cb8383c9b857edad5f99eaf917ed70da237d (diff) | |
Tidying.
Diffstat (limited to 'src/lib/string_text_file.cc')
| -rw-r--r-- | src/lib/string_text_file.cc | 23 |
1 files changed, 14 insertions, 9 deletions
diff --git a/src/lib/string_text_file.cc b/src/lib/string_text_file.cc index 8c2c56518..919693dd8 100644 --- a/src/lib/string_text_file.cc +++ b/src/lib/string_text_file.cc @@ -18,29 +18,32 @@ */ -#include "string_text_file.h" + #include "cross.h" #include "exceptions.h" +#include "string_text_file.h" #include "string_text_file_content.h" -#include <sub/subrip_reader.h> +#include <sub/collect.h> #include <sub/ssa_reader.h> #include <sub/stl_binary_reader.h> -#include <sub/collect.h> -#include <unicode/ucsdet.h> +#include <sub/subrip_reader.h> #include <unicode/ucnv.h> +#include <unicode/ucsdet.h> #include <iostream> #include "i18n.h" -using std::vector; + using std::cout; -using std::string; using std::shared_ptr; -using boost::scoped_array; +using std::string; +using std::vector; using boost::optional; +using boost::scoped_array; using dcp::ArrayData; using namespace dcpomatic; + StringTextFile::StringTextFile (shared_ptr<const StringTextFileContent> content) { string ext = content->path(0).extension().string(); @@ -111,22 +114,24 @@ StringTextFile::StringTextFile (shared_ptr<const StringTextFileContent> content) } } + /** @return time of first subtitle, if there is one */ optional<ContentTime> StringTextFile::first () const { if (_subtitles.empty()) { - return optional<ContentTime>(); + return {}; } return ContentTime::from_seconds(_subtitles[0].from.all_as_seconds()); } + ContentTime StringTextFile::length () const { if (_subtitles.empty ()) { - return ContentTime (); + return {}; } return ContentTime::from_seconds (_subtitles.back().to.all_as_seconds ()); |
