From ed3326d5ac0f05762f820a341332718ebea220f5 Mon Sep 17 00:00:00 2001 From: Carl Hetherington Date: Thu, 30 Apr 2015 23:19:51 +0100 Subject: Some BOOST_FOREACH. --- src/cpl.cc | 33 +++++++++++++++++---------------- 1 file changed, 17 insertions(+), 16 deletions(-) (limited to 'src/cpl.cc') diff --git a/src/cpl.cc b/src/cpl.cc index b0fc8d77..b11452d9 100644 --- a/src/cpl.cc +++ b/src/cpl.cc @@ -30,6 +30,7 @@ #include "dcp_assert.h" #include "compose.hpp" #include +#include using std::string; using std::stringstream; @@ -135,9 +136,9 @@ CPL::write_xml (boost::filesystem::path file, Standard standard, shared_ptradd_child("RatingList"); xmlpp::Element* reel_list = root->add_child ("ReelList"); - - for (list >::const_iterator i = _reels.begin(); i != _reels.end(); ++i) { - (*i)->write_to_cpl (reel_list, standard); + + BOOST_FOREACH (shared_ptr i, _reels) { + i->write_to_cpl (reel_list, standard); } if (signer) { @@ -155,15 +156,15 @@ CPL::reel_assets () const { list > c; - for (list >::const_iterator i = _reels.begin(); i != _reels.end(); ++i) { - if ((*i)->main_picture ()) { - c.push_back ((*i)->main_picture()); + BOOST_FOREACH (shared_ptr i, _reels) { + if (i->main_picture ()) { + c.push_back (i->main_picture()); } - if ((*i)->main_sound ()) { - c.push_back ((*i)->main_sound()); + if (i->main_sound ()) { + c.push_back (i->main_sound()); } - if ((*i)->main_subtitle ()) { - c.push_back ((*i)->main_subtitle()); + if (i->main_subtitle ()) { + c.push_back (i->main_subtitle()); } } @@ -213,8 +214,8 @@ CPL::equals (shared_ptr other, EqualityOptions opt, NoteHandler not bool CPL::encrypted () const { - for (list >::const_iterator i = _reels.begin(); i != _reels.end(); ++i) { - if ((*i)->encrypted ()) { + BOOST_FOREACH (shared_ptr i, _reels) { + if (i->encrypted ()) { return true; } } @@ -229,16 +230,16 @@ CPL::encrypted () const void CPL::add (DecryptedKDM const & kdm) { - for (list >::const_iterator i = _reels.begin(); i != _reels.end(); ++i) { - (*i)->add (kdm); + BOOST_FOREACH (shared_ptr i, _reels) { + i->add (kdm); } } void CPL::resolve_refs (list > objects) { - for (list >::const_iterator i = _reels.begin(); i != _reels.end(); ++i) { - (*i)->resolve_refs (objects); + BOOST_FOREACH (shared_ptr i, _reels) { + i->resolve_refs (objects); } } -- cgit v1.2.3