From 5fbcd3a8dc711c6c42efabbac72ab0408f504ea2 Mon Sep 17 00:00:00 2001 From: Carl Hetherington Date: Fri, 22 Jan 2021 01:39:22 +0100 Subject: Assorted c++11 cleanups. --- src/subtitle_asset.cc | 19 +++++++++---------- 1 file changed, 9 insertions(+), 10 deletions(-) (limited to 'src/subtitle_asset.cc') diff --git a/src/subtitle_asset.cc b/src/subtitle_asset.cc index 9d46cb5c..52ef7ac2 100644 --- a/src/subtitle_asset.cc +++ b/src/subtitle_asset.cc @@ -48,7 +48,6 @@ #include #include #include -#include using std::dynamic_pointer_cast; using std::string; @@ -292,7 +291,7 @@ SubtitleAsset::maybe_add_subtitle (string text, vector const & parse } ParseState ps; - BOOST_FOREACH (ParseState const & i, parse_state) { + for (auto const& i: parse_state) { if (i.font_id) { ps.font_id = i.font_id.get(); } @@ -548,12 +547,12 @@ SubtitleAsset::pull_fonts (shared_ptr part) these features go into part's font. */ part->font = part->children.front()->font; - BOOST_FOREACH (shared_ptr i, part->children) { + for (auto i: part->children) { part->font.take_intersection (i->font); } /* Remove common values from part's children's fonts */ - BOOST_FOREACH (shared_ptr i, part->children) { + for (auto i: part->children) { i->font.take_difference (part->font); } } @@ -685,7 +684,7 @@ map SubtitleAsset::font_data () const { map out; - BOOST_FOREACH (Font const & i, _fonts) { + for (auto const& i: _fonts) { out[i.load_id] = i.data; } return out; @@ -696,7 +695,7 @@ map SubtitleAsset::font_filenames () const { map out; - BOOST_FOREACH (Font const& i, _fonts) { + for (auto const& i: _fonts) { if (i.file) { out[i.load_id] = *i.file; } @@ -714,7 +713,7 @@ SubtitleAsset::fix_empty_font_ids () { bool have_empty = false; vector ids; - BOOST_FOREACH (shared_ptr i, load_font_nodes()) { + for (auto i: load_font_nodes()) { if (i->id == "") { have_empty = true; } else { @@ -728,14 +727,14 @@ SubtitleAsset::fix_empty_font_ids () string const empty_id = unique_string (ids, "font"); - BOOST_FOREACH (shared_ptr i, load_font_nodes()) { + for (auto i: load_font_nodes()) { if (i->id == "") { i->id = empty_id; } } - BOOST_FOREACH (shared_ptr i, _subtitles) { - shared_ptr j = dynamic_pointer_cast (i); + for (auto i: _subtitles) { + auto j = dynamic_pointer_cast (i); if (j && j->font() && j->font().get() == "") { j->set_font (empty_id); } -- cgit v1.2.3