77ef4e2e5a5950b01e99ac2960a6a80a40e43d0d
[dcpomatic.git] / src / lib / dkdm_recipient.h
1 /*
2     Copyright (C) 2020 Carl Hetherington <cth@carlh.net>
3
4     This file is part of DCP-o-matic.
5
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.
10
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.
15
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/>.
18
19 */
20
21 #ifndef DCPOMATIC_DKDM_RECIPIENT_H
22 #define DCPOMATIC_DKDM_RECIPIENT_H
23
24 #include "kdm_recipient.h"
25 #include <dcp/certificate.h>
26 #include <libcxml/cxml.h>
27
28 class DKDMRecipient : public KDMRecipient
29 {
30 public:
31         DKDMRecipient (
32                 std::string const& name_,
33                 std::string const& notes_,
34                 boost::optional<dcp::Certificate> recipient_,
35                 std::list<std::string> const& emails_,
36                 int utc_offset_hour_,
37                 int utc_offset_minute_)
38                 : KDMRecipient (name_, notes_, recipient_)
39                 , emails (emails_)
40                 , _utc_offset_hour (utc_offset_hour_)
41                 , _utc_offset_minute (utc_offset_minute_)
42         {}
43
44         explicit DKDMRecipient (cxml::ConstNodePtr node);
45
46         void as_xml (xmlpp::Element *) const;
47
48         void set_utc_offset_hour (int h);
49         void set_utc_offset_minute (int m);
50
51         int utc_offset_hour () const {
52                 return _utc_offset_hour;
53         }
54
55         int utc_offset_minute () const {
56                 return _utc_offset_minute;
57         }
58
59         std::list<std::string> emails;
60
61 private:
62         /** Offset such that the equivalent time in UTC can be determined
63             by subtracting the offset from the local time.
64         */
65         int _utc_offset_hour;
66         /** Additional minutes to add to _utc_offset_hour if _utc_offset_hour is
67             positive, or to subtract if _utc_offset_hour is negative.
68         */
69         int _utc_offset_minute;
70 };
71
72 #endif