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

Side by Side Diff: base/values.h

Issue 2838893002: Remove base::ListValue::Set(size_t, base::Value*) (Closed)
Patch Set: Fix Compilation Error Created 3 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/metrics/histogram.cc ('k') | base/values.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 // This file specifies a recursive data storage class called Value intended for 5 // This file specifies a recursive data storage class called Value intended for
6 // storing settings and other persistable data. 6 // storing settings and other persistable data.
7 // 7 //
8 // A Value represents something that can be stored in JSON or passed to/from 8 // A Value represents something that can be stored in JSON or passed to/from
9 // JavaScript. As such, it is NOT a generalized variant type, since only the 9 // JavaScript. As such, it is NOT a generalized variant type, since only the
10 // types supported by JavaScript/JSON are supported. 10 // types supported by JavaScript/JSON are supported.
(...skipping 386 matching lines...) Expand 10 before | Expand all | Expand 10 after
397 bool empty() const { return list_->empty(); } 397 bool empty() const { return list_->empty(); }
398 398
399 // Reserves storage for at least |n| values. 399 // Reserves storage for at least |n| values.
400 void Reserve(size_t n); 400 void Reserve(size_t n);
401 401
402 // Sets the list item at the given index to be the Value specified by 402 // Sets the list item at the given index to be the Value specified by
403 // the value given. If the index beyond the current end of the list, null 403 // the value given. If the index beyond the current end of the list, null
404 // Values will be used to pad out the list. 404 // Values will be used to pad out the list.
405 // Returns true if successful, or false if the index was negative or 405 // Returns true if successful, or false if the index was negative or
406 // the value is a null pointer. 406 // the value is a null pointer.
407 bool Set(size_t index, Value* in_value);
408 // Preferred version of the above. TODO(estade): remove the above.
409 bool Set(size_t index, std::unique_ptr<Value> in_value); 407 bool Set(size_t index, std::unique_ptr<Value> in_value);
410 408
411 // Gets the Value at the given index. Modifies |out_value| (and returns true) 409 // Gets the Value at the given index. Modifies |out_value| (and returns true)
412 // only if the index falls within the current list range. 410 // only if the index falls within the current list range.
413 // Note that the list always owns the Value passed out via |out_value|. 411 // Note that the list always owns the Value passed out via |out_value|.
414 // |out_value| is optional and will only be set if non-NULL. 412 // |out_value| is optional and will only be set if non-NULL.
415 bool Get(size_t index, const Value** out_value) const; 413 bool Get(size_t index, const Value** out_value) const;
416 bool Get(size_t index, Value** out_value); 414 bool Get(size_t index, Value** out_value);
417 415
418 // Convenience forms of Get(). Modifies |out_value| (and returns true) 416 // Convenience forms of Get(). Modifies |out_value| (and returns true)
(...skipping 115 matching lines...) Expand 10 before | Expand all | Expand 10 after
534 return out << static_cast<const Value&>(value); 532 return out << static_cast<const Value&>(value);
535 } 533 }
536 534
537 // Stream operator so that enum class Types can be used in log statements. 535 // Stream operator so that enum class Types can be used in log statements.
538 BASE_EXPORT std::ostream& operator<<(std::ostream& out, 536 BASE_EXPORT std::ostream& operator<<(std::ostream& out,
539 const Value::Type& type); 537 const Value::Type& type);
540 538
541 } // namespace base 539 } // namespace base
542 540
543 #endif // BASE_VALUES_H_ 541 #endif // BASE_VALUES_H_
OLDNEW
« no previous file with comments | « base/metrics/histogram.cc ('k') | base/values.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698