summaryrefslogtreecommitdiff
path: root/src/reel.cc
diff options
context:
space:
mode:
authorCarl Hetherington <cth@carlh.net>2013-08-30 17:27:22 +0100
committerCarl Hetherington <cth@carlh.net>2013-08-30 17:27:22 +0100
commitff38c8737a36e5aced5f2dede5bccd2832fc446a (patch)
tree652a0548b76cfff2f4e7438c477cd4ac18f7a089 /src/reel.cc
parentd0e025d26cab0eecfea1528343638dac69f363cd (diff)
Partial.rework-again
Diffstat (limited to 'src/reel.cc')
-rw-r--r--src/reel.cc50
1 files changed, 8 insertions, 42 deletions
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<cxml::Node> node)
+{
+ asset_list = type_child<AssetList> (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<const Reel> other, EqualityOptions opt, boost::function<void (NoteType, string)> note) const
+Reel::equals (shared_ptr<const Reel> other, EqualityOptions opt, boost::function<void (NoteType, string)> 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