Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/mapsme/omim.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/base
diff options
context:
space:
mode:
authorIlya Zverev <zverik@textual.ru>2016-06-28 14:27:28 +0300
committerIlya Zverev <zverik@textual.ru>2016-06-28 15:19:13 +0300
commit2ed3cd7c47371382233ef84ced43705e5cf6b2ca (patch)
tree383f278d8876e1cb1cea67cdf0949ebd0d21f4c5 /base
parent826807555c93ba11ca7f193c0df34f80fb83a725 (diff)
[booking] Revert the last good code from ParseCSVRow
Diffstat (limited to 'base')
-rw-r--r--base/base_tests/string_utils_test.cpp6
-rw-r--r--base/string_utils.cpp7
-rw-r--r--base/string_utils.hpp3
3 files changed, 5 insertions, 11 deletions
diff --git a/base/base_tests/string_utils_test.cpp b/base/base_tests/string_utils_test.cpp
index 84b48c1d85..9d416c287b 100644
--- a/base/base_tests/string_utils_test.cpp
+++ b/base/base_tests/string_utils_test.cpp
@@ -733,13 +733,13 @@ UNIT_TEST(NormalizeDigits_UniString)
UNIT_TEST(CSV)
{
vector<string> target;
- TEST(strings::ParseCSVRow(",Test\\,проверка,0,", target), ());
+ strings::ParseCSVRow(",Test\\,проверка,0,", ',', target);
vector<string> expected({"", "Test\\", "проверка", "0", ""});
TEST_EQUAL(target, expected, ());
- TEST(strings::ParseCSVRow("and there was none", target, ' ', 5), ());
+ strings::ParseCSVRow("and there was none", ' ', target);
vector<string> expected2({"and", "there", "", "was", "none"});
TEST_EQUAL(target, expected2, ());
- TEST(!strings::ParseCSVRow("", target), ());
+ strings::ParseCSVRow("", 'q', target);
vector<string> expected3;
TEST_EQUAL(target, expected3, ());
}
diff --git a/base/string_utils.cpp b/base/string_utils.cpp
index 38c9c5ed33..6d017e2405 100644
--- a/base/string_utils.cpp
+++ b/base/string_utils.cpp
@@ -328,7 +328,7 @@ bool AlmostEqual(string const & str1, string const & str2, size_t mismatchedCoun
return false;
}
-bool ParseCSVRow(string const & s, vector<string> & target, char const delimiter, size_t const columns)
+void ParseCSVRow(string const & s, char const delimiter, vector<string> & target)
{
target.clear();
using It = TokenizeIterator<SimpleDelimiter, string::const_iterator, true>;
@@ -341,12 +341,7 @@ bool ParseCSVRow(string const & s, vector<string> & target, char const delimiter
// Special case: if the string is empty, return an empty array instead of {""}.
if (target.size() == 1 && target[0].empty())
- {
target.clear();
- return false;
- }
-
- return columns <= 0 || target.size() == columns;
}
} // namespace strings
diff --git a/base/string_utils.hpp b/base/string_utils.hpp
index 6b9e1f89c5..561ec20fe1 100644
--- a/base/string_utils.hpp
+++ b/base/string_utils.hpp
@@ -308,8 +308,7 @@ void Tokenize(string const & str, char const * delims, TFunctor && f)
/// Splits a string by the delimiter, keeps empty parts, on an empty string returns an empty vector.
/// Does not support quoted columns, newlines in columns and escaped quotes.
-/// @return false if the line is empty or number of columns differs from |columns|.
-bool ParseCSVRow(string const & s, vector<string> & target, char const delimiter = ',', size_t const columns = 0);
+void ParseCSVRow(string const & s, char const delimiter, vector<string> & target);
/// @return code of last symbol in string or 0 if s is empty
UniChar LastUniChar(string const & s);