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

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

Issue 10834004: Correct const accessors in base/values.(h|cc) (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Reverting webdriver:Command::parameters_ to const Created 8 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
« no previous file with comments | « no previous file | 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')
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_VALUE_CONVERTER_H_ 5 #ifndef BASE_JSON_JSON_VALUE_CONVERTER_H_
6 #define BASE_JSON_JSON_VALUE_CONVERTER_H_ 6 #define BASE_JSON_JSON_VALUE_CONVERTER_H_
7 7
8 #include <string> 8 #include <string>
9 #include <vector> 9 #include <vector>
10 10
(...skipping 487 matching lines...) Expand 10 before | Expand all | Expand 10 after
498 } 498 }
499 499
500 bool Convert(const base::Value& value, StructType* output) const { 500 bool Convert(const base::Value& value, StructType* output) const {
501 const DictionaryValue* dictionary_value = NULL; 501 const DictionaryValue* dictionary_value = NULL;
502 if (!value.GetAsDictionary(&dictionary_value)) 502 if (!value.GetAsDictionary(&dictionary_value))
503 return false; 503 return false;
504 504
505 for(size_t i = 0; i < fields_.size(); ++i) { 505 for(size_t i = 0; i < fields_.size(); ++i) {
506 const internal::FieldConverterBase<StructType>* field_converter = 506 const internal::FieldConverterBase<StructType>* field_converter =
507 fields_[i]; 507 fields_[i];
508 base::Value* field = NULL; 508 const base::Value* field = NULL;
509 if (dictionary_value->Get(field_converter->field_path(), &field)) { 509 if (dictionary_value->Get(field_converter->field_path(), &field)) {
510 if (!field_converter->ConvertField(*field, output)) { 510 if (!field_converter->ConvertField(*field, output)) {
511 DVLOG(1) << "failure at field " << field_converter->field_path(); 511 DVLOG(1) << "failure at field " << field_converter->field_path();
512 return false; 512 return false;
513 } 513 }
514 } 514 }
515 } 515 }
516 return true; 516 return true;
517 } 517 }
518 518
519 private: 519 private:
520 ScopedVector<internal::FieldConverterBase<StructType> > fields_; 520 ScopedVector<internal::FieldConverterBase<StructType> > fields_;
521 521
522 DISALLOW_COPY_AND_ASSIGN(JSONValueConverter); 522 DISALLOW_COPY_AND_ASSIGN(JSONValueConverter);
523 }; 523 };
524 524
525 } // namespace base 525 } // namespace base
526 526
527 #endif // BASE_JSON_JSON_VALUE_CONVERTER_H_ 527 #endif // BASE_JSON_JSON_VALUE_CONVERTER_H_
OLDNEW
« no previous file with comments | « no previous file | base/json/json_writer.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698