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

Unified Diff: base/values.cc

Issue 10914246: Add some useful features to base::Values: (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: rebase Created 8 years, 3 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « base/values.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: base/values.cc
diff --git a/base/values.cc b/base/values.cc
index 1063effe3778d9dc644ab5750f4e47fa41f9e77c..8453bb4836d3bbaa06a0503afdb8a7b2c30de577 100644
--- a/base/values.cc
+++ b/base/values.cc
@@ -443,6 +443,31 @@ void DictionaryValue::SetWithoutPathExpansion(const std::string& key,
}
}
+void DictionaryValue::SetBooleanWithoutPathExpansion(
+ const std::string& path, bool in_value) {
+ SetWithoutPathExpansion(path, CreateBooleanValue(in_value));
+}
+
+void DictionaryValue::SetIntegerWithoutPathExpansion(
+ const std::string& path, int in_value) {
+ SetWithoutPathExpansion(path, CreateIntegerValue(in_value));
+}
+
+void DictionaryValue::SetDoubleWithoutPathExpansion(
+ const std::string& path, double in_value) {
+ SetWithoutPathExpansion(path, CreateDoubleValue(in_value));
+}
+
+void DictionaryValue::SetStringWithoutPathExpansion(
+ const std::string& path, const std::string& in_value) {
+ SetWithoutPathExpansion(path, CreateStringValue(in_value));
+}
+
+void DictionaryValue::SetStringWithoutPathExpansion(
+ const std::string& path, const string16& in_value) {
+ SetWithoutPathExpansion(path, CreateStringValue(in_value));
+}
+
bool DictionaryValue::Get(
const std::string& path, const Value** out_value) const {
DCHECK(IsStringUTF8(path));
@@ -987,6 +1012,40 @@ void ListValue::Append(Value* in_value) {
list_.push_back(in_value);
}
+void ListValue::AppendBoolean(bool in_value) {
+ Append(CreateBooleanValue(in_value));
+}
+
+void ListValue::AppendInteger(int in_value) {
+ Append(CreateIntegerValue(in_value));
+}
+
+void ListValue::AppendDouble(double in_value) {
+ Append(CreateDoubleValue(in_value));
+}
+
+void ListValue::AppendString(const std::string& in_value) {
+ Append(CreateStringValue(in_value));
+}
+
+void ListValue::AppendString(const string16& in_value) {
+ Append(CreateStringValue(in_value));
+}
+
+void ListValue::AppendStrings(const std::vector<std::string>& in_values) {
+ for (std::vector<std::string>::const_iterator it = in_values.begin();
+ it != in_values.end(); ++it) {
+ AppendString(*it);
+ }
+}
+
+void ListValue::AppendStrings(const std::vector<string16>& in_values) {
+ for (std::vector<string16>::const_iterator it = in_values.begin();
+ it != in_values.end(); ++it) {
+ AppendString(*it);
+ }
+}
+
bool ListValue::AppendIfNotPresent(Value* in_value) {
DCHECK(in_value);
for (ValueVector::const_iterator i(list_.begin()); i != list_.end(); ++i) {
« no previous file with comments | « base/values.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698