X-Git-Url: https://main.carlh.net/gitweb/?a=blobdiff_plain;f=src%2Flib%2Fsubtitle_analysis.cc;h=0838816b04a823fcd8e3201da5001c6f9a41f77d;hb=b0d658e5c5b953b38e341a90518b5e7b2108811a;hp=f8254f00d62fa791742d097812445801e727a7d6;hpb=3dc465914c2853923535ab630457874c11b1db3e;p=dcpomatic.git diff --git a/src/lib/subtitle_analysis.cc b/src/lib/subtitle_analysis.cc index f8254f00d..0838816b0 100644 --- a/src/lib/subtitle_analysis.cc +++ b/src/lib/subtitle_analysis.cc @@ -1,5 +1,5 @@ /* - Copyright (C) 2020 Carl Hetherington + Copyright (C) 2020-2021 Carl Hetherington This file is part of DCP-o-matic. @@ -18,15 +18,22 @@ */ + #include "subtitle_analysis.h" #include "exceptions.h" +#include "warnings.h" #include #include +DCPOMATIC_DISABLE_WARNINGS #include +DCPOMATIC_ENABLE_WARNINGS + +using std::make_shared; +using std::shared_ptr; using std::string; using dcp::raw_convert; -using boost::shared_ptr; + int const SubtitleAnalysis::_current_state_version = 1; @@ -39,7 +46,7 @@ SubtitleAnalysis::SubtitleAnalysis (boost::filesystem::path path) if (f.optional_number_child("Version").get_value_or(1) < _current_state_version) { /* Too old. Throw an exception so that this analysis is re-run. */ - throw OldFormatError ("Audio analysis file is too old"); + throw OldFormatError ("Subtitle analysis file is too old"); } cxml::NodePtr bounding_box = f.optional_node_child("BoundingBox"); @@ -59,13 +66,13 @@ SubtitleAnalysis::SubtitleAnalysis (boost::filesystem::path path) void SubtitleAnalysis::write (boost::filesystem::path path) const { - shared_ptr doc (new xmlpp::Document); + auto doc = make_shared(); xmlpp::Element* root = doc->create_root_node ("SubtitleAnalysis"); root->add_child("Version")->add_child_text (raw_convert(_current_state_version)); if (_bounding_box) { - xmlpp::Element* bounding_box = root->add_child("BoundingBox"); + auto bounding_box = root->add_child("BoundingBox"); bounding_box->add_child("X")->add_child_text(raw_convert(_bounding_box->x)); bounding_box->add_child("Y")->add_child_text(raw_convert(_bounding_box->y)); bounding_box->add_child("Width")->add_child_text(raw_convert(_bounding_box->width)); @@ -78,4 +85,3 @@ SubtitleAnalysis::write (boost::filesystem::path path) const doc->write_to_file_formatted (path.string()); } -