Represents a atomic transaction of the document. More...
#include <Transactions.h>
Public Member Functions | |
void | apply (Document &Doc, bool forward) |
apply the content to the document | |
virtual unsigned int | getMemSize (void) const |
This method is used to get the size of objects It is not meant to have the exact size, it is more or less an estimation which runs fast! Is it two bytes or a GB? | |
int | getPos (void) const |
get the position in the transaction history | |
virtual Base::Type | getTypeId (void) const |
virtual void | Restore (Base::XMLReader &reader) |
This method is used to restore properties from an XML document. | |
virtual void | Save (Base::Writer &writer) const |
This method is used to save properties to an XML document. | |
Transaction (int pos) | |
Construction. | |
Transaction () | |
Construction. | |
virtual | ~Transaction () |
Destruction. | |
Static Public Member Functions | |
static void * | create (void) |
static Base::Type | getClassTypeId (void) |
static void | init (void) |
Public Attributes | |
std::string | Name |
Protected Member Functions | |
void | addObjectChange (const DocumentObject *Obj, const Property *Prop) |
void | addObjectDel (const DocumentObject *Obj) |
void | addObjectNew (DocumentObject *Obj) |
Friends | |
class | Document |
Represents a atomic transaction of the document.
Definition at line 71 of file Transactions.h.
Transaction::Transaction | ( | ) |
Construction.
Definition at line 48 of file Transactions.cpp.
Transaction::Transaction | ( | int | pos | ) |
Construction.
Definition at line 53 of file Transactions.cpp.
Transaction::~Transaction | ( | ) | [virtual] |
Destruction.
A destructor.
A more elaborate description of the destructor.
Definition at line 62 of file Transactions.cpp.
References App::TransactionObject::New.
void Transaction::addObjectChange | ( | const DocumentObject * | Obj, | |
const Property * | Prop | |||
) | [protected] |
Definition at line 168 of file Transactions.cpp.
References App::TransactionObject::Chn, RobotExample::pos, App::TransactionObject::setProperty(), and App::TransactionObject::status.
Referenced by App::Document::onBeforeChangeProperty(), and App::Document::onChangedProperty().
void Transaction::addObjectDel | ( | const DocumentObject * | Obj | ) | [protected] |
Definition at line 148 of file Transactions.cpp.
References App::TransactionObject::Chn, App::TransactionObject::Del, App::TransactionObject::New, RobotExample::pos, and App::TransactionObject::status.
Referenced by App::Document::_addObject(), App::Document::_remObject(), App::Document::addObject(), and App::Document::remObject().
void Transaction::addObjectNew | ( | DocumentObject * | Obj | ) | [protected] |
Definition at line 123 of file Transactions.cpp.
References App::TransactionObject::Del, App::DocumentObject::getNameInDocument(), App::TransactionObject::New, App::DocumentObject::pcNameInDocument, RobotExample::pos, and App::TransactionObject::status.
Referenced by App::Document::_addObject(), App::Document::_remObject(), App::Document::addObject(), and App::Document::remObject().
void Transaction::apply | ( | Document & | Doc, | |
bool | forward | |||
) |
apply the content to the document
Definition at line 110 of file Transactions.cpp.
Referenced by App::Document::abortTransaction().
void * App::Transaction::create | ( | void | ) | [static] |
Reimplemented from Base::Persistence.
Definition at line 43 of file Transactions.cpp.
Base::Type App::Transaction::getClassTypeId | ( | void | ) | [static] |
Reimplemented from Base::Persistence.
Definition at line 43 of file Transactions.cpp.
unsigned int Transaction::getMemSize | ( | void | ) | const [virtual] |
This method is used to get the size of objects It is not meant to have the exact size, it is more or less an estimation which runs fast! Is it two bytes or a GB?
Implements Base::Persistence.
Definition at line 85 of file Transactions.cpp.
int Transaction::getPos | ( | void | ) | const |
get the position in the transaction history
Definition at line 100 of file Transactions.cpp.
Base::Type App::Transaction::getTypeId | ( | void | ) | const [virtual] |
Reimplemented from Base::Persistence.
Definition at line 43 of file Transactions.cpp.
void App::Transaction::init | ( | void | ) | [static] |
Reimplemented from Base::Persistence.
Definition at line 43 of file Transactions.cpp.
void Transaction::Restore | ( | Base::XMLReader & | reader | ) | [virtual] |
This method is used to restore properties from an XML document.
Implements Base::Persistence.
Definition at line 95 of file Transactions.cpp.
void Transaction::Save | ( | Base::Writer & | ) | const [virtual] |
This method is used to save properties to an XML document.
A good example you'll find in PropertyStandard.cpp, e.g. the vector:
void PropertyVector::Save (Writer &writer) const { writer << writer.ind() << "<PropertyVector valueX=\"" << _cVec.x << "\" valueY=\"" << _cVec.y << "\" valueZ=\"" << _cVec.z <<"\"/>" << endl; }
The writer.ind() expression writes the indention, just for pretty printing of the XML. As you see, the writing of the XML document is not done with a DOM implementation because of performance reasons. Therefore the programmer has to take care that a valid XML document is written. This means closing tags and writing UTF-8.
Implements Base::Persistence.
Definition at line 90 of file Transactions.cpp.
friend class Document [friend] |
Definition at line 97 of file Transactions.h.
std::string App::Transaction::Name |
Definition at line 87 of file Transactions.h.
Referenced by App::Document::getAvailableUndoNames(), App::Document::openTransaction(), App::Document::redo(), and App::Document::undo().