/usr/include/qgis/qgsvectorlayerundocommand.h is in libqgis-dev 2.18.17+dfsg-1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
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 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 | /***************************************************************************
qgsvectorlayerundocommand.h
---------------------
begin : June 2009
copyright : (C) 2009 by Martin Dobias
email : wonder dot sk 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 QGSVECTORLAYERUNDOCOMMAND_H
#define QGSVECTORLAYERUNDOCOMMAND_H
#include <QUndoCommand>
#include <QVariant>
#include <QSet>
#include <QList>
#include "qgsfield.h"
#include "qgsfeature.h"
class QgsGeometry;
class QgsGeometryCache;
#include "qgsvectorlayer.h"
#include "qgsvectorlayereditbuffer.h"
/** \ingroup core
* \class QgsVectorLayerUndoCommand
* \brief Base class for undo commands within a QgsVectorLayerEditBuffer.
*/
class CORE_EXPORT QgsVectorLayerUndoCommand : public QUndoCommand
{
public:
/** Constructor for QgsVectorLayerUndoCommand
* @param buffer associated edit buffer
*/
QgsVectorLayerUndoCommand( QgsVectorLayerEditBuffer *buffer )
: QUndoCommand()
, mBuffer( buffer )
{}
//! Returns the layer associated with the undo command
inline QgsVectorLayer *layer() { return mBuffer->L; }
inline QgsGeometryCache *cache() { return mBuffer->L->cache(); }
virtual int id() const override { return -1; }
virtual bool mergeWith( const QUndoCommand * ) override { return false; }
protected:
//! Associated edit buffer
QgsVectorLayerEditBuffer* mBuffer;
};
/** \ingroup core
* \class QgsVectorLayerUndoCommandAddFeature
* \brief Undo command for adding a feature to a vector layer.
*/
class CORE_EXPORT QgsVectorLayerUndoCommandAddFeature : public QgsVectorLayerUndoCommand
{
public:
/** Constructor for QgsVectorLayerUndoCommandAddFeature
* @param buffer associated edit buffer
* @param f feature to add to layer
*/
QgsVectorLayerUndoCommandAddFeature( QgsVectorLayerEditBuffer* buffer, QgsFeature& f );
virtual void undo() override;
virtual void redo() override;
private:
QgsFeature mFeature;
};
/** \ingroup core
* \class QgsVectorLayerUndoCommandDeleteFeature
* \brief Undo command for deleting a feature from a vector layer.
*/
class CORE_EXPORT QgsVectorLayerUndoCommandDeleteFeature : public QgsVectorLayerUndoCommand
{
public:
/** Constructor for QgsVectorLayerUndoCommandDeleteFeature
* @param buffer associated edit buffer
* @param fid feature ID of feature to delete from layer
*/
QgsVectorLayerUndoCommandDeleteFeature( QgsVectorLayerEditBuffer* buffer, QgsFeatureId fid );
virtual void undo() override;
virtual void redo() override;
private:
QgsFeatureId mFid;
QgsFeature mOldAddedFeature;
};
/** \ingroup core
* \class QgsVectorLayerUndoCommandChangeGeometry
* \brief Undo command for modifying the geometry of a feature from a vector layer.
*/
class CORE_EXPORT QgsVectorLayerUndoCommandChangeGeometry : public QgsVectorLayerUndoCommand
{
public:
/** Constructor for QgsVectorLayerUndoCommandChangeGeometry
* @param buffer associated edit buffer
* @param fid feature ID of feature to modify geometry of
* @param newGeom new geometry for feature
*/
QgsVectorLayerUndoCommandChangeGeometry( QgsVectorLayerEditBuffer* buffer, QgsFeatureId fid, QgsGeometry* newGeom );
~QgsVectorLayerUndoCommandChangeGeometry();
virtual void undo() override;
virtual void redo() override;
virtual int id() const override;
virtual bool mergeWith( const QUndoCommand * ) override;
private:
QgsFeatureId mFid;
QgsGeometry* mOldGeom;
mutable QgsGeometry* mNewGeom;
};
/** \ingroup core
* \class QgsVectorLayerUndoCommandChangeAttribute
* \brief Undo command for modifying an attribute of a feature from a vector layer.
*/
class CORE_EXPORT QgsVectorLayerUndoCommandChangeAttribute : public QgsVectorLayerUndoCommand
{
public:
/** Constructor for QgsVectorLayerUndoCommandChangeAttribute
* @param buffer associated edit buffer
* @param fid feature ID of feature to modify
* @param fieldIndex index of field to modify
* @param newValue new value of attribute
* @param oldValue previous value of attribute
*/
QgsVectorLayerUndoCommandChangeAttribute( QgsVectorLayerEditBuffer* buffer, QgsFeatureId fid, int fieldIndex, const QVariant &newValue, const QVariant &oldValue );
virtual void undo() override;
virtual void redo() override;
private:
QgsFeatureId mFid;
int mFieldIndex;
QVariant mOldValue;
QVariant mNewValue;
bool mFirstChange;
};
/** \ingroup core
* \class QgsVectorLayerUndoCommandAddAttribute
* \brief Undo command for adding a new attribute to a vector layer.
*/
class CORE_EXPORT QgsVectorLayerUndoCommandAddAttribute : public QgsVectorLayerUndoCommand
{
public:
/** Constructor for QgsVectorLayerUndoCommandAddAttribute
* @param buffer associated edit buffer
* @param field definition of new field to add
*/
QgsVectorLayerUndoCommandAddAttribute( QgsVectorLayerEditBuffer* buffer, const QgsField& field );
virtual void undo() override;
virtual void redo() override;
private:
QgsField mField;
int mFieldIndex;
};
/** \ingroup core
* \class QgsVectorLayerUndoCommandDeleteAttribute
* \brief Undo command for removing an existing attribute from a vector layer.
*/
class CORE_EXPORT QgsVectorLayerUndoCommandDeleteAttribute : public QgsVectorLayerUndoCommand
{
public:
/** Constructor for QgsVectorLayerUndoCommandDeleteAttribute
* @param buffer associated edit buffer
* @param fieldIndex index of field to delete
*/
QgsVectorLayerUndoCommandDeleteAttribute( QgsVectorLayerEditBuffer* buffer, int fieldIndex );
virtual void undo() override;
virtual void redo() override;
private:
int mFieldIndex;
bool mProviderField;
int mOriginIndex;
QgsField mOldField;
QgsEditorWidgetConfig mOldEditorWidgetConfig;
QMap<QgsFeatureId, QVariant> mDeletedValues;
QString mOldName;
};
/** \ingroup core
* \class QgsVectorLayerUndoCommandRenameAttribute
* \brief Undo command for renaming an existing attribute of a vector layer.
* \note added in QGIS 2.16
*/
class CORE_EXPORT QgsVectorLayerUndoCommandRenameAttribute : public QgsVectorLayerUndoCommand
{
public:
/** Constructor for QgsVectorLayerUndoCommandRenameAttribute
* @param buffer associated edit buffer
* @param fieldIndex index of field to rename
* @param newName new name for field
*/
QgsVectorLayerUndoCommandRenameAttribute( QgsVectorLayerEditBuffer* buffer, int fieldIndex, const QString& newName );
virtual void undo() override;
virtual void redo() override;
private:
int mFieldIndex;
QString mOldName;
QString mNewName;
};
#endif
|