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 
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 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 
47  bool moveRow(int src_row, int dst_row);
48  bool moveRows(const QModelIndex &sourceParent, int sourceRow, int count, const QModelIndex &destinationParent, int destinationChild);
49 
50  //Drag & drop functionality
51  Qt::DropActions supportedDropActions() const;
52  bool dropMimeData(const QMimeData *data, Qt::DropAction action, int row, int column, const QModelIndex &parent);
53 
54  void reloadUat();
55  bool hasErrors() const;
56  void clearAll();
57 
65  bool applyChanges(QString &error);
66 
73  bool revertChanges(QString &error);
74 
75  QModelIndex findRowForColumnContent(QVariant columnContent, int columnToCheckAgainst, int role = Qt::DisplayRole);
76 
77 private:
78  bool checkField(int row, int col, char **error) const;
79  QList<int> checkRow(int row);
80  void loadUat(uat_t * uat = 0);
81  bool moveRowPrivate(int src_row, int dst_row);
82 
83  epan_uat *uat_;
84  bool applying_;
85  QVector<bool> dirty_records;
86  QVector<QMap<int, QString> > record_errors;
87 };
88 #endif // UAT_MODEL_H
Definition: uat_model.h:25
bool revertChanges(QString &error)
Definition: uat_model.cpp:97
bool applyChanges(QString &error)
Definition: uat_model.cpp:72
Definition: uat-int.h:40