a2dWalkerIOHandler Class Reference
[Algorithms on hierarchy in a2dDocumentFile IO]

Io handler to iterate through a a2dDocument. More...

#include <gen.h>

Inheritance diagram for a2dWalkerIOHandler:

Inheritance graph
[legend]
Collaboration diagram for a2dWalkerIOHandler:

Collaboration graph
[legend]

List of all members.

Public Member Functions

 a2dWalkerIOHandler ()
 constructor
 ~a2dWalkerIOHandler ()
 destructor
virtual void Initialize ()
 to initialize a walker class, default does nothing.
wxString GetErrorString ()
 get this when an error occured.
void SetStopWalking (bool stopWalking)
 to further recursion, e.g. in a2dObject::Walker()
bool GetStopWalking ()
 check for stop
void IncCurrentDepth ()
 Increment recursion depth.
void DecCurrentDepth ()
 Decrement recursion depth.
int GetCurrentDepth ()
 What is the current recursion depth.
void SetDepthFirst (bool depthFirst)
 set if walker needs to go into recursive objects first.
bool GetDepthFirst ()
 What is the current recursion depth.
void SetUseCheck (bool useCheck)
 set if walker needs to check objects for a2dObject::m_check set, before walking into it
bool GetUseCheck ()
 see SetUseCheck
void Register (const wxString &classname, a2dObjectIOFn *IOfunc)
 to register a function to handle a class
void Unregister (const wxString &classname)
 to Un-register a function to handle a class
virtual bool WalkTask (wxObject *parent, wxObject *object, a2dWalkEvent event)
 called from within a2dObject's and derived classes
wxObject * GetParent ()
bool GetResult ()
 depending upon derived class implementation.

Protected Attributes

bool m_result
 result of walk, set false at start, use at will.
wxObject * m_currentParent
 parent object of current object
wxString m_error
 to store errors
bool m_stopWalking
 quit the iteration
int m_currentDepth
 contour to be used by algorithm, to decide on how deep recursing is to be.
bool m_depthFirst
bool m_useCheck
 if set a2dObject are only walked if not m_check is set
a2dIOHandlerCoupleHash m_register
 coupling function to event and classname


Detailed Description

Io handler to iterate through a a2dDocument.

It can be used in combination with a file for reading or writing.

Calling a2dObject::Walker( a2dWalkerIOHandler& handler ), will have the a2dObject start calling the function WalkTask() at predifined moments. The a2dCanvasObject will also recursively go into its children. While a2dPropObject goes into its properties. In a derived class you can define what needs to happen in each WalkTask().

This makes it possible to write algorithm on a a2dDocument, without extending the a2dObject derived classes itself. For instance calculating the area occupied by all a2dCanvasObject, can be implemented with this class.

The default WalkTask() function, checks if a function is registrated for the specific class, and if so calls that function.

Definition at line 3255 of file gen.h.


Member Function Documentation

bool a2dWalkerIOHandler::WalkTask ( wxObject *  parent,
wxObject *  object,
a2dWalkEvent  event 
) [virtual]

wxObject* a2dWalkerIOHandler::GetParent (  )  [inline]

if set by walker in WalkTask(), it can be used in child object to get to the parent via the a2dWalkerIOHandler, which is the argument to a child member function.

Definition at line 3313 of file gen.h.


Member Data Documentation

if true objects with nested objects should be walked first. it is the object to test this flag and if set, search for nested objects to walk first.

Definition at line 3337 of file gen.h.


The documentation for this class was generated from the following files:
a2dWalkerIOHandler Class Reference -- Tue Aug 31 18:37:49 2010 -- 31 Aug 2010 -- 1.5.5 -- wxArt2D -- . -- Main Page Reference Documentation