summaryrefslogtreecommitdiffstats
path: root/chromium/base/json/json_writer.h
diff options
context:
space:
mode:
authorJocelyn Turcotte <jocelyn.turcotte@digia.com>2014-08-08 14:30:41 +0200
committerJocelyn Turcotte <jocelyn.turcotte@digia.com>2014-08-12 13:49:54 +0200
commitab0a50979b9eb4dfa3320eff7e187e41efedf7a9 (patch)
tree498dfb8a97ff3361a9f7486863a52bb4e26bb898 /chromium/base/json/json_writer.h
parent4ce69f7403811819800e7c5ae1318b2647e778d1 (diff)
Update Chromium to beta version 37.0.2062.68
Change-Id: I188e3b5aff1bec75566014291b654eb19f5bc8ca Reviewed-by: Andras Becsi <andras.becsi@digia.com>
Diffstat (limited to 'chromium/base/json/json_writer.h')
-rw-r--r--chromium/base/json/json_writer.h26
1 files changed, 13 insertions, 13 deletions
diff --git a/chromium/base/json/json_writer.h b/chromium/base/json/json_writer.h
index e4a143c7780..9709c7e723f 100644
--- a/chromium/base/json/json_writer.h
+++ b/chromium/base/json/json_writer.h
@@ -17,8 +17,10 @@ class Value;
class BASE_EXPORT JSONWriter {
public:
enum Options {
- // For values of binary type, the value (and key if within a dictionary)
- // will be omitted from the output.
+ // This option instructs the writer that if a Binary value is encountered,
+ // the value (and key if within a dictionary) will be omitted from the
+ // output, and success will be returned. Otherwise, if a binary value is
+ // encountered, failure will be returned.
OPTIONS_OMIT_BINARY_VALUES = 1 << 0,
// This option instructs the writer to write doubles that have no fractional
@@ -35,25 +37,23 @@ class BASE_EXPORT JSONWriter {
// Given a root node, generates a JSON string and puts it into |json|.
// TODO(tc): Should we generate json if it would be invalid json (e.g.,
// |node| is not a DictionaryValue/ListValue or if there are inf/-inf float
- // values)?
- static void Write(const Value* const node, std::string* json);
+ // values)? Return true on success and false on failure.
+ static bool Write(const Value* const node, std::string* json);
// Same as above but with |options| which is a bunch of JSONWriter::Options
- // bitwise ORed together.
- static void WriteWithOptions(const Value* const node, int options,
+ // bitwise ORed together. Return true on success and false on failure.
+ static bool WriteWithOptions(const Value* const node, int options,
std::string* json);
private:
- JSONWriter(bool omit_binary_values,
- bool omit_double_type_preservation, bool pretty_print,
- std::string* json);
+ JSONWriter(int options, 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);
+ // Called recursively to build the JSON string. When completed,
+ // |json_string_| will contain the JSON.
+ bool BuildJSONString(const Value* const node, size_t depth);
// Adds space to json_string_ for the indent level.
- void IndentLine(int depth);
+ void IndentLine(size_t depth);
bool omit_binary_values_;
bool omit_double_type_preservation_;