From d46f9684e7c4a77d07b4bb6f4b8c85dba2584597 Mon Sep 17 00:00:00 2001 From: Carl Hetherington Date: Mon, 1 Aug 2016 00:47:53 +0100 Subject: Simplify NameFormat stuff. --- src/dcp.cc | 6 +++--- src/dcp.h | 4 ++-- src/filename_format.cc | 52 -------------------------------------------------- src/filename_format.h | 50 ------------------------------------------------ src/name_format.cc | 6 ------ src/name_format.h | 19 +++++------------- src/wscript | 2 -- 7 files changed, 10 insertions(+), 129 deletions(-) delete mode 100644 src/filename_format.cc delete mode 100644 src/filename_format.h (limited to 'src') diff --git a/src/dcp.cc b/src/dcp.cc index ba72df8c..6af144dd 100644 --- a/src/dcp.cc +++ b/src/dcp.cc @@ -459,21 +459,21 @@ DCP::write_xml ( Standard standard, XMLMetadata metadata, shared_ptr signer, - FilenameFormat filename_format + NameFormat name_format ) { BOOST_FOREACH (shared_ptr 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); diff --git a/src/dcp.h b/src/dcp.h index cc87d0d1..fecf3cff 100644 --- 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 #include #include @@ -113,7 +113,7 @@ public: Standard standard, XMLMetadata metadata = XMLMetadata (), boost::shared_ptr signer = boost::shared_ptr (), - FilenameFormat filename_format = FilenameFormat("%t_%i") + NameFormat name_format = NameFormat("%t_%i") ); void resolve_refs (std::list > assets); diff --git a/src/filename_format.cc b/src/filename_format.cc deleted file mode 100644 index a3165612..00000000 --- a/src/filename_format.cc +++ /dev/null @@ -1,52 +0,0 @@ -/* - Copyright (C) 2016 Carl Hetherington - - 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 . - - 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 index 836c643a..00000000 --- a/src/filename_format.h +++ /dev/null @@ -1,50 +0,0 @@ -/* - Copyright (C) 2016 Carl Hetherington - - 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 . - - 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 diff --git a/src/name_format.cc b/src/name_format.cc index 300ff315..a85f232d 100644 --- a/src/name_format.cc +++ b/src/name_format.cc @@ -64,12 +64,6 @@ filter (string c) return o; } -void -NameFormat::add (char placeholder) -{ - _components.push_back (placeholder); -} - string NameFormat::get (Map values) const { diff --git a/src/name_format.h b/src/name_format.h index 7eb2713f..7390dd5c 100644 --- a/src/name_format.h +++ b/src/name_format.h @@ -43,9 +43,11 @@ namespace dcp { class NameFormat { public: - std::list 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 _components; std::string _specification; }; diff --git a/src/wscript b/src/wscript index 43fc0e69..9430aeca 100644 --- a/src/wscript +++ b/src/wscript @@ -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 -- cgit v1.2.3