Wireshark  4.3.0
The Wireshark network protocol analyzer
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 
14 #include <ui/qt/utils/proto_node.h>
15 
16 #include <QAbstractItemModel>
17 #include <QModelIndex>
18 
19 class ProtoTreeModel : public QAbstractItemModel
20 {
21  Q_OBJECT
22 
23 public:
24  explicit ProtoTreeModel(QObject * parent = 0);
25  ~ProtoTreeModel();
26 
27  virtual Qt::ItemFlags flags(const QModelIndex &index) const;
28  QModelIndex index(int row, int, const QModelIndex &parent = QModelIndex()) const;
29  virtual QModelIndex parent(const QModelIndex &index) const;
30  virtual int rowCount(const QModelIndex &parent = QModelIndex()) const;
31  virtual int columnCount(const QModelIndex &) const { return 1; }
32  virtual QVariant data(const QModelIndex &index, int role = Qt::DisplayRole) const;
33 
34  // root_node can be NULL.
35  void setRootNode(proto_node *root_node);
36  ProtoNode* protoNodeFromIndex(const QModelIndex &index) const;
37  QModelIndex indexFromProtoNode(ProtoNode *index_node) const;
38 
39  QModelIndex findFirstHfid(int hf_id);
40  QModelIndex findFieldInformation(FieldInformation *finfo);
41 
42 private:
43  ProtoNode *root_node_;
44  static bool foreachFindHfid(ProtoNode *node, void *find_hfid_ptr);
45  static bool foreachFindField(ProtoNode *node, void *find_finfo_ptr);
46 };
47 
48 #endif // PROTO_TREE_MODEL_H
Definition: field_information.h:23
Definition: proto_node.h:21
Definition: proto_tree_model.h:20
Definition: proto.h:904