Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(5)

Side by Side Diff: base/json/json_writer.h

Issue 316016: Move the json-related files into a separate json directory. This hopefully al... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 11 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « base/json/json_reader_unittest.cc ('k') | base/json/json_writer.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Property Changes:
Added: svn:mergeinfo
Merged /branches/chrome_webkit_merge_branch/base/json_writer.h:r69-2775
OLDNEW
1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #ifndef BASE_JSON_WRITER_H_ 5 #ifndef BASE_JSON_JSON_WRITER_H_
6 #define BASE_JSON_WRITER_H_ 6 #define BASE_JSON_JSON_WRITER_H_
7 7
8 #include <string> 8 #include <string>
9 9
10 #include "base/basictypes.h" 10 #include "base/basictypes.h"
11 11
12 class Value; 12 class Value;
13 13
14 namespace base {
15
14 class JSONWriter { 16 class JSONWriter {
15 public: 17 public:
16 // Given a root node, generates a JSON string and puts it into |json|. 18 // Given a root node, generates a JSON string and puts it into |json|.
17 // If |pretty_print| is true, return a slightly nicer formated json string 19 // If |pretty_print| is true, return a slightly nicer formated json string
18 // (pads with whitespace to help readability). If |pretty_print| is false, 20 // (pads with whitespace to help readability). If |pretty_print| is false,
19 // we try to generate as compact a string as possible. 21 // we try to generate as compact a string as possible.
20 // TODO(tc): Should we generate json if it would be invalid json (e.g., 22 // TODO(tc): Should we generate json if it would be invalid json (e.g.,
21 // |node| is not a DictionaryValue/ListValue or if there are inf/-inf float 23 // |node| is not a DictionaryValue/ListValue or if there are inf/-inf float
22 // values)? 24 // values)?
23 static void Write(const Value* const node, bool pretty_print, 25 static void Write(const Value* const node, bool pretty_print,
(...skipping 21 matching lines...) Expand all
45 void IndentLine(int depth); 47 void IndentLine(int depth);
46 48
47 // Where we write JSON data as we generate it. 49 // Where we write JSON data as we generate it.
48 std::string* json_string_; 50 std::string* json_string_;
49 51
50 bool pretty_print_; 52 bool pretty_print_;
51 53
52 DISALLOW_COPY_AND_ASSIGN(JSONWriter); 54 DISALLOW_COPY_AND_ASSIGN(JSONWriter);
53 }; 55 };
54 56
55 #endif // BASE_JSON_WRITER_H_ 57 } // namespace base
58
59 #endif // BASE_JSON_JSON_WRITER_H_
OLDNEW
« no previous file with comments | « base/json/json_reader_unittest.cc ('k') | base/json/json_writer.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698