From d99f40eaadd92da8d34ffeef694f3a7deed0b826 Mon Sep 17 00:00:00 2001 From: Paul Beckingham Date: Thu, 24 Apr 2014 09:35:02 -0400 Subject: [PATCH] Code Cleanup - Removed obsolete text.cpp splitq funciton, which is superceded by Lexer::split. --- src/text.cpp | 41 ----------------------------------------- src/text.h | 1 - test/text.t.cpp | 13 +------------ 3 files changed, 1 insertion(+), 54 deletions(-) diff --git a/src/text.cpp b/src/text.cpp index 36b0a7360..54138a4cb 100644 --- a/src/text.cpp +++ b/src/text.cpp @@ -61,47 +61,6 @@ void wrapText ( lines.push_back (line); } -//////////////////////////////////////////////////////////////////////////////// -// UTF-8 -void splitq ( - std::vector& results, - const std::string& input, - const char delimiter) -{ - results.clear (); - - std::string::size_type start = 0; - std::string::size_type i = 0; - std::string word; - bool in_quote = false; - char quote; - - while (utf8_next_char (input, i)) - { - if (in_quote) - { - if (input[i] == quote) - in_quote = false; - } - else - { - if (input[i] == delimiter) - { - results.push_back (unquoteText (input.substr (start, i - start))); - start = i + 1; - } - else if (input[i] == '\'' || - input[i] == '"') - { - quote = input[i]; - in_quote = true; - } - } - } - - results.push_back (unquoteText (input.substr (start))); -} - //////////////////////////////////////////////////////////////////////////////// void split ( std::vector& results, diff --git a/src/text.h b/src/text.h index 8414eb1cd..195b3a908 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&, const char); void split (std::vector&, const std::string&, const char); void split (std::vector&, const std::string&, const std::string&); void split_minimal (std::vector&, const std::string&, const char); diff --git a/test/text.t.cpp b/test/text.t.cpp index 2d9d655ed..566673d08 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 (264); + UnitTest t (257); // Ensure environment has no influence. unsetenv ("TASKDATA"); @@ -172,17 +172,6 @@ int main (int argc, char** argv) t.is (items[1], "two", "split 'one\\ntwo\\nthree' -> [1] 'two'"); t.is (items[2], "three", "split 'one\\ntwo\\nthree' -> [2] 'three'"); - // void splitq (std::vector&, const std::string&, const char); - unsplit = "one 'two' '' 'three four' \"five six seven\" eight'nine ten'"; - splitq (items, unsplit, ' '); - t.is (items.size () , (size_t) 6, "splitq 'one \\'two\\' \\'\\' \\'three four\\' \"five six seven\" eight'nine ten'"); - t.is (items[0], "one", "splitq 'one \\'two\\' \\'\\' \\'three four\\' \"five six seven\" eight'nine ten' -> [0] 'one'"); - t.is (items[1], "two", "splitq 'one \\'two\\' \\'\\' \\'three four\\' \"five six seven\" eight'nine ten' -> [1] 'two'"); - t.is (items[2], "", "splitq 'one \\'two\\' \\'\\' \\'three four\\' \"five six seven\" eight'nine ten' -> [2] ''"); - t.is (items[3], "three four", "splitq 'one \\'two\\' \\'\\' \\'three four\\' \"five six seven\" eight'nine ten' -> [3] 'three four'"); - 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 join (std::string& result, const std::string& separator, const std::vector& items) std::vector unjoined; std::string joined;