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

Side by Side Diff: chrome/common/json_value_serializer.h

Issue 384103: This patch is the rest of the lint cleanup minus the other open issue. (Closed)
Patch Set: Created 11 years, 1 month 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
« no previous file with comments | « chrome/common/important_file_writer.h ('k') | chrome/common/libxml_utils.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2009 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 CHROME_COMMON_JSON_VALUE_SERIALIZER_H_ 5 #ifndef CHROME_COMMON_JSON_VALUE_SERIALIZER_H_
6 #define CHROME_COMMON_JSON_VALUE_SERIALIZER_H_ 6 #define CHROME_COMMON_JSON_VALUE_SERIALIZER_H_
7 7
8 #include <string> 8 #include <string>
9 9
10 #include "base/basictypes.h" 10 #include "base/basictypes.h"
11 #include "base/file_path.h" 11 #include "base/file_path.h"
12 #include "base/values.h" 12 #include "base/values.h"
13 13
14 class JSONStringValueSerializer : public ValueSerializer { 14 class JSONStringValueSerializer : public ValueSerializer {
15 public: 15 public:
16 // json_string is the string that will be source of the deserialization 16 // json_string is the string that will be source of the deserialization
17 // or the destination of the serialization. The caller of the constructor 17 // or the destination of the serialization. The caller of the constructor
18 // retains ownership of the string. 18 // retains ownership of the string.
19 JSONStringValueSerializer(std::string* json_string) 19 explicit JSONStringValueSerializer(std::string* json_string)
20 : json_string_(json_string), 20 : json_string_(json_string),
21 initialized_with_const_string_(false), 21 initialized_with_const_string_(false),
22 pretty_print_(false), 22 pretty_print_(false),
23 allow_trailing_comma_(false) { 23 allow_trailing_comma_(false) {
24 } 24 }
25 25
26 // This version allows initialization with a const string reference for 26 // This version allows initialization with a const string reference for
27 // deserialization only. 27 // deserialization only.
28 JSONStringValueSerializer(const std::string& json_string) 28 explicit JSONStringValueSerializer(const std::string& json_string)
29 : json_string_(&const_cast<std::string&>(json_string)), 29 : json_string_(&const_cast<std::string&>(json_string)),
30 initialized_with_const_string_(true), 30 initialized_with_const_string_(true),
31 pretty_print_(false), 31 pretty_print_(false),
32 allow_trailing_comma_(false) { 32 allow_trailing_comma_(false) {
33 } 33 }
34 34
35 ~JSONStringValueSerializer(); 35 ~JSONStringValueSerializer();
36 36
37 // Attempt to serialize the data structure represented by Value into 37 // Attempt to serialize the data structure represented by Value into
38 // JSON. If the return value is true, the result will have been written 38 // JSON. If the return value is true, the result will have been written
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after
90 // returned value. 90 // returned value.
91 Value* Deserialize(std::string* error_message); 91 Value* Deserialize(std::string* error_message);
92 92
93 private: 93 private:
94 FilePath json_file_path_; 94 FilePath json_file_path_;
95 95
96 DISALLOW_IMPLICIT_CONSTRUCTORS(JSONFileValueSerializer); 96 DISALLOW_IMPLICIT_CONSTRUCTORS(JSONFileValueSerializer);
97 }; 97 };
98 98
99 #endif // CHROME_COMMON_JSON_VALUE_SERIALIZER_H_ 99 #endif // CHROME_COMMON_JSON_VALUE_SERIALIZER_H_
OLDNEW
« no previous file with comments | « chrome/common/important_file_writer.h ('k') | chrome/common/libxml_utils.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698