From 86e74c10203dceef205d1c15f4826cd63b334028 Mon Sep 17 00:00:00 2001 From: Paul Beckingham Date: Sun, 11 Mar 2012 15:33:45 -0400 Subject: [PATCH] Code Cleanup - Removed unused function and corresponding unit tests. YAGNI. --- src/text.cpp | 25 +------------------------ src/text.h | 1 - test/text.t.cpp | 5 +---- 3 files changed, 2 insertions(+), 29 deletions(-) diff --git a/src/text.cpp b/src/text.cpp index e33876d16..cfeb481a0 100644 --- a/src/text.cpp +++ b/src/text.cpp @@ -68,6 +68,7 @@ void wrapText ( } //////////////////////////////////////////////////////////////////////////////// +// UTF-8 void splitq ( std::vector& results, const std::string& input, @@ -86,9 +87,7 @@ void splitq ( if (in_quote) { if (input[i] == quote) - { in_quote = false; - } } else { @@ -169,28 +168,6 @@ void split ( results.push_back (input.substr (start)); } -//////////////////////////////////////////////////////////////////////////////// -void split_minimal ( - std::vector& results, - const std::string& input, - const std::string& delimiter) -{ - results.clear (); - std::string::size_type length = delimiter.length (); - - std::string::size_type start = 0; - std::string::size_type i; - while ((i = input.find (delimiter, start)) != std::string::npos) - { - if (i != start) - results.push_back (input.substr (start, i - start)); - start = i + length; - } - - if (input.length ()) - results.push_back (input.substr (start)); -} - //////////////////////////////////////////////////////////////////////////////// void join ( std::string& result, diff --git a/src/text.h b/src/text.h index cb81ea9a1..8a92bbbe9 100644 --- a/src/text.h +++ b/src/text.h @@ -46,7 +46,6 @@ 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); -void split_minimal (std::vector&, const std::string&, const std::string&); void join (std::string&, const std::string&, const std::vector&); void join (std::string&, const std::string&, const std::vector&); std::string commify (const std::string&); diff --git a/test/text.t.cpp b/test/text.t.cpp index 71e71c505..fcac02951 100644 --- a/test/text.t.cpp +++ b/test/text.t.cpp @@ -36,7 +36,7 @@ Context context; //////////////////////////////////////////////////////////////////////////////// int main (int argc, char** argv) { - UnitTest t (262); + UnitTest t (261); // void wrapText (std::vector & lines, const std::string& text, const int width, bool hyphenate) std::string text = "This is a test of the line wrapping code."; std::vector lines; @@ -133,9 +133,6 @@ int main (int argc, char** argv) split (items, unsplit, "--"); t.is (items.size (), (size_t) 0, "split '' '--' -> 0 items"); - split_minimal (items, unsplit, "--"); - t.is (items.size (), (size_t) 0, "split '' '--' -> 0"); - unsplit = "a"; split (items, unsplit, "--"); t.is (items.size (), (size_t) 1, "split 'a' '--' -> 1 item");