| OLD | NEW |
| 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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 "base/logging.h" | 7 #include "base/logging.h" |
| 8 #include "base/string_util.h" | 8 #include "base/string_util.h" |
| 9 #include "base/utf_string_conversions.h" | 9 #include "base/utf_string_conversions.h" |
| 10 | 10 |
| (...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 112 } | 112 } |
| 113 | 113 |
| 114 bool Value::GetAsString(std::string* out_value) const { | 114 bool Value::GetAsString(std::string* out_value) const { |
| 115 return false; | 115 return false; |
| 116 } | 116 } |
| 117 | 117 |
| 118 bool Value::GetAsString(string16* out_value) const { | 118 bool Value::GetAsString(string16* out_value) const { |
| 119 return false; | 119 return false; |
| 120 } | 120 } |
| 121 | 121 |
| 122 bool Value::GetAsList(ListValue** out_value) { |
| 123 return false; |
| 124 } |
| 125 |
| 122 Value* Value::DeepCopy() const { | 126 Value* Value::DeepCopy() const { |
| 123 // This method should only be getting called for null Values--all subclasses | 127 // This method should only be getting called for null Values--all subclasses |
| 124 // need to provide their own implementation;. | 128 // need to provide their own implementation;. |
| 125 DCHECK(IsType(TYPE_NULL)); | 129 DCHECK(IsType(TYPE_NULL)); |
| 126 return CreateNullValue(); | 130 return CreateNullValue(); |
| 127 } | 131 } |
| 128 | 132 |
| 129 bool Value::Equals(const Value* other) const { | 133 bool Value::Equals(const Value* other) const { |
| 130 // This method should only be getting called for null Values--all subclasses | 134 // This method should only be getting called for null Values--all subclasses |
| 131 // need to provide their own implementation;. | 135 // need to provide their own implementation;. |
| (...skipping 815 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 947 | 951 |
| 948 bool ListValue::Insert(size_t index, Value* in_value) { | 952 bool ListValue::Insert(size_t index, Value* in_value) { |
| 949 DCHECK(in_value); | 953 DCHECK(in_value); |
| 950 if (index > list_.size()) | 954 if (index > list_.size()) |
| 951 return false; | 955 return false; |
| 952 | 956 |
| 953 list_.insert(list_.begin() + index, in_value); | 957 list_.insert(list_.begin() + index, in_value); |
| 954 return true; | 958 return true; |
| 955 } | 959 } |
| 956 | 960 |
| 961 bool ListValue::GetAsList(ListValue** out_value) { |
| 962 if (out_value) |
| 963 *out_value = this; |
| 964 return true; |
| 965 } |
| 966 |
| 957 Value* ListValue::DeepCopy() const { | 967 Value* ListValue::DeepCopy() const { |
| 958 ListValue* result = new ListValue; | 968 ListValue* result = new ListValue; |
| 959 | 969 |
| 960 for (ValueVector::const_iterator i(list_.begin()); i != list_.end(); ++i) | 970 for (ValueVector::const_iterator i(list_.begin()); i != list_.end(); ++i) |
| 961 result->Append((*i)->DeepCopy()); | 971 result->Append((*i)->DeepCopy()); |
| 962 | 972 |
| 963 return result; | 973 return result; |
| 964 } | 974 } |
| 965 | 975 |
| 966 bool ListValue::Equals(const Value* other) const { | 976 bool ListValue::Equals(const Value* other) const { |
| (...skipping 10 matching lines...) Expand all Loading... |
| 977 return false; | 987 return false; |
| 978 } | 988 } |
| 979 if (lhs_it != end() || rhs_it != other_list->end()) | 989 if (lhs_it != end() || rhs_it != other_list->end()) |
| 980 return false; | 990 return false; |
| 981 | 991 |
| 982 return true; | 992 return true; |
| 983 } | 993 } |
| 984 | 994 |
| 985 ValueSerializer::~ValueSerializer() { | 995 ValueSerializer::~ValueSerializer() { |
| 986 } | 996 } |
| OLD | NEW |