Wireshark 4.7.0
The Wireshark network protocol analyzer
Loading...
Searching...
No Matches
proto_tree_model.h
Go to the documentation of this file.
1
10#ifndef PROTO_TREE_MODEL_H
11#define PROTO_TREE_MODEL_H
12
15
16#include <QAbstractItemModel>
17#include <QModelIndex>
18
24class ProtoTreeModel : public QAbstractItemModel
25{
26 Q_OBJECT
27
28public:
33 explicit ProtoTreeModel(QObject *parent = 0);
34
39
46 virtual Qt::ItemFlags flags(const QModelIndex &index) const;
47
54 QModelIndex index(int row, int, const QModelIndex &parent = QModelIndex()) const;
55
61 virtual QModelIndex parent(const QModelIndex &index) const;
62
68 virtual int rowCount(const QModelIndex &parent = QModelIndex()) const;
69
74 virtual int columnCount(const QModelIndex &) const { return 1; }
75
82 virtual QVariant data(const QModelIndex &index, int role = Qt::DisplayRole) const;
83
92 void setRootNode(proto_node *root_node);
93
99 ProtoNode *protoNodeFromIndex(const QModelIndex &index) const;
100
106 QModelIndex indexFromProtoNode(ProtoNode *index_node) const;
107
113 QModelIndex findFirstHfid(int hf_id);
114
120 QModelIndex findFieldInformation(FieldInformation *finfo);
121
122private:
123 ProtoNode *root_node_;
132 static bool foreachFindHfid(ProtoNode *node, void *find_hfid_ptr);
133
141 static bool foreachFindField(ProtoNode *node, void *find_finfo_ptr);
142};
143
144#endif // PROTO_TREE_MODEL_H
Represents information about a dissected packet field.
Definition field_information.h:26
A wrapper class for the core proto_node structure, providing tree traversal and data access.
Definition proto_node.h:24
Item model that exposes a libwireshark proto_node tree to Qt views, enabling the packet-details tree ...
Definition proto_tree_model.h:25
void setRootNode(proto_node *root_node)
Sets the root node of the proto_node tree exposed by this model.
Definition proto_tree_model.cpp:183
QModelIndex findFirstHfid(int hf_id)
Searches the tree for the first node whose header-field ID matches hf_id.
Definition proto_tree_model.cpp:239
virtual Qt::ItemFlags flags(const QModelIndex &index) const
Returns the item flags for the given index.
Definition proto_tree_model.cpp:38
~ProtoTreeModel()
Destroys the model. Does not free the underlying proto_node tree.
Definition proto_tree_model.cpp:33
virtual int columnCount(const QModelIndex &) const
Returns the number of columns (always 1).
Definition proto_tree_model.h:74
virtual QModelIndex parent(const QModelIndex &index) const
Returns the parent index of the item at index.
Definition proto_tree_model.cpp:68
QModelIndex index(int row, int, const QModelIndex &parent=QModelIndex()) const
Returns the model index for the child at row under parent.
Definition proto_tree_model.cpp:48
QModelIndex indexFromProtoNode(ProtoNode *index_node) const
Returns the model index corresponding to the given ProtoNode.
Definition proto_tree_model.cpp:202
ProtoNode * protoNodeFromIndex(const QModelIndex &index) const
Returns the ProtoNode wrapper for the item at the given model index.
Definition proto_tree_model.cpp:197
virtual int rowCount(const QModelIndex &parent=QModelIndex()) const
Returns the number of child rows under parent.
Definition proto_tree_model.cpp:77
QModelIndex findFieldInformation(FieldInformation *finfo)
Searches the tree for the node that corresponds to the given FieldInformation.
Definition proto_tree_model.cpp:274
Definition proto.h:909