NAME
std/path/z/node - Node wrapper used by std/path/z.
IMPLEMENTATION SUPPORT
This module is supported by all implementations of ZuzuScript.
DESCRIPTION
Objects of this class wrap underlying values and provide traversal and coercion helpers used while evaluating ZPath expressions.
EXPORTS
Classes
NodeBase wrapper for values traversed by ZPath.
Node.from_root(obj)Parameters:
objis any query root. Returns:Node. Wraps a root value for traversal.Node.wrap(obj, parent?, key?, ix?)Parameters:
objis any value, with optional parent, key, and index metadata. Returns:Node. Wraps a value in the appropriate node subclass.node.hold_parent(owner)Parameters:
owneris a parent node. Returns:Node. Retains parent metadata on the node.node.raw(),node.value(),node.primitive_value()Parameters: none. Returns: value. Returns the wrapped raw, node, or primitive value.
node.parent()Parameters: none. Returns:
Nodeornull. Returns the parent node.node.key(),node.ix(),node.index(),node.id()Parameters: none. Returns: value. Returns traversal key, index, or stable node id metadata.
node.type(),node.name()Parameters: none. Returns:
Stringornull. Returns the node type or name.node.tagged()Parameters: none. Returns:
Stringornull. Returns a KDL value tag when present.node.has_tagged()Parameters: none. Returns:
Boolean. Returns true when tag metadata is available.node.string_value(),node.number_value()Parameters: none. Returns:
String,Number, ornull. Coerces the node for string or numeric ZPath operations.node.can_have_named_children(),node.can_have_indexed_children(),node.can_have_named_indexed_children()Parameters: none. Returns:
Boolean. Reports supported child lookup modes.node.named_child(name),node.indexed_child(i),node.named_indexed_child(name, i)Parameters:
nameis a child name andiis an index. Returns:Nodeornull. Looks up child nodes.node.next_child(child),node.prev_child(child),node.next_sibling(),node.prev_sibling()Parameters:
childis a child node where required. Returns:Nodeornull. Traverses adjacent nodes.node.named_attribute(name)Parameters:
nameis an attribute name. Returns:Nodeornull. Looks up one attribute node.node.children(),node.attributes()Parameters: none. Returns:
Array. Returns child or attribute nodes.node.dump()Parameters: none. Returns:
String. Returns a diagnostic rendering of the node.node.find(zpath)Parameters:
zpathis aZPathobject or subclass, such asZZPath. Returns:Array. Evaluates a nested path from this node and returns selected node objects.node.do_action(action),node.do_action_on_child(child, action)Parameters:
actionis a path action andchildis a child node. Returns: value. Applies path mutation actions.node.ref(),node.ref_on_child(child)Parameters:
childis a child node where required. Returns:Function. Returns a reference-like getter/setter.
SimpleNode,StringNode,NumberNode,BooleanNode,NullNodeScalar node wrappers. They inherit the
NodeAPI and overridetype,string_value, ornumber_valuewhere appropriate.ArrayNode,SetNode,BagNode,DictNode,PairListNode,PairNodeCollection node wrappers. They inherit the
NodeAPI and override child, attribute, assignment, and reference methods appropriate to their collection type. PairList children arePairNodeobjects in pair order;indexed_childuses global pair index, whilenamed_indexed_childuses the occurrence index among pairs with the same key.KDLDocumentNode,KDLNodeNode,KDLValueNodeKDL node wrappers. They inherit the
NodeAPI and expose KDL children, attributes, names, value tags, and scalar coercions.XmlNodeNodeXML node wrapper. It inherits the
NodeAPI and exposes XML names, children, attributes, sibling traversal, and scalar text values.TimeNodestd/timewrapper. It inherits theNodeAPI and exposes time attributes plus string and numeric values.PathNodestd/iopath wrapper. It inherits theNodeAPI and exposes path attributes plus string values.WidgetNodestd/gui/objectswidget wrapper. It inherits theNodeAPI and exposes widget children by widget class name and index, plus public widget properties as assignable attributes.
Variables
determine_classType:
Function. Chooses the concrete node wrapper class for a raw value.
COPYRIGHT AND LICENCE
std/path/z/node is copyright Toby Inkster.
It is free software; you may redistribute it and/or modify it under the terms of either the Artistic License 1.0 or the GNU General Public License version 2.