X-Git-Url: https://main.carlh.net/gitweb/?a=blobdiff_plain;f=src%2Flib%2Fcinema.cc;h=ce3077b2a041df9ab21e6600a59f4f770f78f164;hb=476ed8e65f9edd2303c94609f974b15f2a9166cd;hp=43a4322396144417041ec801c380895f170079bf;hpb=1dcfb3a26085ebb3703f40e2f51e43ce3d98be50;p=dcpomatic.git diff --git a/src/lib/cinema.cc b/src/lib/cinema.cc index 43a432239..ce3077b2a 100644 --- a/src/lib/cinema.cc +++ b/src/lib/cinema.cc @@ -17,14 +17,14 @@ */ -#include -#include #include "cinema.h" +#include +#include using std::list; using boost::shared_ptr; -Cinema::Cinema (shared_ptr node) +Cinema::Cinema (cxml::ConstNodePtr node) : name (node->string_child ("Name")) , email (node->string_child ("Email")) { @@ -35,7 +35,7 @@ Cinema::Cinema (shared_ptr node) a constructor) */ void -Cinema::read_screens (shared_ptr node) +Cinema::read_screens (cxml::ConstNodePtr node) { list s = node->node_children ("Screen"); for (list::iterator i = s.begin(); i != s.end(); ++i) { @@ -67,17 +67,21 @@ Cinema::remove_screen (shared_ptr s) _screens.remove (s); } -Screen::Screen (shared_ptr node) +Screen::Screen (cxml::ConstNodePtr node) + : name (node->string_child ("Name")) { - name = node->string_child ("Name"); - certificate = shared_ptr (new dcp::Certificate (node->string_child ("Certificate"))); + 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); - parent->add_child("Certificate")->add_child_text (certificate->certificate (true)); + if (certificate) { + parent->add_child("Certificate")->add_child_text (certificate->certificate (true)); + } }