Replace most remaining uses of boost::split with agi::Split
This commit is contained in:
parent
01558bf10d
commit
5d8aeb8b40
5 changed files with 19 additions and 13 deletions
|
@ -18,10 +18,10 @@
|
|||
#include <libaegisub/ass/smpte.h>
|
||||
|
||||
#include <libaegisub/format.h>
|
||||
#include <libaegisub/split.h>
|
||||
#include <libaegisub/util.h>
|
||||
|
||||
#include <algorithm>
|
||||
#include <boost/algorithm/string/split.hpp>
|
||||
|
||||
namespace agi {
|
||||
Time::Time(int time) : time(util::mid(0, time, 10 * 60 * 60 * 1000 - 1)) { }
|
||||
|
@ -94,7 +94,7 @@ std::string SmpteFormatter::ToSMPTE(Time time) const {
|
|||
|
||||
Time SmpteFormatter::FromSMPTE(std::string const& str) const {
|
||||
std::vector<std::string> toks;
|
||||
boost::split(toks, str, [=](char c) { return c == sep; });
|
||||
Split(toks, str, sep);
|
||||
if (toks.size() != 4) return 0;
|
||||
|
||||
int h, m, s, f;
|
||||
|
|
|
@ -22,8 +22,8 @@
|
|||
#include "libaegisub/file_mapping.h"
|
||||
#include "libaegisub/line_iterator.h"
|
||||
#include "libaegisub/make_unique.h"
|
||||
#include "libaegisub/split.h"
|
||||
|
||||
#include <boost/algorithm/string/split.hpp>
|
||||
#include <boost/interprocess/streams/bufferstream.hpp>
|
||||
|
||||
namespace agi {
|
||||
|
@ -76,15 +76,14 @@ std::vector<Thesaurus::Entry> Thesaurus::Lookup(std::string const& word) {
|
|||
|
||||
// First line is the word and meaning count
|
||||
std::vector<std::string> header;
|
||||
boost::split(header, *read_line(temp), [](char c) { return c == '|'; });
|
||||
agi::Split(header, *read_line(temp), '|');
|
||||
if (header.size() != 2) return out;
|
||||
int meanings = atoi(header[1].c_str());
|
||||
|
||||
out.reserve(meanings);
|
||||
std::vector<std::string> line;
|
||||
for (int i = 0; i < meanings; ++i) {
|
||||
std::vector<std::string> line;
|
||||
boost::split(line, *read_line(temp), [](char c) { return c == '|'; });
|
||||
|
||||
agi::Split(line, *read_line(temp), '|');
|
||||
if (line.size() < 2)
|
||||
continue;
|
||||
|
||||
|
|
|
@ -91,12 +91,19 @@ namespace agi {
|
|||
return split_iterator<Iterator>();
|
||||
}
|
||||
|
||||
static inline std::string str(StringRange const& r) {
|
||||
return std::string(r.begin(), r.end());
|
||||
}
|
||||
|
||||
template<typename Str, typename Char>
|
||||
split_iterator<typename Str::const_iterator> Split(Str const& str, Char delim) {
|
||||
return split_iterator<typename Str::const_iterator>(begin(str), end(str), delim);
|
||||
}
|
||||
|
||||
static inline std::string str(StringRange const& r) {
|
||||
return std::string(r.begin(), r.end());
|
||||
template<typename Cont, typename Str, typename Char>
|
||||
void Split(Cont& out, Str const& str, Char delim) {
|
||||
out.clear();
|
||||
for (auto const& tok : Split(str, delim))
|
||||
out.emplace_back(begin(tok), end(tok));
|
||||
}
|
||||
}
|
||||
|
|
|
@ -43,9 +43,9 @@
|
|||
#include <libaegisub/exception.h>
|
||||
#include <libaegisub/line_iterator.h>
|
||||
#include <libaegisub/scoped_ptr.h>
|
||||
#include <libaegisub/split.h>
|
||||
|
||||
#include <ctime>
|
||||
#include <boost/algorithm/string/split.hpp>
|
||||
#include <boost/asio/ip/tcp.hpp>
|
||||
#include <functional>
|
||||
#include <mutex>
|
||||
|
@ -321,7 +321,7 @@ void DoCheck(bool interactive) {
|
|||
if (line.empty()) continue;
|
||||
|
||||
std::vector<std::string> parsed;
|
||||
boost::split(parsed, line, [](char c) { return c == '|'; });
|
||||
agi::Split(parsed, line, '|');
|
||||
if (parsed.size() != 6) continue;
|
||||
|
||||
if (atoi(parsed[1].c_str()) <= GetSVNRevision())
|
||||
|
|
|
@ -39,10 +39,10 @@
|
|||
|
||||
#include <libaegisub/color.h>
|
||||
#include <libaegisub/make_unique.h>
|
||||
#include <libaegisub/split.h>
|
||||
#include <libaegisub/util.h>
|
||||
|
||||
#include <boost/algorithm/string/predicate.hpp>
|
||||
#include <boost/algorithm/string/split.hpp>
|
||||
#include <boost/filesystem/path.hpp>
|
||||
#include <libaegisub/format.h>
|
||||
#include <boost/gil/gil_all.hpp>
|
||||
|
@ -106,7 +106,7 @@ std::unique_ptr<VideoProvider> CreateDummyVideoProvider(agi::fs::path const& fil
|
|||
|
||||
std::vector<std::string> toks;
|
||||
auto const& fields = filename.string().substr(7);
|
||||
boost::split(toks, fields, [](char c) { return c == ':'; });
|
||||
agi::Split(toks, fields, ':');
|
||||
if (toks.size() != 8)
|
||||
throw VideoOpenError("Too few fields in dummy video parameter list");
|
||||
|
||||
|
|
Loading…
Reference in a new issue