diff options
author | Patrick Simianer <p@simianer.de> | 2014-09-16 10:23:14 +0100 |
---|---|---|
committer | Patrick Simianer <p@simianer.de> | 2014-09-16 10:23:14 +0100 |
commit | 129a22cfcc7651daa4b11ed52e7870249f6373a5 (patch) | |
tree | 78de4649396ab0d37a325b7598f9873c2d65f4c9 /fast/util.hh | |
parent | df70006a07fb67b17fb39aa56762c50c2e7b8131 (diff) |
spring cleaning
Diffstat (limited to 'fast/util.hh')
-rw-r--r-- | fast/util.hh | 47 |
1 files changed, 0 insertions, 47 deletions
diff --git a/fast/util.hh b/fast/util.hh deleted file mode 100644 index 9ce19da..0000000 --- a/fast/util.hh +++ /dev/null @@ -1,47 +0,0 @@ -#pragma once - -#include <string> - -#include "weaver.hh" - -using namespace std; - - -namespace util { - -inline string -json_escape(const string& s) -{ - ostringstream os; - for (auto it = s.cbegin(); it != s.cend(); it++) { - switch (*it) { - case '"': os << "\\\""; break; - case '\\': os << "\\\\"; break; - case '\b': os << "\\b"; break; - case '\f': os << "\\f"; break; - case '\n': os << "\\n"; break; - case '\r': os << "\\r"; break; - case '\t': os << "\\t"; break; - default: os << *it; break; - } - } - - return os.str(); -} - -inline vector<symbol_t> -tokenize(string s) -{ - istringstream ss(s); - vector<symbol_t> r; - while (ss.good()) { - string buf; - ss >> buf; - r.push_back(buf); - } - - return r; -} - -} // namespace util - |