diff --git a/src/Alias.cpp b/src/Alias.cpp index f8d1fdb46..10a27e9a3 100644 --- a/src/Alias.cpp +++ b/src/Alias.cpp @@ -29,6 +29,7 @@ #include #include #include +#include #include #include @@ -91,7 +92,7 @@ void Alias::resolve (Tree* tree) something = true; std::vector words; - splitq (words, context.aliases[raw], ' '); + Lexer::split (words, context.aliases[raw]); std::vector ::iterator word; for (word = words.begin (); word != words.end (); ++word) diff --git a/src/commands/CmdCustom.cpp b/src/commands/CmdCustom.cpp index 755c0fccd..4569bea6c 100644 --- a/src/commands/CmdCustom.cpp +++ b/src/commands/CmdCustom.cpp @@ -30,6 +30,7 @@ #include #include #include +#include #include #include #include @@ -83,7 +84,7 @@ int CmdCustom::execute (std::string& output) // Prepend the argument list with those from the report filter. std::vector filterArgs; - splitq (filterArgs, reportFilter, ' '); + Lexer::split (filterArgs, reportFilter); std::vector ::reverse_iterator arg; for (arg = filterArgs.rbegin (); arg != filterArgs.rend (); ++ arg) { diff --git a/src/text.cpp b/src/text.cpp index b79438169..36b0a7360 100644 --- a/src/text.cpp +++ b/src/text.cpp @@ -63,21 +63,6 @@ void wrapText ( //////////////////////////////////////////////////////////////////////////////// // UTF-8 -// -// Splits on unicode whitespace, removeѕ quotes. -void splitq (std::vector & results, const std::string& input) -{ - results.clear (); - - std::string token; - Lexer::Type type; - Lexer lex (input); - while (lex.token (token, type)) - results.push_back (token); -} - -//////////////////////////////////////////////////////////////////////////////// -// TODO Obsolete this call. void splitq ( std::vector& results, const std::string& input, diff --git a/src/text.h b/src/text.h index c55dccad7..8414eb1cd 100644 --- a/src/text.h +++ b/src/text.h @@ -39,7 +39,6 @@ std::string unquoteText (const std::string&); int longestWord (const std::string&); int longestLine (const std::string&); bool extractLine (std::string&, const std::string&, int, bool, unsigned int&); -void splitq (std::vector&, const std::string&); void splitq (std::vector&, const std::string&, const char); void split (std::vector&, const std::string&, const char); void split (std::vector&, const std::string&, const std::string&); diff --git a/test/text.t.cpp b/test/text.t.cpp index 8b733cd97..2d9d655ed 100644 --- a/test/text.t.cpp +++ b/test/text.t.cpp @@ -37,7 +37,7 @@ Context context; //////////////////////////////////////////////////////////////////////////////// int main (int argc, char** argv) { - UnitTest t (270); + UnitTest t (264); // Ensure environment has no influence. unsetenv ("TASKDATA"); @@ -183,16 +183,6 @@ int main (int argc, char** argv) t.is (items[4], "five six seven", "splitq 'one \\'two\\' \\'\\' \\'three four\\' \"five six seven\" eight'nine ten' -> [4] 'five six seven'"); t.is (items[5], "eight'nine ten'", "splitq 'one \\'two\\' \\'\\' \\'three four\\' \"five six seven\" eight'nine ten' -> [4] 'eight\\'nine ten\\''"); - // void splitq (std::vector&, const std::string&); - unsplit = " ( A or B ) "; - splitq (items, unsplit); - t.is (items.size (), (size_t) 5, "splitq ' ( A or B ) '"); - t.is (items[0], "(", "splitq ' ( A or B ) ' -> [0] '('"); - t.is (items[1], "A", "splitq ' ( A or B ) ' -> [1] 'A'"); - t.is (items[2], "or", "splitq ' ( A or B ) ' -> [2] 'or'"); - t.is (items[3], "B", "splitq ' ( A or B ) ' -> [3] 'B'"); - t.is (items[4], ")", "splitq ' ( A or B ) ' -> [4] ')'"); - // void join (std::string& result, const std::string& separator, const std::vector& items) std::vector unjoined; std::string joined;