Cleanup: forward declaration sorting.
[libdcp.git] / src / dcp.h
index dd357f4848c3fd89890f9f4f231657e474725661..d5ffa6891a1c790af7f6bc35ddc75bd3bc0e754f 100644 (file)
--- a/src/dcp.h
+++ b/src/dcp.h
 #define LIBDCP_DCP_H
 
 
-#include "compose.hpp"
-#include "types.h"
-#include "util.h"
+#include "asset_map.h"
 #include "certificate.h"
+#include "compose.hpp"
 #include "metadata.h"
 #include "name_format.h"
+#include "types.h"
+#include "util.h"
 #include "verify.h"
 #include "version.h"
 #include <boost/signals2.hpp>
@@ -66,14 +67,14 @@ namespace dcp
 {
 
 
-class PKL;
-class Content;
-class Reel;
+class Asset;
 class CPL;
 class CertificateChain;
+class Content;
 class DecryptedKDM;
-class Asset;
+class PKL;
 class ReadError;
+class Reel;
 
 
 /** @class DCP
@@ -94,6 +95,9 @@ public:
        DCP (DCP const&) = delete;
        DCP& operator= (DCP const&) = delete;
 
+       DCP (DCP &&);
+       DCP& operator= (DCP &&);
+
        /** Read a DCP.  This method does not do any deep checking of the DCP's validity, but
         *  if it comes across any bad things it will do one of two things.
         *
@@ -120,7 +124,7 @@ public:
         *  @param note Functor to handle notes made by the equality operation.
         *  @return true if the DCPs are equal according to EqualityOptions, otherwise false.
         */
-       bool equals (DCP const & other, EqualityOptions options, NoteHandler note) const;
+       bool equals(DCP const & other, EqualityOptions const& options, NoteHandler note) const;
 
        void add (std::shared_ptr<CPL> cpl);
 
@@ -141,21 +145,19 @@ public:
         */
        void add (DecryptedKDM const &);
 
-       /** Write all the XML files for this DCP
-        *  @param standand INTEROP or SMPTE
-        *  @param issuer Value for the PKL and AssetMap <Issuer> tags
-        *  @param creator Value for the PKL and AssetMap <Creator> tags
-        *  @param issue_date Value for the PKL and AssetMap <IssueDate> tags
-        *  @param annotation_text Value for the PKL and AssetMap <AnnotationText> tags
+       void set_issuer(std::string issuer);
+       void set_creator(std::string creator);
+       void set_issue_date(std::string issue_date);
+       void set_annotation_text(std::string annotation_text);
+
+       /** Write all the XML files for this DCP.
         *  @param signer Signer to use
+        *  @param include_mca_subdescriptors true to write MCA subdescriptors to CPLs.
         *  @param name_format Name format to use for the CPL and PKL filenames
         */
-       void write_xml (
-               std::string issuer = String::compose("libdcp %1", dcp::version),
-               std::string creator = String::compose("libdcp %1", dcp::version),
-               std::string issue_date = LocalTime().as_string(),
-               std::string annotation_text = String::compose("Created by libdcp %1", dcp::version),
+       void write_xml(
                std::shared_ptr<const CertificateChain> signer = std::shared_ptr<const CertificateChain>(),
+               bool include_mca_subdescriptors = true,
                NameFormat name_format = NameFormat("%t")
        );
 
@@ -163,7 +165,11 @@ public:
 
        /** @return Standard of a DCP that was read in */
        boost::optional<Standard> standard () const {
-               return _standard;
+               if (!_asset_map) {
+                       return {};
+               }
+
+               return _asset_map->standard();
        }
 
        boost::filesystem::path directory () const {
@@ -177,7 +183,15 @@ public:
                return _pkls;
        }
 
-       boost::optional<boost::filesystem::path> asset_map_path () {
+       boost::optional<boost::filesystem::path> asset_map_file() const {
+               if (!_asset_map) {
+                       return {};
+               }
+
+               return _asset_map->file();
+       }
+
+       boost::optional<AssetMap> asset_map() const {
                return _asset_map;
        }
 
@@ -187,26 +201,19 @@ private:
 
        void write_volindex (Standard standard) const;
 
-       /** Write the ASSETMAP file.
-        *  @param pkl_uuid UUID of our PKL.
-        *  @param pkl_path Pathname of our PKL file.
-        */
-       void write_assetmap (
-               Standard standard, std::string pkl_uuid, boost::filesystem::path pkl_path,
-               std::string issuer, std::string creator, std::string issue_date, std::string annotation_text
-               ) const;
-
        /** The directory that we are writing to */
        boost::filesystem::path _directory;
        /** The CPLs that make up this DCP */
        std::vector<std::shared_ptr<CPL>> _cpls;
        /** The PKLs that make up this DCP */
        std::vector<std::shared_ptr<PKL>> _pkls;
-       /** File that the ASSETMAP was read from or last written to */
-       mutable boost::optional<boost::filesystem::path> _asset_map;
+       boost::optional<AssetMap> _asset_map;
 
-       /** Standard of DCP that was read in */
-       boost::optional<Standard> _standard;
+       /* Metadata to use for newly created PKLs and AssetMaps */
+       boost::optional<std::string> _new_issuer;
+       boost::optional<std::string> _new_creator;
+       boost::optional<std::string> _new_issue_date;
+       boost::optional<std::string> _new_annotation_text;
 };