karbon
VVisitor Class Reference
#include <vvisitor.h>
Inheritance diagram for VVisitor:

Detailed Description
The abstract visitor class.(From Wikipedia)
In object-oriented programming and software engineering, the visitor design pattern is a way of separating an algorithm from an object structure. A practical result of this separation is the ability to add new operations to existing object structures without modifying those structures.
The idea is to use a structure of element classes, each of which has an accept method that takes a visitor object as an argument. The visitor is an interface that has a different visit() method for each element class. The accept() method of an element class calls back the visit() method for its class. Separate concrete visitor classes can then be written that perform some particular operations.
One of these visit() methods of a concrete visitor can be thought of as methods not of a single class, but rather methods of a pair of classes: the concrete visitor and the particular element class. Thus the visitor pattern simulates double dispatch in a conventional single-dispatch object-oriented language such as Java, Smalltalk, and C++.
The visitor pattern also specifies how iteration occurs over the object structure. In the simplest version, where each algorithm needs to iterate in the same way, the accept() method of a container element, in addition to calling back the visit() method of the visitor, also passes the visitor object to the accept() method of all its constituent child elements.
Because the Visitor object has one principal function (manifested in a plurality of specialized methods) and that function is called visit(), the Visitor can be readily identified as a potential function object or functor. Likewise, the accept() function can be identified as a function applicator, a mapper, which knows how to traverse a particular type of object and apply a function to its elements.
Definition at line 50 of file vvisitor.h.
Public Member Functions | |
VVisitor () | |
virtual bool | visit (VObject &object) |
virtual void | visitVObject (VObject &object) |
virtual void | visitVPath (VPath &composite) |
virtual void | visitVDocument (VDocument &document) |
virtual void | visitVGroup (VGroup &group) |
virtual void | visitVLayer (VLayer &layer) |
virtual void | visitVSubpath (VSubpath &path) |
virtual void | visitVSelection (VSelection &selection) |
virtual void | visitVText (VText &text) |
virtual void | visitVImage (VImage &img) |
bool | success () const |
Protected Member Functions | |
virtual | ~VVisitor () |
void | setSuccess (bool success=true) |
Constructor & Destructor Documentation
|
Constructs a new visitor class.
Definition at line 56 of file vvisitor.h. |
|
Destructs a visitor class.
Definition at line 137 of file vvisitor.h. |
Member Function Documentation
|
Set the success property.
Definition at line 142 of file vvisitor.h. |
|
Return if the operation was a success or not.
Definition at line 125 of file vvisitor.h. |
|
General visit method. Pass an object to this function. This is a virtual function so you need to implement it in the subclass if you want to use it. Return the success value. Reimplemented in VBooleanCmd. Definition at line 31 of file vvisitor.cc. |
|
Visit method for a VDocument. Pass a document to this function. This is a virtual function so you need to implement it in the subclass if you want to use it. Reimplemented in VTextTool. Definition at line 41 of file vvisitor.cc. |
|
Visit method for a VGroup. Pass a group of objects to this function. This is a virtual function so you need to implement it in the subclass if you want to use it. Reimplemented in VFillCmd, VTextTool, VSelectionDescription, and VSelectObjects. Definition at line 52 of file vvisitor.cc. |
|
Visit method for a VImage. Pass an image to this function. This is a virtual function so you need to implement it in the subclass if you want to use it. Reimplemented in VTransformCmd, VSelectionDescription, and VSelectObjects. Definition at line 107 of file vvisitor.cc. |
|
Visit method for a VLayer. Pass a layer to this function. This is a virtual function so you need to implement it in the subclass if you want to use it. Reimplemented in VCleanUpCmd, VTextTool, VSelectNodes, VTestNodes, and VSelectObjects. Definition at line 63 of file vvisitor.cc. |
|
Visit method for a VObject. Pass an object to this function. This is a virtual function so you need to implement it in the subclass if you want to use it. Reimplemented in VTransformCmd. Definition at line 112 of file vvisitor.cc. |
|
Visit method for a VPath. Pass a composite path to this function. This is a virtual function so you need to implement it in the subclass if you want to use it. Reimplemented in VFillCmd, VTransformCmd, VWhirlPinchCmd, VTextTool, VDrawSelection, VSelectionDescription, and VSelectObjects. Definition at line 74 of file vvisitor.cc. |
|
Visit method for a VSelection. Pass a selection to this function. This is a virtual function so you need to implement it in the subclass if you want to use it. Reimplemented in VSelectionDescription. Definition at line 91 of file vvisitor.cc. |
|
Visit method for a VSubpath. Pass a path to this function. This is a virtual function so you need to implement it in the subclass if you want to use it. Reimplemented in VBooleanCmd, VClosePathCmd, VDeleteNodeCmd, VFlattenCmd, VTransformCmd, VTranslateBezierCmd, VTranslatePointCmd, PathRenderer, VInsertKnotsCmd, VRoundCornersCmd, VWhirlPinchCmd, VTextTool, VSelectNodes, VTestNodes, and VTransformNodes. Definition at line 86 of file vvisitor.cc. |
|
Visit method for a VText. Pass some text to this function. This is a virtual function so you need to implement it in the subclass if you want to use it. Reimplemented in VFillCmd, VTransformCmd, VTextTool, VSelectionDescription, and VSelectObjects. Definition at line 102 of file vvisitor.cc. |
The documentation for this class was generated from the following files: