summaryrefslogtreecommitdiffstats
path: root/base/json_writer.h
diff options
context:
space:
mode:
authorpfeldman@chromium.org <pfeldman@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-05-15 10:13:28 +0000
committerpfeldman@chromium.org <pfeldman@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-05-15 10:13:28 +0000
commit3388d4c672226f7da116211ec90ee8c57778d7b1 (patch)
tree3643640710ff7619c766a6bba0bed2541b654d2c /base/json_writer.h
parenta0e56d9b660da66bebbe3fdd272f78635fc5d7e9 (diff)
downloadchromium_src-3388d4c672226f7da116211ec90ee8c57778d7b1.zip
chromium_src-3388d4c672226f7da116211ec90ee8c57778d7b1.tar.gz
chromium_src-3388d4c672226f7da116211ec90ee8c57778d7b1.tar.bz2
DevTools: Introduce lightweight version of JSON serialization.
Review URL: http://codereview.chromium.org/115397 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@16153 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'base/json_writer.h')
-rw-r--r--base/json_writer.h10
1 files changed, 9 insertions, 1 deletions
diff --git a/base/json_writer.h b/base/json_writer.h
index 93c923d..f8d0241 100644
--- a/base/json_writer.h
+++ b/base/json_writer.h
@@ -23,12 +23,20 @@ class JSONWriter {
static void Write(const Value* const node, bool pretty_print,
std::string* json);
+ // Same as above, but has an option to not escape the string, preserving its
+ // UTF8 characters. It is useful if you can pass resulting string to the
+ // JSON parser in binary form (as UTF8).
+ static void WriteWithOptionalEscape(const Value* const node,
+ bool pretty_print,
+ bool escape,
+ std::string* json);
+
private:
JSONWriter(bool pretty_print, std::string* json);
// Called recursively to build the JSON string. Whe completed, value is
// json_string_ will contain the JSON.
- void BuildJSONString(const Value* const node, int depth);
+ void BuildJSONString(const Value* const node, int depth, bool escape);
// Appends a quoted, escaped, version of str to json_string_.
void AppendQuotedString(const std::wstring& str);