From f1916c39b820b7d10d1ae7d7447675c4224d8197 Mon Sep 17 00:00:00 2001 From: Patrick Simianer Date: Sun, 24 Aug 2014 17:26:05 +0100 Subject: fixes --- fast/util.hh | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) (limited to 'fast/util.hh') diff --git a/fast/util.hh b/fast/util.hh index c3e087e..9ce19da 100644 --- a/fast/util.hh +++ b/fast/util.hh @@ -2,13 +2,16 @@ #include +#include "weaver.hh" + using namespace std; namespace util { inline string -json_escape(const string& s) { // FIXME: only inline? +json_escape(const string& s) +{ ostringstream os; for (auto it = s.cbegin(); it != s.cend(); it++) { switch (*it) { @@ -26,5 +29,19 @@ json_escape(const string& s) { // FIXME: only inline? return os.str(); } +inline vector +tokenize(string s) +{ + istringstream ss(s); + vector r; + while (ss.good()) { + string buf; + ss >> buf; + r.push_back(buf); + } + + return r; +} + } // namespace util -- cgit v1.2.3