summaryrefslogtreecommitdiff
path: root/utils/stringlib.h
diff options
context:
space:
mode:
authorPatrick Simianer <p@simianer.de>2014-02-16 00:13:17 +0100
committerPatrick Simianer <p@simianer.de>2014-02-16 00:13:17 +0100
commitbb5b6464826c765f4795381830acae158987f46b (patch)
treef29658c1278f2b450a81fa4207c8d809558e95cf /utils/stringlib.h
parent7bfe96c2a706d375362c054619f28dd40c7c33e8 (diff)
parent8015250ddd3983320b6e54ca7f1914a465bc8a59 (diff)
Merge remote-tracking branch 'upstream/master'
Diffstat (limited to 'utils/stringlib.h')
-rw-r--r--utils/stringlib.h15
1 files changed, 15 insertions, 0 deletions
diff --git a/utils/stringlib.h b/utils/stringlib.h
index f60b7867..2fdbfff8 100644
--- a/utils/stringlib.h
+++ b/utils/stringlib.h
@@ -242,6 +242,21 @@ void VisitTokens(std::string const& s,F f) {
VisitTokens(mp.p,mp.p+s.size(),f);
}
+template <class F>
+void VisitTokens(std::string const& s,F f, unsigned start) {
+ if (0) {
+ std::vector<std::string> ss=SplitOnWhitespace(s);
+ for (unsigned i=0;i<ss.size();++i)
+ f(ss[i]);
+ return;
+ }
+ //FIXME:
+ if (s.empty()) return;
+ mutable_c_str mp(s);
+ SLIBDBG("mp="<<mp.p);
+ VisitTokens(mp.p+start,mp.p+s.size(),f);
+}
+
inline void SplitCommandAndParam(const std::string& in, std::string* cmd, std::string* param) {
cmd->clear();
param->clear();