proj home

Files   Classes   Functions   Hierarchy  

gobjSwitch< BOOL > Class Template Reference

If the switch is on draw the object else don't. More...

#include <gobjbase.h>

Inheritance diagram for gobjSwitch< BOOL >:
Collaboration diagram for gobjSwitch< BOOL >:

List of all members.

Public Member Functions

 gobjSwitch (gobj *x_, BOOL isdrawn_, boolc cleanup_=true)
 Pass the object, set the initial drawing state and memory policy.
 ~gobjSwitch ()
 Possible cleanup.
void draw ()
 Draws the object x if flag is true.
void toggle ()
 Toggle the isdrawn variable.

Public Attributes

gobjx
 The object that the switch is acting on.
BOOL isdrawn
 Is the object drawn when draw() is called?
bool cleanup
 Release x when this object dies.


Detailed Description

template<typename BOOL>
class gobjSwitch< BOOL >

If the switch is on draw the object else don't.

This class wraps a gobj in a switch so that the gobj can be displayed or not displayed depending on isdrawn's state.

The BOOL is designed to have either bool or bool & .

Definition at line 358 of file gobjbase.h.


Constructor & Destructor Documentation

template<typename BOOL>
gobjSwitch< BOOL >::gobjSwitch ( gobj x_,
BOOL  isdrawn_,
boolc  cleanup_ = true 
) [inline]

Pass the object, set the initial drawing state and memory policy.

If x_ is 0 this switch is in a unconstructed state.

Definition at line 374 of file gobjbase.h.

00379     : x(x_), isdrawn(isdrawn_), cleanup(cleanup_) 
00380     { }

template<typename BOOL>
gobjSwitch< BOOL >::~gobjSwitch (  )  [inline]

Possible cleanup.

Definition at line 383 of file gobjbase.h.

00384     { if (cleanup==false) return; delete x; x=0; }


Member Function Documentation

template<typename BOOL>
void gobjSwitch< BOOL >::draw (  )  [inline, virtual]

Draws the object x if flag is true.

Implements gobj.

Definition at line 387 of file gobjbase.h.

00388     { GOBJDEBUGCODE assert(x!=0); if (isdrawn) x->draw(); }

template<typename BOOL>
void gobjSwitch< BOOL >::toggle (  )  [inline]

Toggle the isdrawn variable.

Definition at line 391 of file gobjbase.h.

00392     { assert(x!=0); isdrawn = ! isdrawn; }


Member Data Documentation

template<typename BOOL>
bool gobjSwitch< BOOL >::cleanup

Release x when this object dies.

Definition at line 368 of file gobjbase.h.

Referenced by gobjSwitch< bool & >::~gobjSwitch().

template<typename BOOL>
BOOL gobjSwitch< BOOL >::isdrawn

template<typename BOOL>
gobj* gobjSwitch< BOOL >::x


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

Generated on Fri Mar 4 00:50:02 2011 for Chelton Evans Source by  doxygen 1.5.8