X-Git-Url: https://git.carlh.net/gitweb/?a=blobdiff_plain;f=src%2Flib%2Fcinema.cc;h=ebd7160098df67d6657016427e09ca6037b47451;hb=6fde557864505b470c438e4161ee494f29b90d63;hp=f06db354343b3c971ce09e84bfba4ed950f08bf2;hpb=a112eeb4d052b1212f94e95efd83a215213da691;p=dcpomatic.git diff --git a/src/lib/cinema.cc b/src/lib/cinema.cc index f06db3543..ebd716009 100644 --- a/src/lib/cinema.cc +++ b/src/lib/cinema.cc @@ -1,5 +1,5 @@ /* - Copyright (C) 2013 Carl Hetherington + Copyright (C) 2013-2015 Carl Hetherington This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -18,17 +18,21 @@ */ #include "cinema.h" +#include "screen.h" #include #include +#include using std::list; +using std::string; using boost::shared_ptr; Cinema::Cinema (cxml::ConstNodePtr node) : name (node->string_child ("Name")) - , email (node->string_child ("Email")) { - + BOOST_FOREACH (cxml::ConstNodePtr i, node->node_children("Email")) { + emails.push_back (i->content ()); + } } /* This is necessary so that we can use shared_from_this in add_screen (which cannot be done from @@ -47,10 +51,13 @@ void Cinema::as_xml (xmlpp::Element* parent) const { parent->add_child("Name")->add_child_text (name); - parent->add_child("Email")->add_child_text (email); - for (list >::const_iterator i = _screens.begin(); i != _screens.end(); ++i) { - (*i)->as_xml (parent->add_child ("Screen")); + BOOST_FOREACH (string i, emails) { + parent->add_child("Email")->add_child_text (i); + } + + BOOST_FOREACH (shared_ptr i, _screens) { + i->as_xml (parent->add_child ("Screen")); } } @@ -66,22 +73,3 @@ Cinema::remove_screen (shared_ptr s) { _screens.remove (s); } - -Screen::Screen (cxml::ConstNodePtr node) - : name (node->string_child ("name")) -{ - if (node->optional_string_child ("Certificate")) { - certificate = dcp::Certificate (node->string_child ("Certificate")); - } -} - -void -Screen::as_xml (xmlpp::Element* parent) const -{ - parent->add_child("Name")->add_child_text (name); - if (certificate) { - parent->add_child("Certificate")->add_child_text (certificate->certificate (true)); - } -} - -