Inkscape
Vector Graphics Editor
|
Enumeration of all XML event types. More...
#include <event.h>
Classes | |
struct | IteratorStrategy |
Public Types | |
typedef Inkscape::Util::ForwardPointerIterator< Event, IteratorStrategy > | Iterator |
typedef Inkscape::Util::ForwardPointerIterator< Event const, IteratorStrategy > | ConstIterator |
Public Member Functions | |
virtual | ~Event ()=default |
Event * | optimizeOne () |
If possible, combine this event with the next to reduce memory use. | |
void | undoOne (NodeObserver &observer) const |
Undo this event to an observer. | |
void | replayOne (NodeObserver &observer) const |
Replay this event to an observer. | |
![]() | |
void * | operator new (std::size_t size, ScanPolicy scan=default_scan, CollectionPolicy collect=default_collect) |
void * | operator new[] (std::size_t size, ScanPolicy scan=default_scan, CollectionPolicy collect=default_collect) |
void | operator delete (void *p) |
Public Attributes | |
Event * | next |
Pointer to the next event in the event chain. | |
int | serial |
Serial number of the event, not used at the moment. | |
Node * | repr |
Pointer to the node that was the object of the event. | |
Protected Member Functions | |
Event (Node *r, Event *n) | |
virtual Event * | _optimizeOne ()=0 |
virtual void | _undoOne (NodeObserver &) const =0 |
virtual void | _replayOne (NodeObserver &) const =0 |
Static Private Attributes | |
static int | _next_serial =0 |
Enumeration of all XML event types.
Generic XML modification event
This is the base class for all other modification events. It is actually a singly-linked list of events, called an event chain or an event log. Logs of events that happened in a transaction can be obtained from Document::commitUndoable(). Events can be replayed to a NodeObserver, or undone (which is equivalent to replaying opposite events in reverse order).
Event logs are built by appending to the front, so by walking the list one iterates over the events in reverse chronological order.
|
virtualdefault |
|
protectedpure virtual |
Implemented in Inkscape::XML::EventAdd, Inkscape::XML::EventDel, Inkscape::XML::EventChgAttr, Inkscape::XML::EventChgContent, Inkscape::XML::EventChgOrder, and Inkscape::XML::EventChgElementName.
Referenced by optimizeOne().
|
protectedpure virtual |
Implemented in Inkscape::XML::EventAdd, Inkscape::XML::EventDel, Inkscape::XML::EventChgAttr, Inkscape::XML::EventChgContent, Inkscape::XML::EventChgOrder, and Inkscape::XML::EventChgElementName.
Referenced by replayOne().
|
protectedpure virtual |
Implemented in Inkscape::XML::EventAdd, Inkscape::XML::EventDel, Inkscape::XML::EventChgAttr, Inkscape::XML::EventChgContent, Inkscape::XML::EventChgOrder, and Inkscape::XML::EventChgElementName.
Referenced by undoOne().
|
inline |
If possible, combine this event with the next to reduce memory use.
Definition at line 90 of file event.h.
References _optimizeOne().
Referenced by Inkscape::XML::LogBuilder::addChild(), Inkscape::XML::LogBuilder::removeChild(), Inkscape::XML::LogBuilder::setAttribute(), Inkscape::XML::LogBuilder::setChildOrder(), Inkscape::XML::LogBuilder::setContent(), Inkscape::XML::LogBuilder::setElementName(), and sp_repr_coalesce_log().
|
inline |
Replay this event to an observer.
This method notifies the specified event of the same action that it describes.
Definition at line 105 of file event.h.
References _replayOne(), and observer.
|
inline |
Undo this event to an observer.
This method notifies the specified observer of an action opposite to the one that is described by this event.
Definition at line 97 of file event.h.
References _undoOne(), and observer.
Event* Inkscape::XML::Event::next |
Pointer to the next event in the event chain.
Note that the event this pointer points to actually happened before this event. This is because the event log is built by appending to the front.
Definition at line 63 of file event.h.
Referenced by Inkscape::XML::EventChgAttr::_optimizeOne(), Inkscape::XML::EventChgContent::_optimizeOne(), Inkscape::XML::EventChgOrder::_optimizeOne(), Inkscape::XML::Event::IteratorStrategy::next(), sp_repr_coalesce_log(), sp_repr_free_log(), and Inkscape::XML::undo_log_to_observer().
Node* Inkscape::XML::Event::repr |
Pointer to the node that was the object of the event.
Because the nodes are garbage-collected, this pointer guarantees that the node will stay in memory as long as the event does. This simplifies rolling back extensive deletions.
Definition at line 75 of file event.h.
Referenced by Inkscape::XML::EventChgAttr::_optimizeOne(), Inkscape::XML::EventChgContent::_optimizeOne(), Inkscape::XML::EventChgOrder::_optimizeOne(), and Inkscape::XML::EventAdd::_undoOne().
int Inkscape::XML::Event::serial |