Simplify NameFormat stuff.
authorCarl Hetherington <cth@carlh.net>
Sun, 31 Jul 2016 23:47:53 +0000 (00:47 +0100)
committerCarl Hetherington <cth@carlh.net>
Sun, 31 Jul 2016 23:47:53 +0000 (00:47 +0100)
src/dcp.cc
src/dcp.h
src/filename_format.cc [deleted file]
src/filename_format.h [deleted file]
src/name_format.cc
src/name_format.h
src/wscript

index ba72df8c5007eecad216682fa5e1540e449d016e..6af144dd08c7d0583a333ff9f25453f8bb62fa9f 100644 (file)
@@ -459,21 +459,21 @@ DCP::write_xml (
        Standard standard,
        XMLMetadata metadata,
        shared_ptr<const CertificateChain> signer,
-       FilenameFormat filename_format
+       NameFormat name_format
        )
 {
        BOOST_FOREACH (shared_ptr<CPL> i, cpls ()) {
                NameFormat::Map values;
                values['t'] = "cpl";
                values['i'] = i->id();
-               i->write_xml (_directory / (filename_format.get(values) + ".xml"), standard, signer);
+               i->write_xml (_directory / (name_format.get(values) + ".xml"), standard, signer);
        }
 
        string const pkl_uuid = make_uuid ();
        NameFormat::Map values;
        values['t'] = "pkl";
        values['i'] = pkl_uuid;
-       boost::filesystem::path const pkl_path = write_pkl (filename_format.get(values) + ".xml", standard, pkl_uuid, metadata, signer);
+       boost::filesystem::path const pkl_path = write_pkl (name_format.get(values) + ".xml", standard, pkl_uuid, metadata, signer);
 
        write_volindex (standard);
        write_assetmap (standard, pkl_uuid, boost::filesystem::file_size (pkl_path), metadata);
index cc87d0d14a31bc7a8d7996630e60d134bfa8720f..fecf3cffebe3b1261881bf2b1961792059bec4aa 100644 (file)
--- a/src/dcp.h
+++ b/src/dcp.h
@@ -41,7 +41,7 @@
 #include "types.h"
 #include "certificate.h"
 #include "metadata.h"
-#include "filename_format.h"
+#include "name_format.h"
 #include <boost/shared_ptr.hpp>
 #include <boost/signals2.hpp>
 #include <string>
@@ -113,7 +113,7 @@ public:
                Standard standard,
                XMLMetadata metadata = XMLMetadata (),
                boost::shared_ptr<const CertificateChain> signer = boost::shared_ptr<const CertificateChain> (),
-               FilenameFormat filename_format = FilenameFormat("%t_%i")
+               NameFormat name_format = NameFormat("%t_%i")
        );
 
        void resolve_refs (std::list<boost::shared_ptr<Asset> > assets);
diff --git a/src/filename_format.cc b/src/filename_format.cc
deleted file mode 100644 (file)
index a316561..0000000
+++ /dev/null
@@ -1,52 +0,0 @@
-/*
-    Copyright (C) 2016 Carl Hetherington <cth@carlh.net>
-
-    This file is part of libdcp.
-
-    libdcp is free software; you can redistribute it and/or modify
-    it under the terms of the GNU General Public License as published by
-    the Free Software Foundation; either version 2 of the License, or
-    (at your option) any later version.
-
-    libdcp is distributed in the hope that it will be useful,
-    but WITHOUT ANY WARRANTY; without even the implied warranty of
-    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-    GNU General Public License for more details.
-
-    You should have received a copy of the GNU General Public License
-    along with libdcp.  If not, see <http://www.gnu.org/licenses/>.
-
-    In addition, as a special exception, the copyright holders give
-    permission to link the code of portions of this program with the
-    OpenSSL library under certain conditions as described in each
-    individual source file, and distribute linked combinations
-    including the two.
-
-    You must obey the GNU General Public License in all respects
-    for all of the code used other than OpenSSL.  If you modify
-    file(s) with this exception, you may extend this exception to your
-    version of the file(s), but you are not obligated to do so.  If you
-    do not wish to do so, delete this exception statement from your
-    version.  If you delete this exception statement from all source
-    files in the program, then also delete it here.
-*/
-
-#include "filename_format.h"
-
-using std::string;
-using namespace dcp;
-
-FilenameFormat::FilenameFormat (string specification)
-       : NameFormat (specification)
-{
-       /* asset type */
-       add ('t');
-       /* unique ID */
-       add ('i');
-       /* reel index */
-       add ('r');
-       /* reel count */
-       add ('n');
-       /* content name */
-       add ('c');
-}
diff --git a/src/filename_format.h b/src/filename_format.h
deleted file mode 100644 (file)
index 836c643..0000000
+++ /dev/null
@@ -1,50 +0,0 @@
-/*
-    Copyright (C) 2016 Carl Hetherington <cth@carlh.net>
-
-    This file is part of libdcp.
-
-    libdcp is free software; you can redistribute it and/or modify
-    it under the terms of the GNU General Public License as published by
-    the Free Software Foundation; either version 2 of the License, or
-    (at your option) any later version.
-
-    libdcp is distributed in the hope that it will be useful,
-    but WITHOUT ANY WARRANTY; without even the implied warranty of
-    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-    GNU General Public License for more details.
-
-    You should have received a copy of the GNU General Public License
-    along with libdcp.  If not, see <http://www.gnu.org/licenses/>.
-
-    In addition, as a special exception, the copyright holders give
-    permission to link the code of portions of this program with the
-    OpenSSL library under certain conditions as described in each
-    individual source file, and distribute linked combinations
-    including the two.
-
-    You must obey the GNU General Public License in all respects
-    for all of the code used other than OpenSSL.  If you modify
-    file(s) with this exception, you may extend this exception to your
-    version of the file(s), but you are not obligated to do so.  If you
-    do not wish to do so, delete this exception statement from your
-    version.  If you delete this exception statement from all source
-    files in the program, then also delete it here.
-*/
-
-#ifndef LIBDCP_FILENAME_FORMAT
-#define LIBDCP_FILENAME_FORMAT
-
-#include "name_format.h"
-
-namespace dcp {
-
-class FilenameFormat : public NameFormat
-{
-public:
-       FilenameFormat () {}
-       FilenameFormat (std::string specification);
-};
-
-}
-
-#endif
index 300ff3158b9a395bf996f59e90b7100beb3cf71c..a85f232d17ccc9c2f6fc9975a730de9a6226573b 100644 (file)
@@ -64,12 +64,6 @@ filter (string c)
        return o;
 }
 
-void
-NameFormat::add (char placeholder)
-{
-       _components.push_back (placeholder);
-}
-
 string
 NameFormat::get (Map values) const
 {
index 7eb2713ffb3fe2e26b194d635387f6026d0b1197..7390dd5c04fe1f9d42c2fe441fafa05c90335637 100644 (file)
@@ -43,9 +43,11 @@ namespace dcp {
 class NameFormat
 {
 public:
-       std::list<char> components () const {
-               return _components;
-       }
+       NameFormat () {}
+
+       NameFormat (std::string specification)
+               : _specification (specification)
+       {}
 
        std::string specification () const {
                return _specification;
@@ -59,18 +61,7 @@ public:
 
        std::string get (Map) const;
 
-protected:
-       NameFormat () {}
-
-       NameFormat (std::string specification)
-               : _specification (specification)
-       {}
-
-       void add (char placeholder);
-
 private:
-       /** placeholders for each component */
-       std::list<char> _components;
        std::string _specification;
 };
 
index 43fc0e69b56040ce04d4197d04959be3b1c38ee9..9430aeca8457cefbdf64224e62a1139dd1628a4e 100644 (file)
@@ -51,7 +51,6 @@ def build(bld):
              encrypted_kdm.cc
              exceptions.cc
              file.cc
-             filename_format.cc
              font_asset.cc
              font_node.cc
              gamma_transfer_function.cc
@@ -121,7 +120,6 @@ def build(bld):
               decrypted_kdm_key.h
               encrypted_kdm.h
               exceptions.h
-              filename_format.h
               font_asset.h
               gamma_transfer_function.h
               interop_load_font_node.h