aboutsummaryrefslogtreecommitdiffstats
path: root/src/lib/utils/parsing.cpp
diff options
context:
space:
mode:
authorlloyd <[email protected]>2014-02-13 12:51:15 +0000
committerlloyd <[email protected]>2014-02-13 12:51:15 +0000
commitc548b437e6004328830f8b4f55ac922951ebdf3d (patch)
tree34c38a02a4a78cc1e4189cb8cdea07d7d9c6b17b /src/lib/utils/parsing.cpp
parentf4413f88f535ade0257ef1ea914c2df44cdb51f2 (diff)
Remove dependency on boost string algos
Diffstat (limited to 'src/lib/utils/parsing.cpp')
-rw-r--r--src/lib/utils/parsing.cpp13
1 files changed, 8 insertions, 5 deletions
diff --git a/src/lib/utils/parsing.cpp b/src/lib/utils/parsing.cpp
index cf47e24f8..c5081dcd7 100644
--- a/src/lib/utils/parsing.cpp
+++ b/src/lib/utils/parsing.cpp
@@ -1,6 +1,6 @@
/*
* Various string utils and parsing functions
-* (C) 1999-2007,2013 Jack Lloyd
+* (C) 1999-2007,2013,2014 Jack Lloyd
*
* Distributed under the terms of the Botan license
*/
@@ -105,18 +105,21 @@ std::vector<std::string> parse_algorithm_name(const std::string& namex)
return elems;
}
-/*
-* Split the string on slashes
-*/
std::vector<std::string> split_on(const std::string& str, char delim)
{
+ return split_on_pred(str, [delim](char c) { return c == delim; });
+ }
+
+std::vector<std::string> split_on_pred(const std::string& str,
+ std::function<bool (char)> pred)
+ {
std::vector<std::string> elems;
if(str == "") return elems;
std::string substr;
for(auto i = str.begin(); i != str.end(); ++i)
{
- if(*i == delim)
+ if(pred(*i))
{
if(substr != "")
elems.push_back(substr);