1. get_str_set isn't used.
2. In future, it should use for_each_substr for better performance where
get_str_set is needed.
Signed-off-by: Changcheng Liu <changcheng.liu@aliyun.com>
get_str_vec(str, delims, result);
return result;
}
-
-void get_str_set(const string& str, const char *delims, set<string>& str_set)
-{
- str_set.clear();
- for_each_substr(str, delims, [&str_set] (auto token) {
- str_set.emplace(token.begin(), token.end());
- });
-}
-
-void get_str_set(const string& str, set<string>& str_set)
-{
- const char *delims = ";,= \t";
- get_str_set(str, delims, str_set);
-}
-
-set<string> get_str_set(const string& str, const char *delims)
-{
- set<string> result;
- get_str_set(str, delims, result);
- return result;
-}
std::vector<std::string> get_str_vec(const std::string& str,
const char *delims = ";,= \t");
-/**
- * Split **str** into a set of strings, using the ";,= \t" delimiters and output the result in **str_set**.
- *
- * @param [in] str String to split and save as Set
- * @param [out] str_set Set modified containing str after it has been split
-**/
-extern void get_str_set(const std::string& str,
- std::set<std::string>& str_set);
-
-/**
- * Split **str** into a set of strings, using the **delims** delimiters and output the result in **str_set**.
- *
- * @param [in] str String to split and save as Set
- * @param [in] delims characters used to split **str**
- * @param [out] str_set Set modified containing str after it has been split
-**/
-template<class Compare = std::less<std::string> >
-void get_str_set(const std::string& str,
- const char *delims,
- std::set<std::string, Compare>& str_set)
-{
- str_set.clear();
- for_each_substr(str, delims, [&str_set] (auto token) {
- str_set.emplace(token.begin(), token.end());
- });
-}
-
-std::set<std::string> get_str_set(const std::string& str,
- const char *delims = ";,= \t");
-
-
/**
* Return a String containing the vector **v** joined with **sep**
// SplitTest is parameterized for list/vector/set
using Types = ::testing::Types<std::list<std::string>,
- std::vector<std::string>,
- std::set<std::string>>;
+ std::vector<std::string>>;
template <typename T>
struct SplitTest : ::testing::Test {
const std::vector<std::string>& expected) {
EXPECT_EQ(expected, get_str_vec(input, delim));
}
- void test(const char* input, const char *delim,
- const std::set<std::string>& expected) {
- EXPECT_EQ(expected, get_str_set(input, delim));
- }
};
TYPED_TEST_SUITE(SplitTest, Types);