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.
Functions
Hierarchy
public void Hierarchy(
NodeValue
node,
vector
children)
Defined at line 49 of file ../../zircon/system/ulib/inspect/hierarchy.cc
Directly construct a hierarchy consisting of a node and a list of children.
GetByPath
public const Hierarchy * GetByPath(const std::vector<std::string> & path)
Defined at line 52 of file ../../zircon/system/ulib/inspect/hierarchy.cc
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.
Visit
public void Visit(fit::function<bool (const std::vector<std::string> &, Hierarchy *)> callback)
Defined at line 70 of file ../../zircon/system/ulib/inspect/hierarchy.cc
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.
Visit
public void Visit(fit::function<bool (const std::vector<std::string> &, const Hierarchy *)> callback)
Defined at line 102 of file ../../zircon/system/ulib/inspect/hierarchy.cc
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.
Sort
public void Sort()
Defined at line 110 of file ../../zircon/system/ulib/inspect/hierarchy.cc
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
Hierarchy
public void Hierarchy()
Defined at line 397 of file ../../zircon/system/ulib/inspect/include/lib/inspect/cpp/hierarchy.h
Hierarchy
public void Hierarchy(Hierarchy && )
Defined at line 404 of file ../../zircon/system/ulib/inspect/include/lib/inspect/cpp/hierarchy.h
Allow moving, disallow copying.
Hierarchy
public void Hierarchy(const Hierarchy & )
Defined at line 405 of file ../../zircon/system/ulib/inspect/include/lib/inspect/cpp/hierarchy.h
operator=
public Hierarchy & operator=(Hierarchy && )
Defined at line 406 of file ../../zircon/system/ulib/inspect/include/lib/inspect/cpp/hierarchy.h
operator=
public Hierarchy & operator=(const Hierarchy & )
Defined at line 407 of file ../../zircon/system/ulib/inspect/include/lib/inspect/cpp/hierarchy.h
node
public const NodeValue & node()
Defined at line 410 of file ../../zircon/system/ulib/inspect/include/lib/inspect/cpp/hierarchy.h
Obtains the NodeValue at this level of this hierarchy.
node_ptr
public NodeValue * node_ptr()
Defined at line 413 of file ../../zircon/system/ulib/inspect/include/lib/inspect/cpp/hierarchy.h
Obtains a pointer to the underlying NodeValue.
name
public const std::string & name()
Defined at line 416 of file ../../zircon/system/ulib/inspect/include/lib/inspect/cpp/hierarchy.h
Obtains the name of the Node at this level of the hierarchy.
children
public const std::vector<Hierarchy> & children()
Defined at line 419 of file ../../zircon/system/ulib/inspect/include/lib/inspect/cpp/hierarchy.h
Gets the children of this object in the hierarchy.
take_children
public
vector
take_children()
Defined at line 422 of file ../../zircon/system/ulib/inspect/include/lib/inspect/cpp/hierarchy.h
Takes the children from this hierarchy.
add_child
public void add_child(
Hierarchy
child)
Defined at line 425 of file ../../zircon/system/ulib/inspect/include/lib/inspect/cpp/hierarchy.h
Adds a child to this hierarchy.
missing_values
public const std::vector<MissingValue> & missing_values()
Defined at line 428 of file ../../zircon/system/ulib/inspect/include/lib/inspect/cpp/hierarchy.h
Gets the list of missing values for this location in the hierarchy.
add_missing_value
public void add_missing_value(
MissingValueReason
reason,
basic_string
name)
Defined at line 431 of file ../../zircon/system/ulib/inspect/include/lib/inspect/cpp/hierarchy.h
Adds a missing value for this location in the hierarchy.