Chromium Code Reviews| Index: base/json/json_writer.h |
| diff --git a/base/json/json_writer.h b/base/json/json_writer.h |
| index 1e0b211b142223f535475a6ec4b71681ca15d7ed..e4202331d2a9dd4538e7fc82dfe12da750bab098 100644 |
| --- a/base/json/json_writer.h |
| +++ b/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,20 +37,20 @@ 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(int options, std::string* json); |
| - // Called recursively to build the JSON string. Whe completed, value is |
| + // Called recursively to build the JSON string. When completed, value is |
| // json_string_ will contain the JSON. |
|
gab
2014/02/07 02:24:27
"value is json_string_ will contain the JSON"
I d
Tom Sepez
2014/02/07 02:30:50
Done.
|
| - void BuildJSONString(const Value* const node, size_t depth); |
| + bool BuildJSONString(const Value* const node, size_t depth); |
| // Adds space to json_string_ for the indent level. |
| void IndentLine(size_t depth); |