tSettingRotation Class Reference

Inheritance diagram for tSettingRotation:

Inheritance graph
[legend]
Collaboration diagram for tSettingRotation:

Collaboration graph
[legend]

List of all members.

Public Member Functions

 tSettingRotation (char const *name)
int Size () const
tString const & Current () const
void Rotate ()

Private Member Functions

virtual void ReadVal (std::istream &is)
virtual void WriteVal (std::ostream &s)
virtual bool Writable ()
virtual bool Save ()

Private Attributes

tArray< tStringitems_
int current_


Detailed Description

Definition at line 167 of file gGame.cpp.


Constructor & Destructor Documentation

tSettingRotation::tSettingRotation ( char const *  name  )  [inline]

Definition at line 170 of file gGame.cpp.

00171     : tConfItemBase( name ),
00172       current_(0)
00173     {
00174     }


Member Function Documentation

int tSettingRotation::Size ( void   )  const [inline]

Definition at line 177 of file gGame.cpp.

References items_, and GrowingArrayBase::Len().

Referenced by Current().

00178     {
00179         return items_.Len();
00180     }

Here is the call graph for this function:

Here is the caller graph for this function:

tString const& tSettingRotation::Current ( void   )  const [inline]

Definition at line 183 of file gGame.cpp.

References current_, items_, Size(), and tASSERT.

00184     {
00185         tASSERT( Size() > 0 && current_ >= 0 && current_ < Size() );
00186 
00187         return items_[current_];
00188     }

Here is the call graph for this function:

void tSettingRotation::Rotate (  )  [inline]

Definition at line 191 of file gGame.cpp.

References current_, items_, and GrowingArrayBase::Len().

00192     {
00193         if ( ++current_ >= items_.Len() )
00194         {
00195             current_ = 0;
00196         }
00197     }

Here is the call graph for this function:

virtual void tSettingRotation::ReadVal ( std::istream &  is  )  [inline, private, virtual]

Implements tConfItemBase.

Definition at line 199 of file gGame.cpp.

References current_, tArray< T, MALLOC >::Insert(), items_, GrowingArrayBase::Len(), tString::ReadLine(), tArray< T, MALLOC >::SetLen(), tString::StrPos(), and tString::SubStr().

00200     {
00201         tString mapsT;
00202         mapsT.ReadLine (is);
00203         items_.SetLen (0);
00204         
00205         int strpos = 0;
00206         int nextsemicolon = mapsT.StrPos(";");
00207         
00208         if (nextsemicolon != -1)
00209         {
00210             do
00211             {
00212                 tString const &map = mapsT.SubStr(strpos, nextsemicolon - strpos);
00213                 
00214                 strpos = nextsemicolon + 1;
00215                 nextsemicolon = mapsT.StrPos(strpos, ";");
00216                 
00217                 items_.Insert(map);
00218             }
00219             while ((nextsemicolon = mapsT.StrPos(strpos, ";")) != -1);
00220         }
00221 
00222         // make sure the current value is correct
00223         if ( current_ >= items_.Len() )
00224         {
00225             current_ = 0;
00226         }
00227     }

Here is the call graph for this function:

virtual void tSettingRotation::WriteVal ( std::ostream &  s  )  [inline, private, virtual]

Implements tConfItemBase.

Definition at line 229 of file gGame.cpp.

00229 {}

virtual bool tSettingRotation::Writable ( void   )  [inline, private, virtual]

Reimplemented from tConfItemBase.

Definition at line 230 of file gGame.cpp.

00230 {return false;}

virtual bool tSettingRotation::Save (  )  [inline, private, virtual]

Reimplemented from tConfItemBase.

Definition at line 231 of file gGame.cpp.

00231 {return false;}


Member Data Documentation

tArray<tString> tSettingRotation::items_ [private]

Definition at line 233 of file gGame.cpp.

Referenced by Current(), ReadVal(), Rotate(), and Size().

int tSettingRotation::current_ [private]

Definition at line 234 of file gGame.cpp.

Referenced by Current(), ReadVal(), and Rotate().


The documentation for this class was generated from the following file:
Generated on Sat Mar 15 23:59:14 2008 for Armagetron Advanced by  doxygen 1.5.4