39#ifndef INCLUDED_DISTI_TRAVERSER_H
40#define INCLUDED_DISTI_TRAVERSER_H
63template<
class T,
class argType =
int,
class arg2Type =
int>
74 if(
dynamic_cast<T*
>( obj ) )
76 if( findThis ==
nullptr )
78 else if( findThis == obj )
82 if(
dynamic_cast<Group*
>( obj ) )
85 auto* grp =
dynamic_cast<Group*
>( obj );
86 for(
unsigned int i = 0; i < grp->Count(); ++i )
88 if(
Contained( ( *grp )[ i ], findThis ) )
105 for(
unsigned int i = 0; i < grp->
Count(); ++i )
107 T* specific =
dynamic_cast<T*
>( ( *grp )[ i ] );
110 if( findThis ==
nullptr )
112 else if( findThis == specific )
125 Group* newGrp =
nullptr;
128 for(
unsigned int i = 0; i < grp->
Count(); ++i )
130 T* specific =
dynamic_cast<T*
>( ( *grp )[ i ] );
134 newGrp =
new Group();
160 if(
dynamic_cast<T*
>( obj ) && n > 0 )
162 T* specific =
dynamic_cast<T*
>( obj );
166 else if(
dynamic_cast<Group*
>( obj ) )
169 auto* grp =
dynamic_cast<Group*
>( obj );
170 for(
unsigned int i = 0; i < grp->Count(); ++i )
189 if(
dynamic_cast<T*
>( obj ) )
191 T* specific =
dynamic_cast<T*
>( obj );
192 foundValue = specific->*variablePtr;
193 foundOne = Traverse::FOUND_EQUAL;
196 if(
dynamic_cast<Group*
>( obj ) )
199 auto* grp =
dynamic_cast<Group*
>( obj );
201 for(
unsigned int i = 0; i < grp->Count(); ++i )
204 if( result != Traverse::NOT_FOUND )
206 if( result == Traverse::FOUND_EQUAL )
208 if( tempVal == foundValue )
210 foundOne = Traverse::FOUND_EQUAL;
214 foundOne = Traverse::FOUND_NOT_EQUAL;
218 foundOne = Traverse::FOUND_NOT_EQUAL;
221 foundValue = tempVal;
236 bool foundOne =
false;
238 if(
dynamic_cast<T*
>( obj ) )
240 T* specific =
dynamic_cast<T*
>( obj );
241 ( specific->*method )();
245 if(
dynamic_cast<Group*
>( obj ) )
248 auto* grp =
dynamic_cast<Group*
>( obj );
249 for(
unsigned int i = 0; i < grp->Count(); ++i )
251 if(
Call( ( *grp )[ i ], method ) )
267 bool foundOne =
false;
269 if(
dynamic_cast<T*
>( obj ) )
271 T* specific =
dynamic_cast<T*
>( obj );
272 ( specific->*method )( arg1 );
276 if(
dynamic_cast<Group*
>( obj ) )
279 auto* grp =
dynamic_cast<Group*
>( obj );
280 for(
unsigned int i = 0; i < grp->Count(); ++i )
282 if(
Call( ( *grp )[ i ], method, arg1 ) )
299 bool foundOne =
false;
301 if(
dynamic_cast<T*
>( obj ) )
303 T* specific =
dynamic_cast<T*
>( obj );
304 ( specific->*method )( arg1, arg2 );
308 if(
dynamic_cast<Group*
>( obj ) )
311 auto* grp =
dynamic_cast<Group*
>( obj );
312 for(
unsigned int i = 0; i < grp->Count(); ++i )
314 if(
Call( ( *grp )[ i ], method, arg1, arg2 ) )
330 bool foundOne =
false;
332 if(
dynamic_cast<T*
>( obj ) )
334 T* specific =
dynamic_cast<T*
>( obj );
335 ( specific->*method )( arg1 );
339 if(
dynamic_cast<Group*
>( obj ) )
342 auto* grp =
dynamic_cast<Group*
>( obj );
343 for(
unsigned int i = 0; i < grp->Count(); ++i )
345 if(
Call( ( *grp )[ i ], method, arg1 ) )
365 argType rval = notFoundValue;
366 bool weFoundOne =
false;
369 if(
dynamic_cast<T*
>( obj ) )
371 T* specific =
dynamic_cast<T*
>( obj );
373 rval = ( specific->*method )();
377 if(
dynamic_cast<Group*
>( obj ) )
381 auto* grp =
dynamic_cast<Group*
>( obj );
382 for(
unsigned int i = 0; i < grp->Count(); ++i )
384 bool foundOneThisIndex;
385 temp =
ReturnCall( ( *grp )[ i ], method, notFoundValue, multipleValue, &foundOneThisIndex );
387 if( foundOneThisIndex )
395 rval = multipleValue;
411 *rvalFoundOne = weFoundOne;
430 if(
dynamic_cast<Group*
>( obj ) )
435 auto* grp =
dynamic_cast<Group*
>( obj );
436 for(
unsigned int i = 0; i < grp->Count(); ++i )
438 temp =
Call( ( *grp )[ i ], method, tempColor );
449 foundColor = tempColor;
455 if( foundColor != tempColor )
463 else if(
dynamic_cast<T*
>( obj ) )
465 T* specific =
dynamic_cast<T*
>( obj );
466 foundColor = ( specific->*method )();
Definition: gls_color.h:53
unsigned int Count() const
Definition: group.h:170
virtual void InsertObject(DisplayObject *obj, bool reparent=true, bool recalculateBoundingbox=true, int loc=-1)
Definition: traverser.h:65
static T * GetNth(DisplayObject *obj, const int n)
Definition: traverser.h:148
void(T::* void_CallMethod_void)()
Typedef for a function pointer with no arguments or return value.
Definition: traverser.h:228
static bool Call(DisplayObject *obj, void_CallMethod_argType method, const argType arg1)
Definition: traverser.h:265
static Group * AllMatchingNoChildren(Group *grp)
Definition: traverser.h:123
static int Call(DisplayObject *obj, GlsColor_CallMethod_void method, GlsColor &foundColor)
Definition: traverser.h:426
static bool Call(DisplayObject *obj, void_CallMethod_argTypeRef method, argType &arg1)
Definition: traverser.h:328
static T * GetNthRecurse(DisplayObject *obj, int &n)
Definition: traverser.h:158
static bool Call(DisplayObject *obj, void_CallMethod_argType_arg2Type method, argType arg1, arg2Type arg2)
Definition: traverser.h:297
argType(T::* argType_CallMethod_void)()
Typedef for a function pointer with no arguments, and has a return value.
Definition: traverser.h:352
GlsColor(T::* GlsColor_CallMethod_void)()
Typedef for a function pointer that has no arguments, and returns a GlsColor.
Definition: traverser.h:416
static bool Contained(DisplayObject *obj, DisplayObject *findThis=nullptr)
Definition: traverser.h:72
static argType ReturnCall(DisplayObject *obj, argType_CallMethod_void method, const argType notFoundValue=argType(0), const argType multipleValue=argType(-1), bool *rvalFoundOne=nullptr)
Definition: traverser.h:363
void(T::* void_CallMethod_argType)(argType)
Typedef for a function pointer taking one argument and no return value.
Definition: traverser.h:258
static bool Call(DisplayObject *obj, void_CallMethod_void method)
Definition: traverser.h:234
void(T::* void_CallMethod_argType_arg2Type)(argType, arg2Type)
Typedef for a function pointer taking two arguments and no return value.
Definition: traverser.h:289
void(T::* void_CallMethod_argTypeRef)(argType &)
Typedef for a function pointer taking one argument as a reference, no return value.
Definition: traverser.h:321
static bool ContainedNoChildren(Group *grp, DisplayObject *findThis=nullptr)
Definition: traverser.h:100
static Traverse::ResultEnum GetValue(DisplayObject *obj, argType T::*variablePtr, argType &foundValue)
Definition: traverser.h:185
The disti::DisplayObject class and global enumerations.
The Color class: Implements a 4 component RGBA color.
The disti::Group class. Implements groups of objects.
Definition: bmpimage.h:46
ResultEnum
Definition: traverser.h:54