Wireshark  2.9.0-477-g68ec514b
The Wireshark network protocol analyzer
proto_tree_model.h
1 /* proto_tree_model.h
2  *
3  * Wireshark - Network traffic analyzer
4  * By Gerald Combs <gerald@wireshark.org>
5  * Copyright 1998 Gerald Combs
6  *
7  * SPDX-License-Identifier: GPL-2.0-or-later
8  */
9 
10 #ifndef PROTO_TREE_MODEL_H
11 #define PROTO_TREE_MODEL_H
12 
13 #include <ui/qt/utils/proto_node.h>
14 
15 #include <QAbstractItemModel>
16 #include <QModelIndex>
17 
18 class ProtoTreeModel : public QAbstractItemModel
19 {
20  Q_OBJECT
21 
22 public:
23  explicit ProtoTreeModel(QObject * parent = 0);
24 
25  virtual Qt::ItemFlags flags(const QModelIndex &index) const;
26  QModelIndex index(int row, int, const QModelIndex &parent = QModelIndex()) const;
27  virtual QModelIndex parent(const QModelIndex &index) const;
28  virtual int rowCount(const QModelIndex &parent = QModelIndex()) const;
29  virtual int columnCount(const QModelIndex &) const { return 1; }
30  virtual QVariant data(const QModelIndex &index, int role = Qt::DisplayRole) const;
31 
32  // root_node can be NULL.
33  void setRootNode(proto_node *root_node);
34  ProtoNode protoNodeFromIndex(const QModelIndex &index) const;
35  QModelIndex indexFromProtoNode(ProtoNode &index_node) const;
36 
37  QModelIndex findFirstHfid(int hf_id);
38  QModelIndex findFieldInformation(FieldInformation *finfo);
39 
40 private:
41  proto_node* root_node_;
42  static void foreachFindHfid(proto_node *node, gpointer find_hfid_ptr);
43  static void foreachFindField(proto_node *node, gpointer find_finfo_ptr);
44 };
45 
46 #endif // PROTO_TREE_MODEL_H
47 
48 /*
49  * Editor modelines
50  *
51  * Local Variables:
52  * c-basic-offset: 4
53  * tab-width: 8
54  * indent-tabs-mode: nil
55  * End:
56  *
57  * ex: set shiftwidth=4 tabstop=8 expandtab:
58  * :indentSize=4:tabSize=8:noTabs=true:
59  */
Definition: field_information.h:21
Definition: proto_tree_model.h:18
Definition: proto_node.h:17
Definition: proto.h:759