2 Copyright (C) 2020 Carl Hetherington <cth@carlh.net>
4 This file is part of DCP-o-matic.
6 DCP-o-matic is free software; you can redistribute it and/or modify
7 it under the terms of the GNU General Public License as published by
8 the Free Software Foundation; either version 2 of the License, or
9 (at your option) any later version.
11 DCP-o-matic is distributed in the hope that it will be useful,
12 but WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 GNU General Public License for more details.
16 You should have received a copy of the GNU General Public License
17 along with DCP-o-matic. If not, see <http://www.gnu.org/licenses/>.
21 #include "dkdm_recipient.h"
22 #include "dcpomatic_assert.h"
23 #include <dcp/raw_convert.h>
24 #include <libxml++/libxml++.h>
25 #include <boost/foreach.hpp>
28 using dcp::raw_convert;
30 DKDMRecipient::DKDMRecipient (cxml::ConstNodePtr node)
33 BOOST_FOREACH (cxml::ConstNodePtr i, node->node_children("Email")) {
34 emails.push_back (i->content());
37 _utc_offset_hour = node->number_child<int>("UTCOffsetHour");
38 _utc_offset_minute = node->number_child<int>("UTCOffsetMinute");
43 DKDMRecipient::as_xml (xmlpp::Element* parent) const
45 KDMRecipient::as_xml (parent);
47 BOOST_FOREACH (string i, emails) {
48 parent->add_child("Email")->add_child_text (i);
51 parent->add_child("UTCOffsetHour")->add_child_text(raw_convert<string>(_utc_offset_hour));
52 parent->add_child("UTCOffsetMinute")->add_child_text(raw_convert<string>(_utc_offset_minute));
57 DKDMRecipient::set_utc_offset_hour (int h)
59 DCPOMATIC_ASSERT (h >= -11 && h <= 12);
65 DKDMRecipient::set_utc_offset_minute (int m)
67 DCPOMATIC_ASSERT (m >= 0 && m <= 59);
68 _utc_offset_minute = m;