From ff38c8737a36e5aced5f2dede5bccd2832fc446a Mon Sep 17 00:00:00 2001 From: Carl Hetherington Date: Fri, 30 Aug 2013 17:27:22 +0100 Subject: Partial. --- src/reel.cc | 50 ++++++++------------------------------------------ 1 file changed, 8 insertions(+), 42 deletions(-) (limited to 'src/reel.cc') diff --git a/src/reel.cc b/src/reel.cc index 43c934ea..fc6cbd49 100644 --- a/src/reel.cc +++ b/src/reel.cc @@ -31,57 +31,23 @@ using std::cout; using boost::shared_ptr; using namespace libdcp; +Reel::Reel (shared_ptr node) +{ + asset_list = type_child (node, "AssetList"); +} + void Reel::write_to_cpl (xmlpp::Element* node, bool interop) const { xmlpp::Element* reel = node->add_child ("Reel"); reel->add_child("Id")->add_child_text ("urn:uuid:" + make_uuid()); - xmlpp::Element* asset_list = reel->add_child ("AssetList"); - - if (_main_picture) { - _main_picture->write_to_cpl (asset_list, interop); - } - - if (_main_sound) { - _main_sound->write_to_cpl (asset_list, interop); - } - - if (_main_subtitle) { - _main_subtitle->write_to_cpl (asset_list, interop); - } + asset_list->write_to_cpl (reel, interop); } bool -Reel::equals (boost::shared_ptr other, EqualityOptions opt, boost::function note) const +Reel::equals (shared_ptr other, EqualityOptions opt, boost::function note) const { - if ((_main_picture && !other->_main_picture) || (!_main_picture && other->_main_picture)) { - note (ERROR, "reel has different assets"); - return false; - } - - if (_main_picture && !_main_picture->equals (other->_main_picture, opt, note)) { - return false; - } - - if ((_main_sound && !other->_main_sound) || (!_main_sound && other->_main_sound)) { - note (ERROR, "reel has different assets"); - return false; - } - - if (_main_sound && !_main_sound->equals (other->_main_sound, opt, note)) { - return false; - } - - if ((_main_subtitle && !other->_main_subtitle) || (!_main_subtitle && other->_main_subtitle)) { - note (ERROR, "reel has different assets"); - return false; - } - - if (_main_subtitle && !_main_subtitle->equals (other->_main_subtitle, opt, note)) { - return false; - } - - return true; + return asset_list->equals (other.asset_list, opt, note); } bool -- cgit v1.2.3