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

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

Issue 1852433005: Convert //base to use std::unique_ptr (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebase after r384946 Created 4 years, 8 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
« no previous file with comments | « base/json/json_file_value_serializer.cc ('k') | base/json/json_parser.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) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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_JSON_PARSER_H_ 5 #ifndef BASE_JSON_JSON_PARSER_H_
6 #define BASE_JSON_JSON_PARSER_H_ 6 #define BASE_JSON_JSON_PARSER_H_
7 7
8 #include <stddef.h> 8 #include <stddef.h>
9 #include <stdint.h> 9 #include <stdint.h>
10 10
(...skipping 115 matching lines...) Expand 10 before | Expand all | Expand 10 after
126 const std::string& AsString(); 126 const std::string& AsString();
127 127
128 private: 128 private:
129 // The beginning of the input string. 129 // The beginning of the input string.
130 const char* pos_; 130 const char* pos_;
131 131
132 // Number of bytes in |pos_| that make up the string being built. 132 // Number of bytes in |pos_| that make up the string being built.
133 size_t length_; 133 size_t length_;
134 134
135 // The copied string representation. NULL until Convert() is called. 135 // The copied string representation. NULL until Convert() is called.
136 // Strong. scoped_ptr<T> has too much of an overhead here. 136 // Strong. std::unique_ptr<T> has too much of an overhead here.
137 std::string* string_; 137 std::string* string_;
138 }; 138 };
139 139
140 // Quick check that the stream has capacity to consume |length| more bytes. 140 // Quick check that the stream has capacity to consume |length| more bytes.
141 bool CanConsume(int length); 141 bool CanConsume(int length);
142 142
143 // The basic way to consume a single character in the stream. Consumes one 143 // The basic way to consume a single character in the stream. Consumes one
144 // byte of the input stream and returns a pointer to the rest of it. 144 // byte of the input stream and returns a pointer to the rest of it.
145 const char* NextChar(); 145 const char* NextChar();
146 146
(...skipping 109 matching lines...) Expand 10 before | Expand all | Expand 10 after
256 FRIEND_TEST_ALL_PREFIXES(JSONParserTest, ConsumeNumbers); 256 FRIEND_TEST_ALL_PREFIXES(JSONParserTest, ConsumeNumbers);
257 FRIEND_TEST_ALL_PREFIXES(JSONParserTest, ErrorMessages); 257 FRIEND_TEST_ALL_PREFIXES(JSONParserTest, ErrorMessages);
258 258
259 DISALLOW_COPY_AND_ASSIGN(JSONParser); 259 DISALLOW_COPY_AND_ASSIGN(JSONParser);
260 }; 260 };
261 261
262 } // namespace internal 262 } // namespace internal
263 } // namespace base 263 } // namespace base
264 264
265 #endif // BASE_JSON_JSON_PARSER_H_ 265 #endif // BASE_JSON_JSON_PARSER_H_
OLDNEW
« no previous file with comments | « base/json/json_file_value_serializer.cc ('k') | base/json/json_parser.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698