update epan/dissectors/pidl/drsuapi/drsuapi.idl from samba
[wireshark-sm.git] / ui / qt / models / proto_tree_model.h
blob12d08fc0cc746c6b3a50620c9bf4215fdb269177
1 /** @file
3 * Wireshark - Network traffic analyzer
4 * By Gerald Combs <gerald@wireshark.org>
5 * Copyright 1998 Gerald Combs
7 * SPDX-License-Identifier: GPL-2.0-or-later
8 */
10 #ifndef PROTO_TREE_MODEL_H
11 #define PROTO_TREE_MODEL_H
13 #include <ui/qt/utils/field_information.h>
14 #include <ui/qt/utils/proto_node.h>
16 #include <QAbstractItemModel>
17 #include <QModelIndex>
19 class ProtoTreeModel : public QAbstractItemModel
21 Q_OBJECT
23 public:
24 explicit ProtoTreeModel(QObject * parent = 0);
25 ~ProtoTreeModel();
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;
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;
39 QModelIndex findFirstHfid(int hf_id);
40 QModelIndex findFieldInformation(FieldInformation *finfo);
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);
48 #endif // PROTO_TREE_MODEL_H