Wireshark  2.9.0-477-g68ec514b
The Wireshark network protocol analyzer
uat_model.h
1 /* uat_model.h
2  * Data model for UAT records.
3  *
4  * Copyright 2016 Peter Wu <peter@lekensteyn.nl>
5  *
6  * Wireshark - Network traffic analyzer
7  * By Gerald Combs <gerald@wireshark.org>
8  * Copyright 1998 Gerald Combs
9  *
10  * SPDX-License-Identifier: GPL-2.0-or-later
11  */
12 
13 #ifndef UAT_MODEL_H
14 #define UAT_MODEL_H
15 
16 #include <config.h>
17 #include <glib.h>
18 
19 #include <QAbstractItemModel>
20 #include <QList>
21 #include <QMap>
22 #include <epan/uat-int.h>
23 
24 class UatModel : public QAbstractTableModel
25 {
26  Q_OBJECT
27 
28 public:
29  UatModel(QObject *parent, uat_t *uat = 0);
30  UatModel(QObject *parent, QString tableName);
31 
32  Qt::ItemFlags flags(const QModelIndex &index) const;
33  QVariant data(const QModelIndex &index, int role = Qt::DisplayRole) const;
34  QVariant headerData(int section, Qt::Orientation orientation,
35  int role = Qt::DisplayRole) const;
36  int rowCount(const QModelIndex &parent = QModelIndex()) const;
37  int columnCount(const QModelIndex &parent = QModelIndex()) const;
38 
39  bool setData(const QModelIndex &index, const QVariant &value, int role = Qt::EditRole);
40 
41  bool insertRows(int row, int count, const QModelIndex &parent = QModelIndex());
42  bool removeRows(int row, int count, const QModelIndex &parent = QModelIndex());
43 
44  bool copyRow(int dst_row, int src_row);
45  bool moveRow(int src_row, int dst_row);
46 
47  bool hasErrors() const;
48  void clearAll();
49 
50  QModelIndex findRowForColumnContent(QVariant columnContent, int columnToCheckAgainst, int role = Qt::DisplayRole);
51 
52 private:
53  bool checkField(int row, int col, char **error) const;
54  QList<int> checkRow(int row);
55  void loadUat(uat_t * uat = 0);
56 
57  epan_uat *uat_;
58  QList<bool> dirty_records;
59  QList<QMap<int, QString> > record_errors;
60 };
61 #endif // UAT_MODEL_H
Definition: uat_model.h:24
Definition: uat-int.h:39