Inkscape
Vector Graphics Editor
Loading...
Searching...
No Matches
Inkscape::XML::Event Class Referenceabstract

Enumeration of all XML event types. More...

#include <event.h>

Inheritance diagram for Inkscape::XML::Event:
Inkscape::GC::Managed< Inkscape::GC::SCANNED, Inkscape::GC::MANUAL > Inkscape::XML::EventAdd Inkscape::XML::EventChgAttr Inkscape::XML::EventChgContent Inkscape::XML::EventChgElementName Inkscape::XML::EventChgOrder Inkscape::XML::EventDel

Classes

struct  IteratorStrategy
 

Public Types

typedef Inkscape::Util::ForwardPointerIterator< Event, IteratorStrategyIterator
 
typedef Inkscape::Util::ForwardPointerIterator< Event const, IteratorStrategyConstIterator
 

Public Member Functions

virtual ~Event ()=default
 
EventoptimizeOne ()
 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.
 
- Public Member Functions inherited from Inkscape::GC::Managed< Inkscape::GC::SCANNED, Inkscape::GC::MANUAL >
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

Eventnext
 Pointer to the next event in the event chain.
 
int serial
 Serial number of the event, not used at the moment.
 
Noderepr
 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
 

Detailed Description

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.

Definition at line 51 of file event.h.

Member Typedef Documentation

◆ ConstIterator

◆ Iterator

Constructor & Destructor Documentation

◆ ~Event()

virtual Inkscape::XML::Event::~Event ( )
virtualdefault

◆ Event()

Inkscape::XML::Event::Event ( Node r,
Event n 
)
inlineprotected

Definition at line 110 of file event.h.

Member Function Documentation

◆ _optimizeOne()

◆ _replayOne()

virtual void Inkscape::XML::Event::_replayOne ( NodeObserver ) const
protectedpure virtual

◆ _undoOne()

virtual void Inkscape::XML::Event::_undoOne ( NodeObserver ) const
protectedpure virtual

◆ optimizeOne()

Event * Inkscape::XML::Event::optimizeOne ( )
inline

If possible, combine this event with the next to reduce memory use.

Returns
Pointer to the optimized event chain, which may have changed

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().

◆ replayOne()

void Inkscape::XML::Event::replayOne ( NodeObserver observer) const
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.

◆ undoOne()

void Inkscape::XML::Event::undoOne ( NodeObserver observer) const
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.

Member Data Documentation

◆ _next_serial

int Inkscape::XML::Event::_next_serial =0
staticprivate

Definition at line 118 of file event.h.

◆ next

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().

◆ repr

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().

◆ serial

int Inkscape::XML::Event::serial

Serial number of the event, not used at the moment.

Definition at line 67 of file event.h.


The documentation for this class was generated from the following files: