Some compilers don't like x = {} where x is a boost::optional<string>
[libdcp.git] / src / combine.cc
index cd91d5b19e73916b38a9e588a0b464103dbc98f2..dd8a145c7c6e8f3ce8b0e4e2e985d8fbb8d5fec5 100644 (file)
 */
 
 
+/** @file  src/combine.cc
+ *  @brief Method to combine DCPs
+ */
+
+
 #include "asset.h"
 #include "combine.h"
 #include "cpl.h"
@@ -42,7 +47,6 @@
 #include "interop_subtitle_asset.h"
 #include "raw_convert.h"
 #include <boost/filesystem.hpp>
-#include <boost/foreach.hpp>
 #include <set>
 #include <string>
 #include <vector>
@@ -110,7 +114,7 @@ dcp::combine (
        DCP output_dcp (output);
        optional<dcp::Standard> standard;
 
-       BOOST_FOREACH (path i, inputs) {
+       for (auto i: inputs) {
                DCP dcp (i);
                dcp.read ();
                if (!standard) {
@@ -123,40 +127,40 @@ dcp::combine (
        vector<path> paths;
        vector<shared_ptr<dcp::Asset>> assets;
 
-       BOOST_FOREACH (path i, inputs) {
+       for (auto i: inputs) {
                DCP dcp (i);
                dcp.read ();
 
-               BOOST_FOREACH (shared_ptr<dcp::CPL> j, dcp.cpls()) {
+               for (auto j: dcp.cpls()) {
                        output_dcp.add (j);
                }
 
-               BOOST_FOREACH (shared_ptr<dcp::Asset> j, dcp.assets(true)) {
+               for (auto j: dcp.assets(true)) {
                        if (dynamic_pointer_cast<dcp::CPL>(j)) {
                                continue;
                        }
 
-                       optional<path> file = j->file();
+                       auto file = j->file();
                        DCP_ASSERT (file);
                        path new_path = make_unique(output / file->filename());
 
-                       shared_ptr<dcp::InteropSubtitleAsset> sub = dynamic_pointer_cast<dcp::InteropSubtitleAsset>(j);
+                       auto sub = dynamic_pointer_cast<dcp::InteropSubtitleAsset>(j);
                        if (sub) {
                                /* Interop fonts are really fiddly.  The font files are assets (in the ASSETMAP)
                                 * and also linked from the font XML by filename.  We have to fix both these things,
                                 * and re-write the font XML file since the font URI might have changed if it's a duplicate
                                 * with another DCP.
                                 */
-                               map<string, path> fonts = sub->font_filenames ();
-                               for (map<string, path>::const_iterator k = fonts.begin(); k != fonts.end(); ++k) {
-                                       sub->set_font_file (k->first, make_unique(output / k->second.filename()));
+                               auto fonts = sub->font_filenames ();
+                               for (auto const& k: fonts) {
+                                       sub->set_font_file (k.first, make_unique(output / k.second.filename()));
                                }
                                sub->write (new_path);
                        } else if (!dynamic_pointer_cast<dcp::FontAsset>(j)) {
                                /* Take care of everything else that's not a Interop subtitle asset, Interop font file
                                 * or CPL.
                                 */
-                               optional<path> file = j->file();
+                               auto file = j->file();
                                DCP_ASSERT (file);
                                path new_path = make_unique(output / file->filename());
                                create_hard_link_or_copy (*file, new_path);