Wireshark  4.3.0
The Wireshark network protocol analyzer
uat_model.h
Go to the documentation of this file.
1 
14 #ifndef UAT_MODEL_H
15 #define UAT_MODEL_H
16 
17 #include <config.h>
18 #include <glib.h>
19 
20 #include <QAbstractItemModel>
21 #include <QList>
22 #include <QMap>
23 #include <epan/uat-int.h>
24 
25 class UatModel : public QAbstractTableModel
26 {
27 public:
28  UatModel(QObject *parent, uat_t *uat = 0);
29  UatModel(QObject *parent, QString tableName);
30 
31  Qt::ItemFlags flags(const QModelIndex &index) const;
32  QVariant data(const QModelIndex &index, int role = Qt::DisplayRole) const;
33  QVariant headerData(int section, Qt::Orientation orientation,
34  int role = Qt::DisplayRole) const;
35  int rowCount(const QModelIndex &parent = QModelIndex()) const;
36  int columnCount(const QModelIndex &parent = QModelIndex()) const;
37 
38  bool setData(const QModelIndex &index, const QVariant &value, int role = Qt::EditRole);
39 
40  bool insertRows(int row, int count, const QModelIndex &parent = QModelIndex());
41  bool removeRows(int row, int count, const QModelIndex &parent = QModelIndex());
42 
43  QModelIndex appendEntry(QVariantList row);
44 
45  QModelIndex copyRow(QModelIndex original);
46  bool moveRow(int src_row, int dst_row);
47 
48  bool moveRow(const QModelIndex &sourceParent, int sourceRow, const QModelIndex &destinationParent, int destinationChild);
49 
50  void reloadUat();
51  bool hasErrors() const;
52  void clearAll();
53 
61  bool applyChanges(QString &error);
62 
69  bool revertChanges(QString &error);
70 
71  QModelIndex findRowForColumnContent(QVariant columnContent, int columnToCheckAgainst, int role = Qt::DisplayRole);
72 
73 private:
74  bool checkField(int row, int col, char **error) const;
75  QList<int> checkRow(int row);
76  void loadUat(uat_t * uat = 0);
77 
78  epan_uat *uat_;
79  QList<bool> dirty_records;
80  QList<QMap<int, QString> > record_errors;
81 };
82 #endif // UAT_MODEL_H
Definition: uat_model.h:26
bool revertChanges(QString &error)
Definition: uat_model.cpp:73
bool applyChanges(QString &error)
Definition: uat_model.cpp:54
Definition: uat-int.h:38