Bump libcxml.
[libdcp.git] / src / name_format.cc
index 1dc1135df44a584c6d9f8d889f3ac3aa8ab57c18..7b9cfd634760b1b57d6dd399729da6cdb2b9d150 100644 (file)
@@ -64,34 +64,16 @@ filter (string c)
        return o;
 }
 
-void
-NameFormat::add (string name, char placeholder, string title)
-{
-       _components.push_back (Component (name, placeholder, title));
-}
-
-optional<NameFormat::Component>
-NameFormat::component_by_placeholder (char p) const
-{
-       BOOST_FOREACH (Component const & i, _components) {
-               if (i.placeholder == p) {
-                       return i;
-               }
-       }
-
-       return optional<Component> ();
-}
-
 string
-NameFormat::get (Map values) const
+NameFormat::get (Map values, string suffix) const
 {
        string result;
        for (size_t i = 0; i < _specification.length(); ++i) {
                bool done = false;
                if (_specification[i] == '%' && (i < _specification.length() - 1)) {
-                       optional<Component> c = component_by_placeholder (_specification[i + 1]);
-                       if (c) {
-                               result += filter (values[c->name]);
+                       Map::const_iterator j = values.find(_specification[i + 1]);
+                       if (j != values.end()) {
+                               result += filter (j->second);
                                ++i;
                                done = true;
                        }
@@ -102,7 +84,7 @@ NameFormat::get (Map values) const
                }
        }
 
-       return result;
+       return result + suffix;
 }
 
 bool