From d0255af1234de0f90017930b2ceb7e75ec14ca95 Mon Sep 17 00:00:00 2001 From: Carl Hetherington Date: Fri, 29 Nov 2024 00:42:13 +0100 Subject: Extract more stuff to verify_internal.h --- src/verify.cc | 76 +------------------------------------------------ src/verify_internal.h | 79 +++++++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 80 insertions(+), 75 deletions(-) (limited to 'src') diff --git a/src/verify.cc b/src/verify.cc index 42149197..8ad5f8a2 100644 --- a/src/verify.cc +++ b/src/verify.cc @@ -294,80 +294,6 @@ parse (XercesDOMParser& parser, string xml) } -class Context -{ -public: - Context( - std::vector& notes_, - boost::filesystem::path xsd_dtd_directory_, - function)> stage_, - function progress_, - VerificationOptions options_ - ) - : notes(notes_) - , xsd_dtd_directory(xsd_dtd_directory_) - , stage(stage_) - , progress(progress_) - , options(options_) - { - - } - - Context(Context const&) = delete; - Context& operator=(Context const&) = delete; - - template - void ok(dcp::VerificationNote::Code code, Args... args) - { - add_note({dcp::VerificationNote::Type::OK, code, std::forward(args)...}); - } - - template - void warning(dcp::VerificationNote::Code code, Args... args) - { - add_note({dcp::VerificationNote::Type::WARNING, code, std::forward(args)...}); - } - - template - void bv21_error(dcp::VerificationNote::Code code, Args... args) - { - add_note({dcp::VerificationNote::Type::BV21_ERROR, code, std::forward(args)...}); - } - - template - void error(dcp::VerificationNote::Code code, Args... args) - { - add_note({dcp::VerificationNote::Type::ERROR, code, std::forward(args)...}); - } - - void add_note(dcp::VerificationNote note) - { - if (cpl) { - note.set_cpl_id(cpl->id()); - } - notes.push_back(std::move(note)); - } - - void add_note_if_not_existing(dcp::VerificationNote note) - { - if (find(notes.begin(), notes.end(), note) == notes.end()) { - add_note(note); - } - } - - std::vector& notes; - std::shared_ptr dcp; - std::shared_ptr cpl; - boost::filesystem::path xsd_dtd_directory; - function)> stage; - function progress; - VerificationOptions options; - - boost::optional subtitle_language; - boost::optional audio_channels; -}; - - template void validate_xml(Context& context, T xml) @@ -1347,7 +1273,7 @@ verify_text_details(Context& context, vector> reels) void -verify_extension_metadata(Context& context) +dcp::verify_extension_metadata(Context& context) { DCP_ASSERT(context.cpl->file()); cxml::Document doc ("CompositionPlaylist"); diff --git a/src/verify_internal.h b/src/verify_internal.h index 3dfc4fb5..97c0e90f 100644 --- a/src/verify_internal.h +++ b/src/verify_internal.h @@ -44,7 +44,12 @@ #define LIBDCP_VERIFY_INTERNAL_H +#include "cpl.h" +#include "verify.h" +#include +#include #include +#include namespace dcp { @@ -67,6 +72,80 @@ extern void verify_text_lines_and_characters( ); +class Context +{ +public: + Context( + std::vector& notes_, + boost::filesystem::path xsd_dtd_directory_, + std::function)> stage_, + std::function progress_, + VerificationOptions options_ + ) + : notes(notes_) + , xsd_dtd_directory(xsd_dtd_directory_) + , stage(stage_) + , progress(progress_) + , options(options_) + {} + + Context(Context const&) = delete; + Context& operator=(Context const&) = delete; + + template + void ok(dcp::VerificationNote::Code code, Args... args) + { + add_note({dcp::VerificationNote::Type::OK, code, std::forward(args)...}); + } + + template + void warning(dcp::VerificationNote::Code code, Args... args) + { + add_note({dcp::VerificationNote::Type::WARNING, code, std::forward(args)...}); + } + + template + void bv21_error(dcp::VerificationNote::Code code, Args... args) + { + add_note({dcp::VerificationNote::Type::BV21_ERROR, code, std::forward(args)...}); + } + + template + void error(dcp::VerificationNote::Code code, Args... args) + { + add_note({dcp::VerificationNote::Type::ERROR, code, std::forward(args)...}); + } + + void add_note(dcp::VerificationNote note) + { + if (cpl) { + note.set_cpl_id(cpl->id()); + } + notes.push_back(std::move(note)); + } + + void add_note_if_not_existing(dcp::VerificationNote note) + { + if (find(notes.begin(), notes.end(), note) == notes.end()) { + add_note(note); + } + } + + std::vector& notes; + std::shared_ptr dcp; + std::shared_ptr cpl; + boost::filesystem::path xsd_dtd_directory; + std::function)> stage; + std::function progress; + VerificationOptions options; + + boost::optional subtitle_language; + boost::optional audio_channels; +}; + + +extern void verify_extension_metadata(dcp::Context& context); + } -- cgit v1.2.3