diff --git a/libaegisub/lua/script_reader.cpp b/libaegisub/lua/script_reader.cpp index 6270948ab..7730697fa 100644 --- a/libaegisub/lua/script_reader.cpp +++ b/libaegisub/lua/script_reader.cpp @@ -19,9 +19,9 @@ #include "libaegisub/file_mapping.h" #include "libaegisub/log.h" #include "libaegisub/lua/utils.h" +#include "libaegisub/split.h" #include -#include #include namespace agi { namespace lua { @@ -83,9 +83,9 @@ namespace agi { namespace lua { std::string package_paths(check_string(L, -1)); lua_pop(L, 2); - boost::char_separator sep(";"); - for (auto filename : boost::tokenizer>(package_paths, sep)) { - boost::replace_all(filename, "?", module); + for (auto tok : agi::Split(package_paths, ';')) { + std::string filename; + boost::replace_all_copy(std::back_inserter(filename), tok, "?", module); // If there's a .moon file at that path, load it instead of the // .lua file diff --git a/src/auto4_base.cpp b/src/auto4_base.cpp index b5fa2e53d..649f04692 100644 --- a/src/auto4_base.cpp +++ b/src/auto4_base.cpp @@ -43,10 +43,10 @@ #include #include #include +#include #include #include -#include #include #include @@ -262,9 +262,8 @@ namespace Automation4 { include_path.emplace_back(filename.parent_path()); std::string include_paths = OPT_GET("Path/Automation/Include")->GetString(); - boost::char_separator sep("|"); - for (auto const& tok : boost::tokenizer>(include_paths, sep)) { - auto path = config::path->Decode(tok); + for (auto tok : agi::Split(include_paths, '|')) { + auto path = config::path->Decode(agi::str(tok)); if (path.is_absolute() && agi::fs::DirectoryExists(path)) include_path.emplace_back(std::move(path)); } @@ -323,9 +322,8 @@ namespace Automation4 { std::vector>> script_futures; - boost::char_separator sep("|"); - for (auto const& tok : boost::tokenizer>(path, sep)) { - auto dirname = config::path->Decode(tok); + for (auto tok : agi::Split(path, '|')) { + auto dirname = config::path->Decode(agi::str(tok)); if (!agi::fs::DirectoryExists(dirname)) continue; for (auto filename : agi::fs::DirectoryIterator(dirname, "*.*")) @@ -372,11 +370,11 @@ namespace Automation4 { auto autobasefn(OPT_GET("Path/Automation/Base")->GetString()); - boost::char_separator sep("|"); - for (auto const& cur : boost::tokenizer>(local_scripts, sep)) { - auto trimmed = boost::trim_copy(cur); - char first_char = trimmed[0]; - trimmed.erase(0, 1); + for (auto tok : agi::Split(local_scripts, '|')) { + tok = boost::trim_copy(tok); + if (boost::size(tok) == 0) continue; + char first_char = tok[0]; + std::string trimmed(begin(tok) + 1, end(tok)); agi::fs::path basepath; if (first_char == '~') { diff --git a/src/auto4_lua_dialog.cpp b/src/auto4_lua_dialog.cpp index a8c7fe418..7985c49b9 100644 --- a/src/auto4_lua_dialog.cpp +++ b/src/auto4_lua_dialog.cpp @@ -42,11 +42,11 @@ #include #include #include +#include #include #include #include -#include #include #include @@ -533,13 +533,12 @@ namespace Automation4 { } void LuaDialog::Unserialise(const std::string &serialised) { - boost::char_separator psep("|"), csep(":"); - for (auto const& cur : boost::tokenizer>(serialised, psep)) { - size_t pos = cur.find(':'); - if (pos == std::string::npos) continue; + for (auto tok : agi::Split(serialised, '|')) { + auto pos = std::find(begin(tok), end(tok), ':'); + if (pos == end(tok)) continue; - std::string name = inline_string_decode(cur.substr(0, pos)); - std::string value = cur.substr(pos + 1); + std::string name = inline_string_decode(std::string(begin(tok), pos)); + std::string value(pos + 1, end(tok)); // Hand value to all controls matching name for (auto& control : controls) { diff --git a/src/dialog_export.cpp b/src/dialog_export.cpp index b0d543b10..d2584c528 100644 --- a/src/dialog_export.cpp +++ b/src/dialog_export.cpp @@ -37,10 +37,10 @@ #include "utils.h" #include +#include #include #include -#include #include #include #include @@ -113,8 +113,7 @@ DialogExport::DialogExport(agi::Context *c) // Get selected filters std::string const& selected = c->ass->Properties.export_filters; - boost::char_separator sep("|"); - for (auto const& token : boost::tokenizer>(selected, sep)) { + for (auto token : agi::Split(selected, '|')) { auto it = find(begin(filters), end(filters), token); if (it != end(filters)) filter_list->Check(distance(begin(filters), it)); diff --git a/src/spline.cpp b/src/spline.cpp index a44b1ce4d..395bac084 100644 --- a/src/spline.cpp +++ b/src/spline.cpp @@ -36,9 +36,9 @@ #include "visual_tool.h" +#include #include -#include #include Spline::Spline(const VisualToolBase &tl) @@ -109,10 +109,9 @@ void Spline::DecodeFromAss(std::string const& str) { Vector2D pt{0, 0}; // Tokenize the string - boost::char_separator sep(" "); - for (auto const& token : boost::tokenizer>(str, sep)) { + for (auto token : agi::Split(str, ' ')) { double n; - if (agi::util::try_parse(token, &n)) { + if (agi::util::try_parse(agi::str(token), &n)) { stack.push_back(n); // Move