Home | History | Annotate | Download | only in base

Lines Matching defs:Value

27                   static_cast<size_t>(Value::Type::LIST) + 1,
30 std::unique_ptr<Value> CopyWithoutEmptyChildren(const Value& node);
38 std::unique_ptr<Value> child_copy = CopyWithoutEmptyChildren(*entry);
52 std::unique_ptr<Value> child_copy = CopyWithoutEmptyChildren(it.value());
62 std::unique_ptr<Value> CopyWithoutEmptyChildren(const Value& node) {
64 case Value::Type::LIST:
67 case Value::Type::DICTIONARY:
72 return MakeUnique<Value>(node);
79 std::unique_ptr<Value> Value::CreateNullValue() {
80 return WrapUnique(new Value(Type::NONE));
90 Value::Value(const Value& that) {
94 Value::Value(Value&& that) noexcept {
98 Value::Value() noexcept : type_(Type::NONE) {}
100 Value::Value(Type type) : type_(type) {
101 // Initialize with the default value.
130 Value::Value(bool in_bool) : type_(Type::BOOLEAN), bool_value_(in_bool) {}
132 Value::Value(int in_int) : type_(Type::INTEGER), int_value_(in_int) {}
134 Value::Value(double in_double) : type_(Type::DOUBLE), double_value_(in_double) {
142 Value::Value(const char* in_string) : type_(Type::STRING) {
147 Value::Value(const std::string& in_string) : type_(Type::STRING) {
152 Value::Value(std::string&& in_string) noexcept : type_(Type::STRING) {
157 Value::Value(const char16* in_string) : type_(Type::STRING) {
161 Value::Value(const string16& in_string) : type_(Type::STRING) {
165 Value::Value(StringPiece in_string) : Value(in_string.as_string()) {}
167 Value::Value(const std::vector<char>& in_blob) : type_(Type::BINARY) {
171 Value::Value(std::vector<char>&& in_blob) noexcept : type_(Type::BINARY) {
175 Value& Value::operator=(const Value& that) {
187 Value& Value::operator=(Value&& that) noexcept {
195 Value::~Value() {
200 const char* Value::GetTypeName(Value::Type type) {
206 bool Value::GetBool() const {
211 int Value::GetInt() const {
216 double Value::GetDouble() const {
225 const std::string& Value::GetString() const {
230 const std::vector<char>& Value::GetBlob() const {
235 size_t Value::GetSize() const {
239 const char* Value::GetBuffer() const {
243 bool Value::GetAsBoolean(bool* out_value) const {
251 bool Value::GetAsInteger(int* out_value) const {
259 bool Value::GetAsDouble(double* out_value) const {
271 bool Value::GetAsString(std::string* out_value) const {
279 bool Value::GetAsString(string16* out_value) const {
287 bool Value::GetAsString(const Value** out_value) const {
289 *out_value = static_cast<const Value*>(this);
295 bool Value::GetAsString(StringPiece* out_value) const {
303 bool Value::GetAsBinary(const BinaryValue** out_value) const {
311 bool Value::GetAsList(ListValue** out_value) {
319 bool Value::GetAsList(const ListValue** out_value) const {
327 bool Value::GetAsDictionary(DictionaryValue** out_value) {
335 bool Value::GetAsDictionary(const DictionaryValue** out_value) const {
343 Value* Value::DeepCopy() const {
344 return new Value(*this);
347 std::unique_ptr<Value> Value::CreateDeepCopy() const {
348 return MakeUnique<Value>(*this);
351 bool operator==(const Value& lhs, const Value& rhs) {
356 case Value::Type::NONE:
358 case Value::Type::BOOLEAN:
360 case Value::Type::INTEGER:
362 case Value::Type::DOUBLE:
364 case Value::Type::STRING:
366 case Value::Type::BINARY:
370 case Value::Type::DICTIONARY:
375 [](const Value::DictStorage::value_type& u,
376 const Value::DictStorage::value_type& v) {
380 case Value::Type::LIST:
385 [](const Value::ListStorage::value_type& u,
386 const Value::ListStorage::value_type& v) { return *u == *v; });
393 bool operator!=(const Value& lhs, const Value& rhs) {
397 bool operator<(const Value& lhs, const Value& rhs) {
402 case Value::Type::NONE:
404 case Value::Type::BOOLEAN:
406 case Value::Type::INTEGER:
408 case Value::Type::DOUBLE:
410 case Value::Type::STRING:
412 case Value::Type::BINARY:
416 case Value::Type::DICTIONARY:
420 [](const Value::DictStorage::value_type& u,
421 const Value::DictStorage::value_type& v) {
424 case Value::Type::LIST:
428 [](const Value::ListStorage::value_type& u,
429 const Value::ListStorage::value_type& v) { return *u < *v; });
436 bool operator>(const Value& lhs, const Value& rhs) {
440 bool operator<=(const Value& lhs, const Value& rhs) {
444 bool operator>=(const Value& lhs, const Value& rhs) {
448 bool Value::Equals(const Value* other) const {
454 bool Value::Equals(const Value* a, const Value* b) {
462 void Value::InternalCopyFundamentalValue(const Value& that) {
483 void Value::InternalCopyConstructFrom(const Value& that) {
510 MakeUnique<Value>(*it.second));
517 list_->push_back(MakeUnique<Value>(*it));
522 void Value::InternalMoveConstructFrom(Value&& that) {
548 void Value::InternalCopyAssignFromSameType(const Value& that) {
549 // TODO(crbug.com/646113): make this a DCHECK once base::Value does not have
573 *dict_ptr_ = std::move(*Value(that).dict_ptr_);
576 *list_ = std::move(*Value(that).list_);
581 void Value::InternalCleanup() {
609 std::unique_ptr<Value> value) {
611 if (value && value->GetAsDictionary(&out)) {
612 ignore_result(value.release());
618 DictionaryValue::DictionaryValue() : Value(Type::DICTIONARY) {}
631 void DictionaryValue::Set(StringPiece path, std::unique_ptr<Value> in_value) {
657 void DictionaryValue::Set(StringPiece path, Value* in_value) {
662 Set(path, new Value(in_value));
666 Set(path, new Value(in_value));
670 Set(path, new Value(in_value));
674 Set(path, new Value(in_value));
678 Set(path, new Value(in_value));
682 std::unique_ptr<Value> in_value) {
687 Value* in_value) {
693 SetWithoutPathExpansion(path, base::MakeUnique<base::Value>(in_value));
698 SetWithoutPathExpansion(path, base::MakeUnique<base::Value>(in_value));
703 SetWithoutPathExpansion(path, base::MakeUnique<base::Value>(in_value));
708 SetWithoutPathExpansion(path, base::MakeUnique<base::Value>(in_value));
713 SetWithoutPathExpansion(path, base::MakeUnique<base::Value>(in_value));
717 const Value** out_value) const {
737 bool DictionaryValue::Get(StringPiece path, Value** out_value) {
740 const_cast<const Value**>(out_value));
744 const Value* value;
745 if (!Get(path, &value))
748 return value->GetAsBoolean(bool_value);
752 const Value* value;
753 if (!Get(path, &value))
756 return value->GetAsInteger(out_value);
760 const Value* value;
761 if (!Get(path, &value))
764 return value->GetAsDouble(out_value);
769 const Value* value;
770 if (!Get(path, &value))
773 return value->GetAsString(out_value);
777 const Value* value;
778 if (!Get(path, &value))
781 return value->GetAsString(out_value);
801 const Value* value;
802 bool result = Get(path, &value);
803 if (!result || !value->IsType(Type::BINARY))
807 *out_value = value;
820 const Value* value;
821 bool result = Get(path, &value);
822 if (!result || !value->IsType(Type::DICTIONARY))
826 *out_value = static_cast<const DictionaryValue*>(value);
840 const Value* value;
841 bool result = Get(path, &value);
842 if (!result || !value->IsType(Type::LIST))
846 *out_value = static_cast<const ListValue*>(value);
858 const Value** out_value) const {
870 Value** out_value) {
873 const_cast<const Value**>(out_value));
878 const Value* value;
879 if (!GetWithoutPathExpansion(key, &value))
882 return value->GetAsBoolean(out_value);
887 const Value* value;
888 if (!GetWithoutPathExpansion(key, &value))
891 return value->GetAsInteger(out_value);
896 const Value* value;
897 if (!GetWithoutPathExpansion(key, &value))
900 return value->GetAsDouble(out_value);
906 const Value* value;
907 if (!GetWithoutPathExpansion(key, &value))
910 return value->GetAsString(out_value);
915 const Value* value;
916 if (!GetWithoutPathExpansion(key, &value))
919 return value->GetAsString(out_value);
925 const Value* value;
926 bool result = GetWithoutPathExpansion(key, &value);
927 if (!result || !value->IsType(Type::DICTIONARY))
931 *out_value = static_cast<const DictionaryValue*>(value);
949 const Value* value;
950 bool result = GetWithoutPathExpansion(key, &value);
951 if (!result || !value->IsType(Type::LIST))
955 *out_value = static_cast<const ListValue*>(value);
969 std::unique_ptr<Value>* out_value) {
987 std::unique_ptr<Value>* out_value) {
1000 std::unique_ptr<Value>* out_value) {
1031 const Value* merge_value = &it.value();
1033 if (merge_value->IsType(Value::Type::DICTIONARY)) {
1042 SetWithoutPathExpansion(it.key(), MakeUnique<Value>(*merge_value));
1069 std::unique_ptr<ListValue> ListValue::From(std::unique_ptr<Value> value) {
1071 if (value && value->GetAsList(&out)) {
1072 ignore_result(value.release());
1078 ListValue::ListValue() : Value(Type::LIST) {}
1084 bool ListValue::Set(size_t index, Value* in_value) {
1088 bool ListValue::Set(size_t index, std::unique_ptr<Value> in_value) {
1105 bool ListValue::Get(size_t index, const Value** out_value) const {
1115 bool ListValue::Get(size_t index, Value** out_value) {
1118 const_cast<const Value**>(out_value));
1122 const Value* value;
1123 if (!Get(index, &value))
1126 return value->GetAsBoolean(bool_value);
1130 const Value* value;
1131 if (!Get(index, &value))
1134 return value->GetAsInteger(out_value);
1138 const Value* value;
1139 if (!Get(index, &value))
1142 return value->GetAsDouble(out_value);
1146 const Value* value;
1147 if (!Get(index, &value))
1150 return value->GetAsString(out_value);
1154 const Value* value;
1155 if (!Get(index, &value))
1158 return value->GetAsString(out_value);
1162 const Value* value;
1163 bool result = Get(index, &value);
1164 if (!result || !value->IsType(Type::BINARY))
1168 *out_value = value;
1181 const Value* value;
1182 bool result = Get(index, &value);
1183 if (!result || !value->IsType(Type::DICTIONARY))
1187 *out_value = static_cast<const DictionaryValue*>(value);
1199 const Value* value;
1200 bool result = Get(index, &value);
1201 if (!result || !value->IsType(Type::LIST))
1205 *out_value = static_cast<const ListValue*>(value);
1216 bool ListValue::Remove(size_t index, std::unique_ptr<Value>* out_value) {
1227 bool ListValue::Remove(const Value& value, size_t* index) {
1229 if (**it == value) {
1242 std::unique_ptr<Value>* out_value) {
1249 void ListValue::Append(std::unique_ptr<Value> in_value) {
1254 void ListValue::Append(Value* in_value) {
1261 Append(MakeUnique<Value>(in_value));
1265 Append(MakeUnique<Value>(in_value));
1269 Append(MakeUnique<Value>(in_value));
1273 Append(MakeUnique<Value>(in_value));
1277 Append(MakeUnique<Value>(in_value));
1294 bool ListValue::AppendIfNotPresent(std::unique_ptr<Value> in_value) {
1304 bool ListValue::Insert(size_t index, std::unique_ptr<Value> in_value) {
1313 ListValue::const_iterator ListValue::Find(const Value& value) const {
1315 [&value](const std::unique_ptr<Value>& entry) {
1316 return *entry == value;
1339 std::ostream& operator<<(std::ostream& out, const Value& value) {
1341 JSONWriter::WriteWithOptions(value, JSONWriter::OPTIONS_PRETTY_PRINT, &json);
1345 std::ostream& operator<<(std::ostream& out, const Value::Type& type) {
1349 return out << Value::GetTypeName(type);