#include "exceptions.h"
#include "util.h"
#include "raw_convert.h"
+#include "dcp_assert.h"
#include <libxml++/libxml++.h>
#include <boost/foreach.hpp>
+#include <iostream>
using std::string;
using boost::shared_ptr;
+using boost::optional;
using namespace dcp;
static string const pkl_interop_ns = "http://www.digicine.com/PROTO-ASDCP-PKL-20040311#";
static string const pkl_smpte_ns = "http://www.smpte-ra.org/schemas/429-8/2007/PKL";
PKL::PKL (boost::filesystem::path file)
+ : _file (file)
{
cxml::Document pkl ("PackingList");
pkl.read_file (file);
asset->add_child("Type")->add_child_text (i->type);
}
+ indent (pkl, 0);
+
if (signer) {
signer->sign (pkl, _standard);
}
- doc.write_to_file (file.string(), "UTF-8");
+ doc.write_to_file_formatted (file.string(), "UTF-8");
+ _file = file;
+}
+
+optional<string>
+PKL::hash (string id) const
+{
+ BOOST_FOREACH (shared_ptr<Asset> i, _asset_list) {
+ if (i->id() == id) {
+ return i->hash;
+ }
+ }
+
+ return optional<string>();
+}
+
+optional<string>
+PKL::type (string id) const
+{
+ BOOST_FOREACH (shared_ptr<Asset> i, _asset_list) {
+ if (i->id() == id) {
+ return i->type;
+ }
+ }
+
+ return optional<string>();
}