X-Git-Url: https://git.carlh.net/gitweb/?a=blobdiff_plain;f=src%2Flib%2Fdkdm_wrapper.cc;h=74a71966e87b4667e0ab38b4361556a4ac3b89d9;hb=444809fb888ed99803f2d19c94d3faef067cf348;hp=809739e06fd471d14a564fbc1de468d6a1f93f59;hpb=ba049fdab4a47023d6d5ee8b5ff9bbb710afbabb;p=dcpomatic.git diff --git a/src/lib/dkdm_wrapper.cc b/src/lib/dkdm_wrapper.cc index 809739e06..74a71966e 100644 --- a/src/lib/dkdm_wrapper.cc +++ b/src/lib/dkdm_wrapper.cc @@ -21,13 +21,15 @@ #include "compose.hpp" #include "dkdm_wrapper.h" #include "dcpomatic_assert.h" +#include "warnings.h" +DCPOMATIC_DISABLE_WARNINGS #include -#include +DCPOMATIC_ENABLE_WARNINGS using std::string; using std::list; -using boost::shared_ptr; -using boost::dynamic_pointer_cast; +using std::shared_ptr; +using std::dynamic_pointer_cast; shared_ptr DKDMBase::read (cxml::ConstNodePtr node) @@ -36,7 +38,7 @@ DKDMBase::read (cxml::ConstNodePtr node) return shared_ptr (new DKDM (dcp::EncryptedKDM (node->content ()))); } else if (node->name() == "DKDMGroup") { shared_ptr group (new DKDMGroup (node->string_attribute ("Name"))); - BOOST_FOREACH (cxml::ConstNodePtr i, node->node_children()) { + for (auto i: node->node_children()) { shared_ptr c = read (i); if (c) { group->add (c); @@ -65,16 +67,24 @@ DKDMGroup::as_xml (xmlpp::Element* node) const { xmlpp::Element* f = node->add_child("DKDMGroup"); f->set_attribute ("Name", _name); - BOOST_FOREACH (shared_ptr i, _children) { + for (auto i: _children) { i->as_xml (f); } } void -DKDMGroup::add (shared_ptr child) +DKDMGroup::add (shared_ptr child, shared_ptr previous) { DCPOMATIC_ASSERT (child); - _children.push_back (child); + if (previous) { + list >::iterator i = find (_children.begin(), _children.end(), previous); + if (i != _children.end ()) { + ++i; + } + _children.insert (i, child); + } else { + _children.push_back (child); + } child->set_parent (dynamic_pointer_cast (shared_from_this ())); }