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

Side by Side Diff: base/values.h

Issue 7618021: base: Fix the TODO in ListValue::Remove(). (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: fix chromeos 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/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) 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 // 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 setting and other persistable data. It includes the ability to 6 // storing setting and other persistable data. It includes the ability to
7 // specify (recursive) lists and dictionaries, so it's fairly expressive. 7 // specify (recursive) lists and dictionaries, so it's fairly expressive.
8 // However, the API is optimized for the common case, namely storing a 8 // However, the API is optimized for the common case, namely storing a
9 // hierarchical tree of simple values. Given a DictionaryValue root, you can 9 // hierarchical tree of simple values. Given a DictionaryValue root, you can
10 // easily do things like: 10 // easily do things like:
(...skipping 384 matching lines...) Expand 10 before | Expand all | Expand 10 after
395 bool GetList(size_t index, ListValue** out_value) const; 395 bool GetList(size_t index, ListValue** out_value) const;
396 396
397 // Removes the Value with the specified index from this list. 397 // Removes the Value with the specified index from this list.
398 // If |out_value| is non-NULL, the removed Value AND ITS OWNERSHIP will be 398 // If |out_value| is non-NULL, the removed Value AND ITS OWNERSHIP will be
399 // passed out via |out_value|. If |out_value| is NULL, the removed value will 399 // passed out via |out_value|. If |out_value| is NULL, the removed value will
400 // be deleted. This method returns true if |index| is valid; otherwise 400 // be deleted. This method returns true if |index| is valid; otherwise
401 // it will return false and the ListValue object will be unchanged. 401 // it will return false and the ListValue object will be unchanged.
402 bool Remove(size_t index, Value** out_value); 402 bool Remove(size_t index, Value** out_value);
403 403
404 // Removes the first instance of |value| found in the list, if any, and 404 // Removes the first instance of |value| found in the list, if any, and
405 // deletes it. Returns the index that it was located at (-1 for not present). 405 // deletes it. |index| is the location where |value| was found. Returns false
406 int Remove(const Value& value); 406 // if not found.
407 bool Remove(const Value& value, size_t* index);
407 408
408 // Appends a Value to the end of the list. 409 // Appends a Value to the end of the list.
409 void Append(Value* in_value); 410 void Append(Value* in_value);
410 411
411 // Appends a Value if it's not already present. Takes ownership of the 412 // Appends a Value if it's not already present. Takes ownership of the
412 // |in_value|. Returns true if successful, or false if the value was already 413 // |in_value|. Returns true if successful, or false if the value was already
413 // present. If the value was already present the |in_value| is deleted. 414 // present. If the value was already present the |in_value| is deleted.
414 bool AppendIfNotPresent(Value* in_value); 415 bool AppendIfNotPresent(Value* in_value);
415 416
416 // Insert a Value at index. 417 // Insert a Value at index.
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after
460 461
461 } // namespace base 462 } // namespace base
462 463
463 // http://crbug.com/88666 464 // http://crbug.com/88666
464 using base::DictionaryValue; 465 using base::DictionaryValue;
465 using base::ListValue; 466 using base::ListValue;
466 using base::StringValue; 467 using base::StringValue;
467 using base::Value; 468 using base::Value;
468 469
469 #endif // BASE_VALUES_H_ 470 #endif // BASE_VALUES_H_
OLDNEW
« no previous file with comments | « no previous file | base/values.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698