summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCarl Hetherington <cth@carlh.net>2025-12-18 15:13:22 +0100
committerCarl Hetherington <cth@carlh.net>2025-12-18 15:13:22 +0100
commit6bfcb3374d8ad43f08c3923b484b92ad60691b79 (patch)
treec9f5f75ac84650d6982a74cfb1ba817c42293501
parentbad7a5abcfb51230359759fd44883c80104e566a (diff)
Add all_dkdms() method.
-rw-r--r--src/lib/dkdm_wrapper.cc23
-rw-r--r--src/lib/dkdm_wrapper.h6
2 files changed, 25 insertions, 4 deletions
diff --git a/src/lib/dkdm_wrapper.cc b/src/lib/dkdm_wrapper.cc
index f6646e4d2..c735c3b95 100644
--- a/src/lib/dkdm_wrapper.cc
+++ b/src/lib/dkdm_wrapper.cc
@@ -19,19 +19,20 @@
*/
-#include "dkdm_wrapper.h"
#include "dcpomatic_assert.h"
+#include "dkdm_wrapper.h"
#include <dcp/warnings.h>
LIBDCP_DISABLE_WARNINGS
#include <libxml++/libxml++.h>
LIBDCP_ENABLE_WARNINGS
-using std::string;
+using std::dynamic_pointer_cast;
using std::list;
-using std::shared_ptr;
using std::make_shared;
-using std::dynamic_pointer_cast;
+using std::shared_ptr;
+using std::string;
+using std::vector;
shared_ptr<DKDMBase>
@@ -146,3 +147,17 @@ DKDMGroup::contains_dkdm() const
return false;
}
+
+
+vector<dcp::EncryptedKDM>
+DKDMGroup::all_dkdms() const
+{
+ vector<dcp::EncryptedKDM> all;
+ for (auto child: _children) {
+ for (auto dkdm: child->all_dkdms()) {
+ all.push_back(dkdm);
+ }
+ }
+ return all;
+}
+
diff --git a/src/lib/dkdm_wrapper.h b/src/lib/dkdm_wrapper.h
index 7182e5e85..0bbd46407 100644
--- a/src/lib/dkdm_wrapper.h
+++ b/src/lib/dkdm_wrapper.h
@@ -40,6 +40,7 @@ public:
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;
+ virtual std::vector<dcp::EncryptedKDM> all_dkdms() const = 0;
static std::shared_ptr<DKDMBase> read (cxml::ConstNodePtr node);
@@ -68,6 +69,9 @@ public:
bool contains_dkdm() const override {
return true;
}
+ std::vector<dcp::EncryptedKDM> all_dkdms() const override {
+ return { _dkdm };
+ }
dcp::EncryptedKDM dkdm () const {
return _dkdm;
@@ -93,6 +97,8 @@ public:
bool contains_dkdm() const override;
+ std::vector<dcp::EncryptedKDM> all_dkdms() const override;
+
std::list<std::shared_ptr<DKDMBase>> children () const {
return _children;
}