DCP_ASSERT (file);
path new_path = make_unique(output / file->filename());
sub->write (new_path);
- sub->add_font_assets(assets);
+ add_to_container(assets, sub->font_assets());
}
assets.push_back (j);
/* More Interop special-casing */
auto sub = dynamic_pointer_cast<InteropSubtitleAsset>(o);
if (sub) {
- sub->add_font_assets (assets);
+ add_to_container(assets, sub->font_assets());
}
}
}
}
-void
-InteropSubtitleAsset::add_font_assets (vector<shared_ptr<Asset>>& assets)
+vector<shared_ptr<Asset>>
+InteropSubtitleAsset::font_assets()
{
+ vector<shared_ptr<Asset>> assets;
for (auto const& i: _fonts) {
DCP_ASSERT (i.file);
- assets.push_back (make_shared<FontAsset>(i.uuid, i.file.get()));
+ assets.push_back(make_shared<FontAsset>(i.uuid, i.file.get()));
}
+ return assets;
}
-void
-InteropSubtitleAsset::add_font_assets(vector<shared_ptr<const Asset>>& assets)
+vector<shared_ptr<const Asset>>
+InteropSubtitleAsset::font_assets() const
{
+ vector<shared_ptr<const Asset>> assets;
for (auto const& i: _fonts) {
DCP_ASSERT (i.file);
- assets.push_back (make_shared<FontAsset>(i.uuid, i.file.get()));
+ assets.push_back(make_shared<const FontAsset>(i.uuid, i.file.get()));
}
+ return assets;
}
void write (boost::filesystem::path path) const override;
void resolve_fonts (std::vector<std::shared_ptr<Asset>> assets);
- void add_font_assets (std::vector<std::shared_ptr<Asset>>& assets);
- void add_font_assets(std::vector<std::shared_ptr<const Asset>>& assets);
void set_font_file (std::string load_id, boost::filesystem::path file);
+ std::vector<std::shared_ptr<Asset>> font_assets();
+ std::vector<std::shared_ptr<const Asset>> font_assets() const;
/** @return the <LoadFont> IDs of fonts for which we have not (yet) found a font asset.
* This could be because resolve_fonts() has not yet been called, or because there is
};
+template <class From, class To>
+void
+add_to_container(To& container, From source)
+{
+ std::copy(source.begin(), source.end(), std::back_inserter(container));
+}
+
+
}