diff options
author | Patrick Simianer <p@simianer.de> | 2014-08-23 22:59:16 +0100 |
---|---|---|
committer | Patrick Simianer <p@simianer.de> | 2014-08-23 22:59:16 +0100 |
commit | cef65063cec641a93973b38a48e100fdd115db44 (patch) | |
tree | 32d5f10757e021a9fad01156fbff62a96212f006 /fast/util.hh | |
parent | 190f68c880eb27506669e95e2bc0493e2ec42c4c (diff) |
rewritten grammar
Diffstat (limited to 'fast/util.hh')
-rw-r--r-- | fast/util.hh | 35 |
1 files changed, 18 insertions, 17 deletions
diff --git a/fast/util.hh b/fast/util.hh index 2a28f16..c3e087e 100644 --- a/fast/util.hh +++ b/fast/util.hh @@ -7,23 +7,24 @@ using namespace std; namespace util { - inline string - json_escape(const string& s) { // FIXME: only inline? - 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 string +json_escape(const string& s) { // FIXME: only inline? + 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(); +} } // namespace util |