class Hierarchy
Defined at line 395 of file ../../zircon/system/ulib/inspect/include/lib/inspect/cpp/hierarchy.h
Represents a hierarchy of node objects rooted under one particular node.
NodeValues do not contain children because they are parsed directly from a buffer. Hierarchies
provide a wrapper around a hierarchy of nodes including named children. They additionally provide
links to hierarchies that can be parsed and spliced in from nested files.
Public Methods
void Hierarchy (NodeValue node, std::vector<Hierarchy> children)
Directly construct a hierarchy consisting of a node and a list
of children.
Defined at line 49 of file ../../zircon/system/ulib/inspect/hierarchy.cc
const Hierarchy * GetByPath (const std::vector<std::string> & path)
Gets a child in this Hierarchy by path.
Returns nullptr if the requested child could not be found.
The returned pointer will be invalidated if the Hierarchy is modified.
Defined at line 52 of file ../../zircon/system/ulib/inspect/hierarchy.cc
void Visit (fit::function<bool (const std::vector<std::string> &, Hierarchy *)> callback)
Visit all descendents of this Hierarchy, calling the given callback with a mutable pointer to
each child.
Traversal stops when all descendents are visited or the callback returns false.
Defined at line 70 of file ../../zircon/system/ulib/inspect/hierarchy.cc
void Visit (fit::function<bool (const std::vector<std::string> &, const Hierarchy *)> callback)
Visit all descendents of this Hierarchy, calling the given callback with a const pointer to
each child.
Traversal stops when all descendents are visited or the callback returns false.
Defined at line 102 of file ../../zircon/system/ulib/inspect/hierarchy.cc
void Sort ()
Sort properties and children of this node by, and recursively sort each child.
This method imposes a canonical ordering on every child value in the hierarchy for purposes of
comparison and output. It does not optimize operations in any way.
The sorting rule for each of children and property values is as follows:
- If and only if all names match non-negative integral strings, sort numerically.
- Otherwise, sort lexicographically.
For example:
3b 2 1 11 -> 1 11 2 3b
2 1 11 3 -> 1 2 3 11
-1 3 20 -> -1 20 3
Defined at line 110 of file ../../zircon/system/ulib/inspect/hierarchy.cc
void Hierarchy ()
Defined at line 397 of file ../../zircon/system/ulib/inspect/include/lib/inspect/cpp/hierarchy.h
void Hierarchy (Hierarchy && )
Allow moving, disallow copying.
Defined at line 404 of file ../../zircon/system/ulib/inspect/include/lib/inspect/cpp/hierarchy.h
void Hierarchy (const Hierarchy & )
Defined at line 405 of file ../../zircon/system/ulib/inspect/include/lib/inspect/cpp/hierarchy.h
Hierarchy & operator= (Hierarchy && )
Defined at line 406 of file ../../zircon/system/ulib/inspect/include/lib/inspect/cpp/hierarchy.h
Hierarchy & operator= (const Hierarchy & )
Defined at line 407 of file ../../zircon/system/ulib/inspect/include/lib/inspect/cpp/hierarchy.h
const NodeValue & node ()
Obtains the NodeValue at this level of this hierarchy.
Defined at line 410 of file ../../zircon/system/ulib/inspect/include/lib/inspect/cpp/hierarchy.h
NodeValue * node_ptr ()
Obtains a pointer to the underlying NodeValue.
Defined at line 413 of file ../../zircon/system/ulib/inspect/include/lib/inspect/cpp/hierarchy.h
const std::string & name ()
Obtains the name of the Node at this level of the hierarchy.
Defined at line 416 of file ../../zircon/system/ulib/inspect/include/lib/inspect/cpp/hierarchy.h
const std::vector<Hierarchy> & children ()
Gets the children of this object in the hierarchy.
Defined at line 419 of file ../../zircon/system/ulib/inspect/include/lib/inspect/cpp/hierarchy.h
std::vector<Hierarchy> take_children ()
Takes the children from this hierarchy.
Defined at line 422 of file ../../zircon/system/ulib/inspect/include/lib/inspect/cpp/hierarchy.h
void add_child (Hierarchy child)
Adds a child to this hierarchy.
Defined at line 425 of file ../../zircon/system/ulib/inspect/include/lib/inspect/cpp/hierarchy.h
const std::vector<MissingValue> & missing_values ()
Gets the list of missing values for this location in the hierarchy.
Defined at line 428 of file ../../zircon/system/ulib/inspect/include/lib/inspect/cpp/hierarchy.h
void add_missing_value (MissingValueReason reason, std::string name)
Adds a missing value for this location in the hierarchy.
Defined at line 431 of file ../../zircon/system/ulib/inspect/include/lib/inspect/cpp/hierarchy.h