2021-11-30 08:01:36 -05:00
|
|
|
/** @file
|
2017-12-07 08:15:30 -08:00
|
|
|
*
|
|
|
|
* Wireshark - Network traffic analyzer
|
|
|
|
* By Gerald Combs <gerald@wireshark.org>
|
|
|
|
* Copyright 1998 Gerald Combs
|
|
|
|
*
|
2018-02-07 12:26:45 +01:00
|
|
|
* SPDX-License-Identifier: GPL-2.0-or-later
|
2017-12-07 08:15:30 -08:00
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef PROTO_TREE_MODEL_H
|
|
|
|
#define PROTO_TREE_MODEL_H
|
|
|
|
|
2022-11-12 22:27:42 -05:00
|
|
|
#include <ui/qt/utils/field_information.h>
|
2017-12-07 08:15:30 -08:00
|
|
|
#include <ui/qt/utils/proto_node.h>
|
|
|
|
|
|
|
|
#include <QAbstractItemModel>
|
|
|
|
#include <QModelIndex>
|
|
|
|
|
|
|
|
class ProtoTreeModel : public QAbstractItemModel
|
|
|
|
{
|
|
|
|
Q_OBJECT
|
|
|
|
|
|
|
|
public:
|
|
|
|
explicit ProtoTreeModel(QObject * parent = 0);
|
2022-11-12 22:27:42 -05:00
|
|
|
~ProtoTreeModel();
|
2017-12-07 08:15:30 -08:00
|
|
|
|
2018-01-18 10:45:43 -08:00
|
|
|
virtual Qt::ItemFlags flags(const QModelIndex &index) const;
|
2017-12-07 08:15:30 -08:00
|
|
|
QModelIndex index(int row, int, const QModelIndex &parent = QModelIndex()) const;
|
|
|
|
virtual QModelIndex parent(const QModelIndex &index) const;
|
|
|
|
virtual int rowCount(const QModelIndex &parent = QModelIndex()) const;
|
|
|
|
virtual int columnCount(const QModelIndex &) const { return 1; }
|
|
|
|
virtual QVariant data(const QModelIndex &index, int role = Qt::DisplayRole) const;
|
|
|
|
|
|
|
|
// root_node can be NULL.
|
|
|
|
void setRootNode(proto_node *root_node);
|
2022-11-12 22:27:42 -05:00
|
|
|
ProtoNode* protoNodeFromIndex(const QModelIndex &index) const;
|
|
|
|
QModelIndex indexFromProtoNode(ProtoNode *index_node) const;
|
2017-12-07 08:15:30 -08:00
|
|
|
|
|
|
|
QModelIndex findFirstHfid(int hf_id);
|
|
|
|
QModelIndex findFieldInformation(FieldInformation *finfo);
|
|
|
|
|
|
|
|
private:
|
2022-11-12 22:27:42 -05:00
|
|
|
ProtoNode *root_node_;
|
2024-03-31 12:50:45 -07:00
|
|
|
static bool foreachFindHfid(ProtoNode *node, void *find_hfid_ptr);
|
|
|
|
static bool foreachFindField(ProtoNode *node, void *find_finfo_ptr);
|
2017-12-07 08:15:30 -08:00
|
|
|
};
|
|
|
|
|
|
|
|
#endif // PROTO_TREE_MODEL_H
|