29 lines
841 B
Plaintext
29 lines
841 B
Plaintext
:sig
|
|
DTree DTree::get_by_path(String path, String delim = "/")
|
|
|
|
:params
|
|
path : slash-delimited path to traverse
|
|
delim : optional path separator
|
|
return value : the resolved child node, or an empty `DTree` when the path cannot be followed
|
|
|
|
:see
|
|
DTree
|
|
0_context
|
|
>types
|
|
|
|
:content
|
|
Traverses a nested `DTree` without creating missing keys.
|
|
|
|
Empty path segments are ignored, so leading and trailing `/` characters are harmless. If any intermediate node is not a map or a segment is missing, `get_by_path()` returns an empty `DTree`.
|
|
|
|
## Example
|
|
|
|
```cpp
|
|
context.cfg.get_by_path("theme/options/portal-dark/label").to_string()
|
|
```
|
|
|
|
## Related Concepts
|
|
|
|
- PHP: deep array access helpers for associative arrays, decoded JSON, or configuration trees
|
|
- JavaScript / Node.js: optional chaining like `obj?.a?.b`, lodash `get`, or small path-walking helpers
|