X-Git-Url: https://main.carlh.net/gitweb/?a=blobdiff_plain;f=src%2Flib%2Fstring_text_file.cc;h=919693dd85d6b14bc6ab82c16d555ae706ea50a3;hb=92b7d1cffbd0d457f8b4b23cc72937bcf8e5ed5e;hp=8c2c5651854e08a625f2d9602bfc9aaede91cf43;hpb=7392cb8383c9b857edad5f99eaf917ed70da237d;p=dcpomatic.git 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 +#include #include #include -#include -#include +#include #include +#include #include #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 content) { string ext = content->path(0).extension().string(); @@ -111,22 +114,24 @@ StringTextFile::StringTextFile (shared_ptr content) } } + /** @return time of first subtitle, if there is one */ optional StringTextFile::first () const { if (_subtitles.empty()) { - return optional(); + 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 ());