QCAD Application Framework
CAD Application Development and Automation.
Main Page
Related Pages
Modules
Classes
Files
File List
File Members
All
Classes
Files
Functions
Variables
Typedefs
Enumerations
Enumerator
Properties
Friends
Macros
Groups
Pages
RTransaction.h
Go to the documentation of this file.
1
#ifndef RTRANSACTION_H
2
#define RTRANSACTION_H
3
4
#include <QList>
5
#include <QMap>
6
#include <QSet>
7
#include <QSharedPointer>
8
9
#include "
RObject.h
"
10
#include "
REntity.h
"
11
#include "
RPropertyTypeId.h
"
12
#include "
RPropertyChange.h
"
13
14
class
RStorage
;
15
class
RExporter
;
16
class
RDocument
;
17
18
#define RDEFAULT_QSET_RPROPERTYTYPEID QSet<RPropertyTypeId> ()
19
50
class
RTransaction
{
51
public
:
52
RTransaction
();
53
54
RTransaction
(
RStorage
&
storage
);
55
56
RTransaction
(
RStorage
& storage,
int
transactionId
,
const
QString&
text
,
57
const
QList<RObject::Id>&
affectedObjects
,
58
//const QSet<RObject::Id>& affectedEntities,
59
const
QMap<
RObject::Id
, QList<RPropertyChange> >&
propertyChanges
,
60
RTransaction
* parent = NULL);
61
62
RTransaction
(
RStorage
& storage,
const
QString& text,
bool
undoable
=
true
,
63
RTransaction
* parent = NULL);
64
65
virtual
~RTransaction
();
66
67
void
setRecordAffectedObjects
(
bool
on) {
68
recordAffectedObjects
= on;
69
}
70
71
void
setAllowAll
(
bool
on) {
72
allowAll
= on;
73
}
74
75
void
setAllowInvisible
(
bool
on) {
76
allowInvisible
= on;
77
}
78
79
void
setSpatialIndexDisabled
(
bool
on) {
80
spatialIndexDisabled
= on;
81
}
82
87
bool
isUndoable
() {
88
return
undoable
;
89
}
90
91
bool
isFailed
() {
92
return
failed
;
93
}
94
98
virtual
void
redo
(
RDocument
* objectContainer = NULL);
99
104
virtual
void
undo
(
RDocument
* objectContainer = NULL);
105
111
//virtual void preview(RExporter& /*exporter*/) const {}
112
113
void
end
();
114
115
void
updateOverwrittenBlockReferences
();
116
121
void
setId
(
int
id
) {
122
transactionId = id;
123
}
124
128
int
getId
() {
129
return
transactionId
;
130
}
131
135
QString
getText
() {
136
return
text
;
137
}
138
139
bool
overwriteBlock
(QSharedPointer<RBlock> block);
140
141
bool
addObject
(QSharedPointer<RObject> obj,
142
bool
useCurrentAttributes =
true
,
143
const
QSet<RPropertyTypeId>& modifiedPropertyTypeIds =
RDEFAULT_QSET_RPROPERTYTYPEID
);
144
145
void
addAffectedObject
(
RObject::Id
objectId);
146
void
addAffectedObjects
(
const
QSet<RObject::Id>& objectIds);
147
void
addAffectedObject
(QSharedPointer<RObject>
object
);
148
149
void
deleteObject
(
RObject::Id
objectId,
RDocument
* document);
150
void
deleteObject
(QSharedPointer<RObject>
object
,
RDocument
* document);
151
156
QList<RObject::Id>
getAffectedObjects
() {
157
return
affectedObjects
;
158
}
159
164
QSet<RObject::Id>
getStatusChanges
() {
165
return
statusChanges
;
166
}
167
168
QMap<RObject::Id, QList<RPropertyChange> >
getPropertyChanges
() {
169
return
propertyChanges
;
170
}
171
172
bool
hasOnlyChanges
() {
173
return
onlyChanges
;
174
}
175
176
void
fail
();
177
178
protected
:
179
bool
addPropertyChange
(
RObject::Id
objectId,
const
RPropertyChange
& propertyChange);
180
void
appendChild
(
RTransaction
& t);
181
182
void
commit
();
183
void
rollback
();
184
185
protected
:
189
RStorage
*
storage
;
190
194
int
transactionId
;
195
199
QString
text
;
200
204
QList<RObject::Id>
affectedObjects
;
205
209
QList<RObject::Id>
overwrittenBlockReferences
;
210
216
QMap<RObject::Id, QList<RPropertyChange> >
propertyChanges
;
217
222
QSet<RObject::Id>
statusChanges
;
223
227
QList<RTransaction>
childTransactions
;
228
232
bool
undoable
;
233
237
bool
failed
;
238
242
bool
onlyChanges
;
243
248
bool
recordAffectedObjects
;
249
254
bool
allowAll
;
255
261
bool
allowInvisible
;
262
267
bool
spatialIndexDisabled
;
268
};
269
270
QDebug
operator<<
(QDebug dbg,
RTransaction
& t);
271
272
Q_DECLARE_METATYPE
(
RTransaction
)
273
Q_DECLARE_METATYPE
(
RTransaction
*)
274
275
#endif
src
core
RTransaction.h
Generated on Tue Jun 26 2012 18:41:07 for QCAD Application Framework by
1.8.1.1