X-Git-Url: https://git.carlh.net/gitweb/?a=blobdiff_plain;f=src%2Flib%2Fdkdm_wrapper.h;h=7182e5e85794d7c401c851b58e8fd36103d48430;hb=7cb1677e10b9692698ede5741c50d8c4b4144ddf;hp=09e9d25c428c3808869fc6b20429edcc9fa73876;hpb=a69d242f3f00207d6ea7320e6723775f4b0dbfb3;p=dcpomatic.git diff --git a/src/lib/dkdm_wrapper.h b/src/lib/dkdm_wrapper.h index 09e9d25c4..7182e5e85 100644 --- a/src/lib/dkdm_wrapper.h +++ b/src/lib/dkdm_wrapper.h @@ -1,5 +1,5 @@ /* - Copyright (C) 2017 Carl Hetherington + Copyright (C) 2017-2021 Carl Hetherington This file is part of DCP-o-matic. @@ -18,37 +18,44 @@ */ + #include #include -#include +#include + namespace xmlpp { class Element; } + class DKDMGroup; -class DKDMBase : public boost::enable_shared_from_this + +class DKDMBase : public std::enable_shared_from_this { public: virtual ~DKDMBase () {} virtual std::string name () const = 0; virtual void as_xml (xmlpp::Element *) const = 0; + /** @return true if this thing is, or contains, any actual DKDM */ + virtual bool contains_dkdm() const = 0; - static boost::shared_ptr read (cxml::ConstNodePtr node); + static std::shared_ptr read (cxml::ConstNodePtr node); - boost::shared_ptr parent () const { + std::shared_ptr parent () const { return _parent; } - void set_parent (boost::shared_ptr parent) { + void set_parent (std::shared_ptr parent) { _parent = parent; } private: - boost::shared_ptr _parent; + std::shared_ptr _parent; }; + class DKDM : public DKDMBase { public: @@ -56,8 +63,11 @@ public: : _dkdm (k) {} - std::string name () const; - void as_xml (xmlpp::Element *) const; + std::string name () const override; + void as_xml (xmlpp::Element *) const override; + bool contains_dkdm() const override { + return true; + } dcp::EncryptedKDM dkdm () const { return _dkdm; @@ -67,6 +77,7 @@ private: dcp::EncryptedKDM _dkdm; }; + class DKDMGroup : public DKDMBase { public: @@ -74,20 +85,24 @@ public: : _name (name) {} - std::string name () const { + std::string name () const override { return _name; } - void as_xml (xmlpp::Element *) const; + void as_xml (xmlpp::Element *) const override; - std::list > children () const { + bool contains_dkdm() const override; + + std::list> children () const { return _children; } - void add (boost::shared_ptr child, boost::shared_ptr previous = boost::shared_ptr ()); - void remove (boost::shared_ptr child); + void add (std::shared_ptr child, std::shared_ptr previous = std::shared_ptr()); + void remove (std::shared_ptr child); + + bool contains(std::string dkdm_id) const; private: std::string _name; - std::list > _children; + std::list> _children; };