Remove use of boost foreach.
authorCarl Hetherington <cth@carlh.net>
Wed, 13 Jan 2021 12:07:32 +0000 (13:07 +0100)
committerCarl Hetherington <cth@carlh.net>
Wed, 13 Jan 2021 12:07:32 +0000 (13:07 +0100)
src/exceptions.cc
src/ssa_reader.cc
src/stl_binary_writer.cc
test/ssa_reader_test.cc

index bc131b82d1763e8349291df5bb5c1c2308dc7c8a..72198fcefffe0bbfe4689b38b84bfe39fc84c332 100644 (file)
@@ -19,7 +19,6 @@
 
 #include "compose.hpp"
 #include "exceptions.h"
-#include <boost/foreach.hpp>
 
 using std::list;
 using std::string;
index 072fff8eea271eaa0d7eb0713b1880b46d69a622..4a9be0e28b0d4300aaa01b191cdfbb141103bc93 100644 (file)
@@ -25,7 +25,6 @@
 #include "compose.hpp"
 #include <boost/algorithm/string.hpp>
 #include <boost/bind.hpp>
-#include <boost/foreach.hpp>
 #include <iostream>
 #include <vector>
 
@@ -439,7 +438,7 @@ SSAReader::read (function<optional<string> ()> get_line)
                case EVENTS:
                        if (type == "Format") {
                                split (event_format, body, is_any_of (","));
-                               BOOST_FOREACH (string& i, event_format) {
+                               for (auto& i: event_format) {
                                        trim (i);
                                }
                        } else if (type == "Dialogue") {
@@ -488,7 +487,7 @@ SSAReader::read (function<optional<string> ()> get_line)
                                        } else if (event_format[i] == "MarginV") {
                                                sub.vertical_position.proportional = raw_convert<float>(event[i]) / play_res_y;
                                        } else if (event_format[i] == "Text") {
-                                               BOOST_FOREACH (sub::RawSubtitle j, parse_line (sub, event[i], play_res_x, play_res_y)) {
+                                               for (auto j: parse_line (sub, event[i], play_res_x, play_res_y)) {
                                                        _subs.push_back (j);
                                                }
                                        }
index 4a16ce0d862cb3898c2bf8a28898bcee59e9a6fa..1b1d52f99226f4c75e81cb46f1e6cfcfc7682dd0 100644 (file)
@@ -29,7 +29,6 @@
 #include "sub_assert.h"
 #include <boost/locale.hpp>
 #include <boost/algorithm/string.hpp>
-#include <boost/foreach.hpp>
 #include <cmath>
 #include <fstream>
 #include <iomanip>
@@ -155,11 +154,11 @@ make_tti_blocks (vector<Subtitle> const& subtitles, STLBinaryTables const& table
        /* Buffer to build the TTI blocks in */
        char buffer[tti_size];
 
-       BOOST_FOREACH (Subtitle const& i, subtitles) {
+       for (auto const& i: subtitles) {
 
                /* Find the top vertical position of this subtitle */
                optional<int> top;
-               BOOST_FOREACH (Line const& j, i.lines) {
+               for (auto const& j: i.lines) {
                        int const vp = vertical_position (j);
                        if (!top || vp < top.get ()) {
                                top = vp;
@@ -172,7 +171,7 @@ make_tti_blocks (vector<Subtitle> const& subtitles, STLBinaryTables const& table
                bool underline = false;
                optional<int> last_vp;
 
-               BOOST_FOREACH (Line const& j, i.lines) {
+               for (auto const& j: i.lines) {
 
                        /* CR/LF down to this line */
                        int const vp = vertical_position (j);
@@ -185,7 +184,7 @@ make_tti_blocks (vector<Subtitle> const& subtitles, STLBinaryTables const& table
 
                        last_vp = vp;
 
-                       BOOST_FOREACH (Block const& k, j.blocks) {
+                       for (auto const& k: j.blocks) {
                                if (k.underline && !underline) {
                                        text += "\x82";
                                        underline = true;
@@ -328,10 +327,10 @@ sub::write_stl_binary (
 
        int longest = 0;
 
-       BOOST_FOREACH (Subtitle const& i, subtitles) {
-               BOOST_FOREACH (Line const& j, i.lines) {
+       for (auto const& i: subtitles) {
+               for (auto const& j: i.lines) {
                        int t = 0;
-                       BOOST_FOREACH (Block const& k, j.blocks) {
+                       for (auto const& k: j.blocks) {
                                t += k.text.size ();
                        }
                        longest = std::max (longest, t);
@@ -387,7 +386,7 @@ sub::write_stl_binary (
 
        ofstream output (file_name.string().c_str());
        output.write (buffer, 1024);
-       BOOST_FOREACH (char* i, tti_blocks) {
+       for (auto i: tti_blocks) {
                output.write (i, 128);
                delete[] i;
        }
index c29ff7c98dbda1565ec6421a3124bbb3e8a37872..d3a34bfa69ab9d43e6ef3c2bc25ebf2e891acd12 100644 (file)
@@ -24,7 +24,6 @@
 #include "exceptions.h"
 #include <boost/test/unit_test.hpp>
 #include <boost/filesystem.hpp>
-#include <boost/foreach.hpp>
 #include <cstdio>
 #include <cmath>
 #include <iostream>