Missing files.
[dcpomatic.git] / src / lib / dkdm_wrapper.h
1 /*
2     Copyright (C) 2017 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 #include <dcp/encrypted_kdm.h>
22 #include <libcxml/cxml.h>
23
24 namespace xmlpp {
25         class Element;
26 }
27
28 class DKDMBase
29 {
30 public:
31         virtual std::string name () const = 0;
32         virtual void as_xml (xmlpp::Element *) const = 0;
33
34         static boost::shared_ptr<DKDMBase> read (cxml::ConstNodePtr node);
35 };
36
37 class DKDM : public DKDMBase
38 {
39 public:
40         DKDM (dcp::EncryptedKDM k)
41                 : _dkdm (k)
42         {}
43
44         std::string name () const;
45         void as_xml (xmlpp::Element *) const;
46
47         dcp::EncryptedKDM dkdm () const {
48                 return _dkdm;
49         }
50
51 private:
52         dcp::EncryptedKDM _dkdm;
53 };
54
55 class DKDMGroup : public DKDMBase
56 {
57 public:
58         DKDMGroup (std::string name)
59                 : _name (name)
60         {}
61
62         std::string name () const {
63                 return _name;
64         }
65
66         void as_xml (xmlpp::Element *) const;
67
68         std::list<boost::shared_ptr<DKDMBase> > children () const {
69                 return _children;
70         }
71
72         void add (boost::shared_ptr<DKDMBase> child);
73         void remove (boost::shared_ptr<DKDMBase> child);
74
75 private:
76         std::string _name;
77         std::list<boost::shared_ptr<DKDMBase> > _children;
78 };