tConfItem_key Class Reference

Inheritance diagram for tConfItem_key:

Inheritance graph
[legend]
Collaboration diagram for tConfItem_key:

Collaboration graph
[legend]

List of all members.

Public Member Functions

 tConfItem_key ()
 ~tConfItem_key ()
virtual void WriteVal (std::ostream &s)
virtual void ReadVal (std::istream &s)


Detailed Description

Definition at line 277 of file uInput.cpp.


Constructor & Destructor Documentation

tConfItem_key::tConfItem_key (  )  [inline]

Definition at line 279 of file uInput.cpp.

00279 :
    tConfItem_key():tConfItemBase("KEYBOARD"){}

tConfItem_key::~tConfItem_key (  )  [inline]

Definition at line 280 of file uInput.cpp.

00280 :tConfItemBase("KEYBOARD"){}


Member Function Documentation

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

Implements tConfItemBase.

Definition at line 283 of file uInput.cpp.

References su_inputs.

00284                                         {
00285         int first=1;
00286         for ( uInputs::const_iterator i = su_inputs.begin(); i != su_inputs.end(); ++i )
00287         {
00288             if ( !(*i)->GetBind() )
00289                 continue;
00290 
00291             std::string const & id = (*i)->PersistentID();
00292 
00293             if (!first)
00294                 s << "\nKEYBOARD\t";
00295             else
00296                 first=0;
00297 
00298             s << id << '\t';
00299             (*i)->GetBind()->Write(s);
00300         }
00301         if (first)
00302             s << "-1";

virtual void tConfItem_key::ReadVal ( std::istream &  s  )  [inline, virtual]

Implements tConfItemBase.

Definition at line 305 of file uInput.cpp.

References c, in, uBindPlayer::IsKeyWord(), uBindPlayer::NewBind(), uInput::SetBind(), su_GetInput(), su_inputs, su_NewInput(), and tASSERT.

00307     {
00308         tString in;
00309         std::string id;
00310         s >> id;
00311         if ( id != "-1" )
00312         {
00313             // try to fetch the uInput belonging to the id
00314             uInput * input = su_GetInput( id );
00315 
00316             if ( !input )
00317             {
00318                 // if the id is a number, the setting is in a legacy format.
00319                 std::istringstream readValue( id );
00320                 int value = -1;
00321                 readValue >> value;
00322 
00323                 if ( value >= 0 && value < (int)su_inputs.size() )
00324                 {
00325                     input = su_inputs[ value ];
00326                 }
00327             }
00328 
00329             if ( !input )
00330             {
00331                 input = su_NewInput( id, tString("") );
00332             }
00333 
00334             tASSERT( input );
00335 
00336             s >> in;
00337             if (uBindPlayer::IsKeyWord(in))
00338             {
00339                 tJUST_CONTROLLED_PTR< uBind > bind = uBindPlayer::NewBind(s);
00340                 if ( bind->act )
00341                 {
00342                     input->SetBind( bind );
00343                 }
00344             }
00345         }
00346         char c=' ';
00347         while (c!='\n' && s.good() && !s.eof()) c=s.get();

Here is the call graph for this function:


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