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

Side by Side Diff: base/json/json_reader.cc

Issue 7647026: base: Add three helper functions to Values API. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: fix a typo Ceate -> Create Created 9 years, 4 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 | « no previous file | base/json/json_writer_unittest.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) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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 #include "base/json/json_reader.h" 5 #include "base/json/json_reader.h"
6 6
7 #include "base/float_util.h" 7 #include "base/float_util.h"
8 #include "base/logging.h" 8 #include "base/logging.h"
9 #include "base/memory/scoped_ptr.h" 9 #include "base/memory/scoped_ptr.h"
10 #include "base/stringprintf.h" 10 #include "base/stringprintf.h"
(...skipping 201 matching lines...) Expand 10 before | Expand all | Expand 10 after
212 } 212 }
213 213
214 scoped_ptr<Value> node; 214 scoped_ptr<Value> node;
215 215
216 switch (token.type) { 216 switch (token.type) {
217 case Token::END_OF_INPUT: 217 case Token::END_OF_INPUT:
218 case Token::INVALID_TOKEN: 218 case Token::INVALID_TOKEN:
219 return NULL; 219 return NULL;
220 220
221 case Token::NULL_TOKEN: 221 case Token::NULL_TOKEN:
222 node.reset(Value::CreateNullValue()); 222 node.reset(NullValue());
223 break; 223 break;
224 224
225 case Token::BOOL_TRUE: 225 case Token::BOOL_TRUE:
226 node.reset(Value::CreateBooleanValue(true)); 226 node.reset(TrueValue());
227 break; 227 break;
228 228
229 case Token::BOOL_FALSE: 229 case Token::BOOL_FALSE:
230 node.reset(Value::CreateBooleanValue(false)); 230 node.reset(FalseValue());
231 break; 231 break;
232 232
233 case Token::NUMBER: 233 case Token::NUMBER:
234 node.reset(DecodeNumber(token)); 234 node.reset(DecodeNumber(token));
235 if (!node.get()) 235 if (!node.get())
236 return NULL; 236 return NULL;
237 break; 237 break;
238 238
239 case Token::STRING: 239 case Token::STRING:
240 node.reset(DecodeString(token)); 240 node.reset(DecodeString(token));
(...skipping 424 matching lines...) Expand 10 before | Expand all | Expand 10 after
665 ++column_number; 665 ++column_number;
666 } 666 }
667 } 667 }
668 668
669 error_line_ = line_number; 669 error_line_ = line_number;
670 error_col_ = column_number; 670 error_col_ = column_number;
671 error_code_ = error; 671 error_code_ = error;
672 } 672 }
673 673
674 } // namespace base 674 } // namespace base
OLDNEW
« no previous file with comments | « no previous file | base/json/json_writer_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698