Lines Matching +full:path +full:- +full:key
2 // Use of this source code is governed by a BSD-style license that can be
47 // See the file-level comment above for more information.
61 // dict->SetString("mykey", foo);
91 // Note: Do not add more types. See the file-level comment above for why.
164 // |FindKey| looks up |key| in the underlying dictionary. If found, it returns
172 Value* FindKey(std::string_view key);
173 const Value* FindKey(std::string_view key) const;
184 Value* FindKeyOfType(std::string_view key, Type type);
185 const Value* FindKeyOfType(std::string_view key, Type type) const;
187 // |SetKey| looks up |key| in the underlying dictionary and sets the mapped
188 // value to |value|. If |key| could not be found, a new element is inserted.
194 Value* SetKey(std::string_view key, Value value);
196 Value* SetKey(std::string&& key, Value value);
198 Value* SetKey(const char* key, Value value);
200 // This attempts to remove the value associated with |key|. In case of
201 // failure, e.g. the key does not exist, |false| is returned and the
202 // underlying dictionary is not changed. In case of success, |key| is deleted
208 bool RemoveKey(std::string_view key);
210 // Searches a hierarchy of dictionary values for a given value. If a path
211 // of dictionaries exist, returns the item at that path. If any of the path
212 // components do not exist or if any but the last path components are not
227 // Note: If there is only one component in the path, use FindKey() instead.
228 Value* FindPath(std::initializer_list<std::string_view> path);
229 Value* FindPath(span<const std::string_view> path);
230 const Value* FindPath(std::initializer_list<std::string_view> path) const;
231 const Value* FindPath(span<const std::string_view> path) const;
236 // Note: If there is only one component in the path, use FindKeyOfType()
238 Value* FindPathOfType(std::initializer_list<std::string_view> path,
240 Value* FindPathOfType(span<const std::string_view> path, Type type);
241 const Value* FindPathOfType(std::initializer_list<std::string_view> path,
243 const Value* FindPathOfType(span<const std::string_view> path,
246 // Sets the given path, expanding and creating dictionary keys as necessary.
249 // path components do not exist, they will be created. If any but the last
251 // (it will not overwrite the value) and return nullptr. The last path
261 // Note: If there is only one component in the path, use SetKey() instead.
262 Value* SetPath(std::initializer_list<std::string_view> path, Value value);
263 Value* SetPath(span<const std::string_view> path, Value value);
265 // Tries to remove a Value at the given path.
267 // If the current value is not a dictionary or any path components does not
270 // path removal, they will be removed as well.
278 // Note: If there is only one component in the path, use RemoveKey() instead.
279 bool RemovePath(std::initializer_list<std::string_view> path);
280 bool RemovePath(span<const std::string_view> path);
287 // dictionary and are compatible with for-each loops and standard library
318 // Note: Do not add more types. See the file-level comment above for why.
371 // DictionaryValue provides a key-value dictionary with (optional) "path"
373 // are |std::string|s and should be UTF-8 encoded.
386 // Returns true if the current dictionary has a value for the given key.
387 // DEPRECATED, use Value::FindKey(key) instead.
388 bool HasKey(std::string_view key) const;
399 // Sets the Value associated with the given path starting from this object.
400 // A path has the form "<key>" or "<key>.<key>.[...]", where "." indexes
402 // within a key, but there are no other restrictions on keys.
403 // If the key at any step of the way doesn't exist, or exists but isn't
405 // to the path in that location. |in_value| must be non-null.
407 // DEPRECATED, use Value::SetPath(path, value) instead.
408 Value* Set(std::string_view path, std::unique_ptr<Value> in_value);
411 // value at that path, even if it has a different type.
412 // DEPRECATED, use Value::SetPath(path, Value(bool)) instead.
413 Value* SetBoolean(std::string_view path, bool in_value);
414 // DEPRECATED, use Value::SetPath(path, Value(int)) instead.
415 Value* SetInteger(std::string_view path, int in_value);
416 // DEPRECATED, use Value::SetPath(path, Value(std::string_view)) instead.
417 Value* SetString(std::string_view path, std::string_view in_value);
418 // DEPRECATED, use Value::SetPath(path, Value(const string& 16)) instead.
419 Value* SetString(std::string_view path, const std::u16string& in_value);
420 // DEPRECATED, use Value::SetPath(path, Value(Type::DICTIONARY)) instead.
421 DictionaryValue* SetDictionary(std::string_view path,
423 // DEPRECATED, use Value::SetPath(path, Value(Type::LIST)) instead.
424 ListValue* SetList(std::string_view path,
429 // DEPRECATED, use Value::SetKey(key, value) instead.
430 Value* SetWithoutPathExpansion(std::string_view key,
433 // Gets the Value associated with the given path starting from this object.
434 // A path has the form "<key>" or "<key>.<key>.[...]", where "." indexes
435 // into the next DictionaryValue down. If the path can be resolved
436 // successfully, the value for the last key in the path will be returned
440 // |out_value| is optional and will only be set if non-NULL.
441 // DEPRECATED, use Value::FindPath(path) instead.
442 bool Get(std::string_view path, const Value** out_value) const;
443 // DEPRECATED, use Value::FindPath(path) instead.
444 bool Get(std::string_view path, Value** out_value);
447 // and the return value will be true if the path is valid and the value at
448 // the end of the path can be returned in the form specified.
449 // |out_value| is optional and will only be set if non-NULL.
450 // DEPRECATED, use Value::FindPath(path) and Value::GetBool() instead.
451 bool GetBoolean(std::string_view path, bool* out_value) const;
452 // DEPRECATED, use Value::FindPath(path) and Value::GetInt() instead.
453 bool GetInteger(std::string_view path, int* out_value) const;
454 // DEPRECATED, use Value::FindPath(path) and Value::GetString() instead.
455 bool GetString(std::string_view path, std::string* out_value) const;
456 // DEPRECATED, use Value::FindPath(path) and Value::GetString() instead.
457 bool GetString(std::string_view path, std::u16string* out_value) const;
458 // DEPRECATED, use Value::FindPath(path) and Value::GetString() instead.
459 bool GetStringASCII(std::string_view path, std::string* out_value) const;
460 // DEPRECATED, use Value::FindPath(path) and Value::GetBlob() instead.
461 bool GetBinary(std::string_view path, const Value** out_value) const;
462 // DEPRECATED, use Value::FindPath(path) and Value::GetBlob() instead.
463 bool GetBinary(std::string_view path, Value** out_value);
464 // DEPRECATED, use Value::FindPath(path) and Value's Dictionary API instead.
465 bool GetDictionary(std::string_view path,
467 // DEPRECATED, use Value::FindPath(path) and Value's Dictionary API instead.
468 bool GetDictionary(std::string_view path, DictionaryValue** out_value);
469 // DEPRECATED, use Value::FindPath(path) and Value::GetList() instead.
470 bool GetList(std::string_view path, const ListValue** out_value) const;
471 // DEPRECATED, use Value::FindPath(path) and Value::GetList() instead.
472 bool GetList(std::string_view path, ListValue** out_value);
476 // DEPRECATED, use Value::FindKey(key) instead.
477 bool GetWithoutPathExpansion(std::string_view key,
479 // DEPRECATED, use Value::FindKey(key) instead.
480 bool GetWithoutPathExpansion(std::string_view key, Value** out_value);
481 // DEPRECATED, use Value::FindKey(key) and Value::GetBool() instead.
482 bool GetBooleanWithoutPathExpansion(std::string_view key,
484 // DEPRECATED, use Value::FindKey(key) and Value::GetInt() instead.
485 bool GetIntegerWithoutPathExpansion(std::string_view key,
487 // DEPRECATED, use Value::FindKey(key) and Value::GetString() instead.
488 bool GetStringWithoutPathExpansion(std::string_view key,
490 // DEPRECATED, use Value::FindKey(key) and Value::GetString() instead.
491 bool GetStringWithoutPathExpansion(std::string_view key,
493 // DEPRECATED, use Value::FindKey(key) and Value's Dictionary API instead.
495 std::string_view key,
497 // DEPRECATED, use Value::FindKey(key) and Value's Dictionary API instead.
498 bool GetDictionaryWithoutPathExpansion(std::string_view key,
500 // DEPRECATED, use Value::FindKey(key) and Value::GetList() instead.
501 bool GetListWithoutPathExpansion(std::string_view key,
503 // DEPRECATED, use Value::FindKey(key) and Value::GetList() instead.
504 bool GetListWithoutPathExpansion(std::string_view key, ListValue** out_value);
506 // Removes the Value with the specified path from this dictionary (or one
507 // of its child dictionaries, if the path is more than just a local key).
508 // If |out_value| is non-NULL, the removed Value will be passed out via
510 // This method returns true if |path| is a valid path; otherwise it will
512 // DEPRECATED, use Value::RemovePath(path) instead.
513 bool Remove(std::string_view path, std::unique_ptr<Value>* out_value);
517 // DEPRECATED, use Value::RemoveKey(key) instead.
518 bool RemoveWithoutPathExpansion(std::string_view key,
521 // Removes a path, clearing out all dictionaries on |path| that remain empty
522 // after removing the value at |path|.
523 // DEPRECATED, use Value::RemovePath(path) instead.
524 bool RemovePath(std::string_view path, std::unique_ptr<Value>* out_value);
533 // sub-dictionaries will be merged as well. In case of key collisions, the
535 // replaced. Values within |dictionary| are deep-copied, so |dictionary| may
554 const std::string& key() const { return it_->first; } in key() function
555 const Value& value() const { return *it_->second; } in value()
619 // |out_value| is optional and will only be set if non-NULL.
627 // |out_value| is optional and will only be set if non-NULL.
645 // If |out_value| is non-NULL, the removed Value AND ITS OWNERSHIP will be
733 // This method deserializes the subclass-specific format into a Value object.
734 // If the return value is non-NULL, the caller takes ownership of returned
735 // Value. If the return value is NULL, and if error_code is non-NULL,
737 // If |error_message| is non-null, it will be filled in with a formatted