Lines Matching refs:path
298 Value* Value::FindPath(std::initializer_list<std::string_view> path) {
299 return const_cast<Value*>(const_cast<const Value*>(this)->FindPath(path));
302 Value* Value::FindPath(span<const std::string_view> path) {
303 return const_cast<Value*>(const_cast<const Value*>(this)->FindPath(path));
307 std::initializer_list<std::string_view> path) const {
308 DCHECK_GE(path.size(), 2u) << "Use FindKey() for a path of length 1.";
309 return FindPath(make_span(path.begin(), path.size()));
312 const Value* Value::FindPath(span<const std::string_view> path) const {
314 for (const std::string_view& component : path) {
321 Value* Value::FindPathOfType(std::initializer_list<std::string_view> path,
324 const_cast<const Value*>(this)->FindPathOfType(path, type));
327 Value* Value::FindPathOfType(span<const std::string_view> path, Type type) {
329 const_cast<const Value*>(this)->FindPathOfType(path, type));
332 const Value* Value::FindPathOfType(std::initializer_list<std::string_view> path,
334 DCHECK_GE(path.size(), 2u) << "Use FindKeyOfType() for a path of length 1.";
335 return FindPathOfType(make_span(path.begin(), path.size()), type);
338 const Value* Value::FindPathOfType(span<const std::string_view> path,
340 const Value* result = FindPath(path);
346 Value* Value::SetPath(std::initializer_list<std::string_view> path,
348 DCHECK_GE(path.size(), 2u) << "Use SetKey() for a path of length 1.";
349 return SetPath(make_span(path.begin(), path.size()), std::move(value));
352 Value* Value::SetPath(span<const std::string_view> path, Value value) {
353 DCHECK_NE(path.begin(), path.end()); // Can't be empty path.
358 const std::string_view* cur_path = path.begin();
359 for (; (cur_path + 1) < path.end(); ++cur_path) {
382 bool Value::RemovePath(std::initializer_list<std::string_view> path) {
383 DCHECK_GE(path.size(), 2u) << "Use RemoveKey() for a path of length 1.";
384 return RemovePath(make_span(path.begin(), path.size()));
387 bool Value::RemovePath(span<const std::string_view> path) {
388 if (!is_dict() || path.empty())
391 if (path.size() == 1)
392 return RemoveKey(path[0]);
394 auto found = dict_.find(path[0]);
398 bool removed = found->second->RemovePath(path.subspan(1));
679 Value* DictionaryValue::Set(std::string_view path,
681 DCHECK(IsStringUTF8(path));
684 std::string_view current_path(path);
706 Value* DictionaryValue::SetBoolean(std::string_view path, bool in_value) {
707 return Set(path, std::make_unique<Value>(in_value));
710 Value* DictionaryValue::SetInteger(std::string_view path, int in_value) {
711 return Set(path, std::make_unique<Value>(in_value));
714 Value* DictionaryValue::SetString(std::string_view path,
716 return Set(path, std::make_unique<Value>(in_value));
719 Value* DictionaryValue::SetString(std::string_view path,
721 return Set(path, std::make_unique<Value>(in_value));
725 std::string_view path,
727 return static_cast<DictionaryValue*>(Set(path, std::move(in_value)));
730 ListValue* DictionaryValue::SetList(std::string_view path,
732 return static_cast<ListValue*>(Set(path, std::move(in_value)));
748 bool DictionaryValue::Get(std::string_view path,
750 DCHECK(IsStringUTF8(path));
751 std::string_view current_path(path);
769 bool DictionaryValue::Get(std::string_view path, Value** out_value) {
771 path, const_cast<const Value**>(out_value));
774 bool DictionaryValue::GetBoolean(std::string_view path,
777 if (!Get(path, &value))
783 bool DictionaryValue::GetInteger(std::string_view path, int* out_value) const {
785 if (!Get(path, &value))
791 bool DictionaryValue::GetString(std::string_view path,
794 if (!Get(path, &value))
800 bool DictionaryValue::GetString(std::string_view path,
803 if (!Get(path, &value))
809 bool DictionaryValue::GetStringASCII(std::string_view path,
812 if (!GetString(path, &out))
824 bool DictionaryValue::GetBinary(std::string_view path,
827 bool result = Get(path, &value);
837 bool DictionaryValue::GetBinary(std::string_view path, Value** out_value) {
839 path, const_cast<const Value**>(out_value));
842 bool DictionaryValue::GetDictionary(std::string_view path,
845 bool result = Get(path, &value);
855 bool DictionaryValue::GetDictionary(std::string_view path,
858 path, const_cast<const DictionaryValue**>(out_value));
861 bool DictionaryValue::GetList(std::string_view path,
864 bool result = Get(path, &value);
874 bool DictionaryValue::GetList(std::string_view path, ListValue** out_value) {
876 path, const_cast<const ListValue**>(out_value));
978 bool DictionaryValue::Remove(std::string_view path,
980 DCHECK(IsStringUTF8(path));
981 std::string_view current_path(path);
1009 bool DictionaryValue::RemovePath(std::string_view path,
1012 size_t delimiter_position = path.find('.');
1015 return RemoveWithoutPathExpansion(path, out_value);
1017 std::string_view subdict_path = path.substr(0, delimiter_position);
1021 result = subdict->RemovePath(path.substr(delimiter_position + 1), out_value);