-
-
Notifications
You must be signed in to change notification settings - Fork 3k
/
qgsvectorlayereditpassthrough.h
67 lines (59 loc) · 2.64 KB
/
qgsvectorlayereditpassthrough.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
/***************************************************************************
qgsvectorlayereditpassthrough.h
---------------------
begin : Jan 12 2015
copyright : (C) 2015 by Sandro Mani
email : manisandro at gmail dot com
***************************************************************************
* *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation; either version 2 of the License, or *
* (at your option) any later version. *
* *
***************************************************************************/
#ifndef QGSVECTORLAYEREDITPASSTHROUGH_H
#define QGSVECTORLAYEREDITPASSTHROUGH_H
#include "qgis_core.h"
#include "qgsvectorlayereditbuffer.h"
class QgsVectorLayer;
class QgsVectorLayerUndoPassthroughCommand;
class QgsTransaction;
/**
* \ingroup core
* \class QgsVectorLayerEditPassthrough
*/
class CORE_EXPORT QgsVectorLayerEditPassthrough : public QgsVectorLayerEditBuffer
{
Q_OBJECT
public:
QgsVectorLayerEditPassthrough( QgsVectorLayer *layer );
bool isModified() const override;
bool addFeature( QgsFeature &f ) override;
bool addFeatures( QgsFeatureList &features ) override;
bool deleteFeature( QgsFeatureId fid ) override;
bool deleteFeatures( const QgsFeatureIds &fids ) override;
bool changeGeometry( QgsFeatureId fid, const QgsGeometry &geom ) override;
bool changeAttributeValue( QgsFeatureId fid, int field, const QVariant &newValue, const QVariant &oldValue = QVariant() ) override;
bool addAttribute( const QgsField &field ) override;
bool deleteAttribute( int attr ) override;
bool renameAttribute( int attr, const QString &newName ) override;
bool commitChanges( QStringList &commitErrors ) override;
void rollBack() override;
/**
* Update underlying data with a SQL query embedded in a transaction.
*
* \param transaction Transaction in which the sql query has been run
* \param sql The SQL query updating data
*
* \returns true if the undo/redo command is well added to the stack, false otherwise
*
* \since QGIS 3.0
*/
bool update( QgsTransaction *transaction, const QString &sql );
private:
bool mModified;
// utility function to avoid cpy/paste
bool modify( QgsVectorLayerUndoPassthroughCommand *cmd );
};
#endif // QGSVECTORLAYEREDITPASSTHROUGH_H