Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 5784 in orxonox.OLD for trunk


Ignore:
Timestamp:
Nov 26, 2005, 8:48:11 PM (19 years ago)
Author:
bensch
Message:

orxonox/trunk: shell without tList now

Location:
trunk/src/lib/shell
Files:
6 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/lib/shell/shell.h

    r5781 r5784  
    2323class ShellInput;
    2424class Material;
    25 template<class T> class tIterator;
    2625
    2726//! A class that is able to redirect all output to a openGL-Shell, and that one can use to input some commands
  • trunk/src/lib/shell/shell_buffer.h

    r5781 r5784  
    1515// FORWARD DECLARATION
    1616class Shell;
    17 template<class T> class tList;
     17
    1818#ifndef NULL
    1919#define NULL 0            //!< a pointer to NULL
  • trunk/src/lib/shell/shell_command.h

    r5779 r5784  
    1717
    1818// FORWARD DECLARATION
    19 template<class T> class tList;
    2019class ShellCommandClass;
    2120class ShellCommandAlias;
  • trunk/src/lib/shell/shell_completion.h

    r5780 r5784  
    1515class BaseObject;
    1616class ShellInput;
    17 template<class T> class tList;
    1817#ifndef NULL
    1918#define NULL 0            //!< a pointer to NULL
  • trunk/src/lib/shell/shell_input.cc

    r5639 r5784  
    4949  this->inputLine = new char[1];
    5050  this->inputLine[0] = '\0';
    51   this->history = new tList<char>;
    52   this->historyIT = this->history->getIterator();
     51  this->historyIT = this->history.begin();
    5352  this->setHistoryLength(50);
    5453  this->historyScrolling = false;
     
    7574  delete this->completion;
    7675
    77   char* histEl = this->historyIT->firstElement();
    78   while (histEl != NULL)
    79   {
    80     delete[] histEl;
    81     histEl = this->historyIT->nextElement();
    82   }
    83   delete this->historyIT;
    84   delete this->history;
     76  while (!this->history.empty())
     77  {
     78    delete[] this->history.front();
     79    this->history.pop_front();
     80  }
    8581}
    8682
     
    139135  if (this->historyScrolling)
    140136  {
    141     delete[] this->history->lastElement();
    142     this->history->remove(this->history->lastElement());
     137    delete[] this->history.back();
     138    this->history.pop_back();
    143139    this->historyScrolling = false;
    144140  }
     
    160156  if (this->historyScrolling)
    161157  {
    162     delete[] this->history->lastElement();
    163     this->history->remove(this->history->lastElement());
     158    delete[] this->history.back();
     159    this->history.pop_back();
    164160    this->historyScrolling = false;
    165161  }
     
    181177  if (this->historyScrolling)
    182178  {
    183     delete[] this->history->lastElement();
    184     this->history->remove(this->history->lastElement());
     179    delete[] this->history.back();
     180    this->history.pop_back();
    185181    this->historyScrolling = false;
    186182  }
     
    220216  if (this->historyScrolling)
    221217  {
    222     delete[] this->history->lastElement();
    223     this->history->remove(this->history->lastElement());
     218    delete[] this->history.back();
     219    this->history.pop_back();
    224220    this->historyScrolling = false;
    225221  }
    226222
    227223  // adding the new Command to the History
    228   this->history->add(newCommand);
    229   if (this->history->getSize() > this->historyLength)
    230   {
    231     delete[] this->history->firstElement();
    232     this->history->remove(this->history->firstElement());
     224  this->history.push_back(newCommand);
     225  if (this->history.size() > this->historyLength)
     226  {
     227    delete[] this->history.front();
     228    this->history.pop_front();
    233229  }
    234230
     
    248244    char* currentText = new char[strlen(this->inputLine)+1];
    249245    strcpy(currentText, this->inputLine);
    250     this->history->add(currentText);
     246    this->history.push_back(currentText);
    251247    this->historyScrolling = true;
    252     this->historyIT->lastElement();
    253   }
    254 
    255   char* prevElem = this->historyIT->prevStep();
     248    this->historyIT = this->history.end();
     249  }
     250
     251  char* prevElem = *(this->historyIT--);
    256252  if (prevElem == NULL)
    257253    return;
     
    270266  if (!this->historyScrolling)
    271267    return;
    272   char* nextElem = this->historyIT->nextStep();
     268  char* nextElem = *(this->historyIT++);
    273269  if (nextElem == NULL)
    274270    return;
  • trunk/src/lib/shell/shell_input.h

    r5344 r5784  
    1212#include "text.h"
    1313#include "event_listener.h"
     14#include <list>
    1415
    1516// FORWARD DECLARATION
    16 template<class T> class tList;
    17 template<class T> class tIterator;
    1817class ShellCompletion;
    1918
     
    5554 private:
    5655    // HANDLING TEXT INPUT
    57    ShellCompletion*         completion;             //!< The Completion Interface.
     56   ShellCompletion*            completion;             //!< The Completion Interface.
    5857
    59    char*                    inputLine;              //!< the Char-Array of the Buffer
    60    float                    repeatRate;             //!< The Repeat-Delay.
    61    float                    repeatDelay;            //!< The delay of the first Character of a given Character.
    62    float                    delayed;                //!< how much of the delay is remaining.
    63    int                      pressedKey;             //!< the pressed key that will be repeated.
     58   char*                       inputLine;              //!< the Char-Array of the Buffer
     59   float                       repeatRate;             //!< The Repeat-Delay.
     60   float                       repeatDelay;            //!< The delay of the first Character of a given Character.
     61   float                       delayed;                //!< how much of the delay is remaining.
     62   int                         pressedKey;             //!< the pressed key that will be repeated.
    6463
    65    tList<char>*             history;                //!< The history of given commands.
    66    tIterator<char>*         historyIT;
    67    unsigned int             historyLength;          //!< The maximum length of the InputHistory.
    68    bool                     historyScrolling;       //!< true if we are scrolling through the history.
     64   std::list<char*>            history;                //!< The history of given commands.
     65   std::list<char*>::iterator  historyIT;
     66   unsigned int                historyLength;          //!< The maximum length of the InputHistory.
     67   bool                        historyScrolling;       //!< true if we are scrolling through the history.
    6968};
    7069
Note: See TracChangeset for help on using the changeset viewer.