OLD | NEW |
---|---|
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/values.h" | 5 #include "base/values.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 | 8 |
9 #include "base/float_util.h" | 9 #include "base/float_util.h" |
10 #include "base/logging.h" | 10 #include "base/logging.h" |
(...skipping 867 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
878 DCHECK(in_value); | 878 DCHECK(in_value); |
879 if (index > list_.size()) | 879 if (index > list_.size()) |
880 return false; | 880 return false; |
881 | 881 |
882 list_.insert(list_.begin() + index, in_value); | 882 list_.insert(list_.begin() + index, in_value); |
883 return true; | 883 return true; |
884 } | 884 } |
885 | 885 |
886 ListValue::const_iterator ListValue::Find(const Value& value) const { | 886 ListValue::const_iterator ListValue::Find(const Value& value) const { |
887 return std::find_if(list_.begin(), list_.end(), ValueEquals(&value)); | 887 return std::find_if(list_.begin(), list_.end(), ValueEquals(&value)); |
888 } | 888 } |
Mattias Nissler (ping if slow)
2011/10/07 11:02:57
This is obsolete.
pastarmovj
2011/10/13 11:25:06
Yes, rebasing artifact. Removed.
| |
889 | 889 |
890 int ListValue::Find(const Value& value) const { | |
891 for (ValueVector::const_iterator i(list_.begin()); i != list_.end(); ++i) { | |
892 if ((*i)->Equals(&value)) { | |
893 return i - list_.begin(); | |
894 } | |
895 } | |
896 return -1; | |
897 } | |
898 | |
899 bool ListValue::GetAsList(ListValue** out_value) { | 890 bool ListValue::GetAsList(ListValue** out_value) { |
900 if (out_value) | 891 if (out_value) |
901 *out_value = this; | 892 *out_value = this; |
902 return true; | 893 return true; |
903 } | 894 } |
904 | 895 |
905 bool ListValue::GetAsList(const ListValue** out_value) const { | 896 bool ListValue::GetAsList(const ListValue** out_value) const { |
906 if (out_value) | 897 if (out_value) |
907 *out_value = this; | 898 *out_value = this; |
908 return true; | 899 return true; |
(...skipping 24 matching lines...) Expand all Loading... | |
933 if (lhs_it != end() || rhs_it != other_list->end()) | 924 if (lhs_it != end() || rhs_it != other_list->end()) |
934 return false; | 925 return false; |
935 | 926 |
936 return true; | 927 return true; |
937 } | 928 } |
938 | 929 |
939 ValueSerializer::~ValueSerializer() { | 930 ValueSerializer::~ValueSerializer() { |
940 } | 931 } |
941 | 932 |
942 } // namespace base | 933 } // namespace base |
OLD | NEW |