diff options
author | Patrick Simianer <p@simianer.de> | 2014-02-16 00:13:17 +0100 |
---|---|---|
committer | Patrick Simianer <p@simianer.de> | 2014-02-16 00:13:17 +0100 |
commit | ab71c44e61d00c788e84b44156d0be16191e267d (patch) | |
tree | 27d1c7e74e8b07276312766a5908853465a3ed18 /utils/stringlib.h | |
parent | 4494c2cae3bed81f9d2d24d749e99bf66a734bc5 (diff) | |
parent | 9e2f7fcfa76213f5e41abb4f4c9a264ebe8f9d8c (diff) |
Merge remote-tracking branch 'upstream/master'
Diffstat (limited to 'utils/stringlib.h')
-rw-r--r-- | utils/stringlib.h | 15 |
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(); |