summaryrefslogtreecommitdiffstats
path: root/base/values.cc
diff options
context:
space:
mode:
Diffstat (limited to 'base/values.cc')
-rw-r--r--base/values.cc15
1 files changed, 13 insertions, 2 deletions
diff --git a/base/values.cc b/base/values.cc
index 3b5bd38..716fdf3 100644
--- a/base/values.cc
+++ b/base/values.cc
@@ -610,13 +610,15 @@ bool ListValue::Remove(size_t index, Value** out_value) {
return true;
}
-void ListValue::Remove(const Value& value) {
+int ListValue::Remove(const Value& value) {
for (ValueVector::iterator i(list_.begin()); i != list_.end(); ++i) {
if ((*i)->Equals(&value)) {
+ size_t index = i - list_.begin();
list_.erase(i);
- break;
+ return index;
}
}
+ return -1;
}
void ListValue::Append(Value* in_value) {
@@ -624,6 +626,15 @@ void ListValue::Append(Value* in_value) {
list_.push_back(in_value);
}
+bool ListValue::Insert(size_t index, Value* in_value) {
+ DCHECK(in_value);
+ if (index < 0 || index > list_.size())
+ return false;
+
+ list_.insert(list_.begin() + index, in_value);
+ return true;
+}
+
Value* ListValue::DeepCopy() const {
ListValue* result = new ListValue;