Tidying.
[libdcp.git] / src / name_format.h
index 7eb2713ffb3fe2e26b194d635387f6026d0b1197..6401fe8206ea3dd75d17465aa8859e88a91e3a39 100644 (file)
@@ -1,5 +1,5 @@
 /*
-    Copyright (C) 2016 Carl Hetherington <cth@carlh.net>
+    Copyright (C) 2016-2021 Carl Hetherington <cth@carlh.net>
 
     This file is part of libdcp.
 
     files in the program, then also delete it here.
 */
 
+
+/** @file  src/name_format.h
+ *  @brief NameFormat class
+ */
+
+
 #ifndef LIBDCP_NAME_FORMAT
 #define LIBDCP_NAME_FORMAT
 
+
+#include <string>
 #include <boost/optional.hpp>
 #include <map>
 #include <list>
 
+
 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;
@@ -57,25 +69,24 @@ public:
 
        typedef std::map<char, std::string> Map;
 
-       std::string get (Map) const;
-
-protected:
-       NameFormat () {}
-
-       NameFormat (std::string specification)
-               : _specification (specification)
-       {}
-
-       void add (char placeholder);
+       /** @param values Values to replace our specifications with; e.g.
+        *  if the specification contains %c it will be be replaced with the
+        *  value corresponding to the key 'c'.
+        *  @param suffix Suffix to add on after processing the specification.
+        *  @param ignore Any specification characters in this string will not
+        *  be replaced, but left as-is.
+        */
+       std::string get (Map, std::string suffix, std::string ignore = "") const;
 
 private:
-       /** placeholders for each component */
-       std::list<char> _components;
        std::string _specification;
 };
 
+
 extern bool operator== (NameFormat const & a, NameFormat const & b);
 
+
 }
 
+
 #endif