Wireshark 5.1.0
The Wireshark network protocol analyzer
Loading...
Searching...
No Matches
ProtoNode Class Reference

A wrapper class for the core proto_node structure, providing tree traversal and data access. More...

#include <proto_node.h>

Classes

class  ChildIterator
 An iterator for traversing the child nodes of a ProtoNode. More...

Public Member Functions

 ProtoNode (proto_node *node=NULL, ProtoNode *parent=nullptr)
 Constructs a new ProtoNode instance.
 ~ProtoNode ()
 Destroys the ProtoNode.
bool isValid () const
 Checks if the protocol node is valid.
bool isChild () const
 Checks if this node is a child of another node.
bool isExpanded () const
 Checks if the node is expanded in the view.
proto_node * protoNode () const
 Retrieves the underlying core proto_node structure.
field_info * fieldInfo () const
 Retrieves the field information of the underlying node.
int hfId () const
 Retrieves the header field id of the underlying node.
ProtoNode * child (int row) const
 Retrieves a specific child node by its row index.
int childrenCount () const
 Retrieves the total number of child nodes.
int row () const
 Retrieves the row index of this node relative to its parent.
ProtoNode * parentNode () const
 Retrieves the parent node of this node.
QString labelText () const
 Retrieves the display label text for this node.
ChildIterator children () const
 Retrieves a child iterator for traversing this node's children.

Detailed Description

A wrapper class for the core proto_node structure, providing tree traversal and data access.

Constructor & Destructor Documentation

◆ ProtoNode()

ProtoNode::ProtoNode ( proto_node * node = NULL,
ProtoNode * parent = nullptr )
explicit

Constructs a new ProtoNode instance.

Parameters
nodeThe underlying core proto_node, defaults to NULL.
parentThe parent ProtoNode, defaults to nullptr.

Member Function Documentation

◆ child()

ProtoNode * ProtoNode::child ( int row) const

Retrieves a specific child node by its row index.

Parameters
rowThe index of the child node to retrieve.
Returns
A pointer to the child ProtoNode.

◆ children()

ProtoNode::ChildIterator ProtoNode::children ( ) const

Retrieves a child iterator for traversing this node's children.

Returns
A ChildIterator positioned at the first child.

◆ childrenCount()

int ProtoNode::childrenCount ( ) const

Retrieves the total number of child nodes.

Returns
The child count.

◆ fieldInfo()

field_info * ProtoNode::fieldInfo ( ) const

Retrieves the field information of the underlying node.

Returns
The node's field_info, or nullptr if the node is invalid or has none.

◆ hfId()

int ProtoNode::hfId ( ) const

Retrieves the header field id of the underlying node.

Returns
The node's header field id, or -1 if the node has no header field.

◆ isChild()

bool ProtoNode::isChild ( ) const

Checks if this node is a child of another node.

Returns
True if it is a child node, false otherwise.

◆ isExpanded()

bool ProtoNode::isExpanded ( ) const

Checks if the node is expanded in the view.

Returns
True if expanded, false otherwise.

◆ isValid()

bool ProtoNode::isValid ( ) const

Checks if the protocol node is valid.

Returns
True if the underlying node is valid, false otherwise.

◆ labelText()

QString ProtoNode::labelText ( ) const

Retrieves the display label text for this node.

Returns
The label text string.

◆ parentNode()

ProtoNode * ProtoNode::parentNode ( ) const

Retrieves the parent node of this node.

Returns
A pointer to the parent ProtoNode.

◆ protoNode()

proto_node * ProtoNode::protoNode ( ) const

Retrieves the underlying core proto_node structure.

Returns
A pointer to the proto_node.

◆ row()

int ProtoNode::row ( ) const

Retrieves the row index of this node relative to its parent.

Returns
The row index.

The documentation for this class was generated from the following files: