Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 5246 in orxonox.OLD for trunk/src/lib/shell/shell_buffer.cc


Ignore:
Timestamp:
Sep 24, 2005, 9:20:49 PM (19 years ago)
Author:
bensch
Message:

orxonox/trunk: minimalized the ShellBuffer

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/lib/shell/shell_buffer.cc

    r5215 r5246  
    1010
    1111   ### File Specific:
    12    main-programmer: ...
     12   main-programmer: Benjamin Grauer
    1313   co-programmer: ...
    1414*/
     
    4040  this->keepBuffer = false;
    4141  this->buffer = new tList<char>;
    42   this->bufferIterator = this->buffer->getIterator();
    4342
    4443  this->setBufferSize(100);
     
    5554    delete this->shell;
    5655
    57   this->flushBuffers();
    58   delete bufferIterator;
     56  this->flush();
    5957  delete buffer;
    6058
     
    8987 * deletes all the Buffers
    9088 */
    91 void ShellBuffer::flushBuffers()
     89void ShellBuffer::flush()
    9290{
    9391  // delete all the Chars in the Buffers
     92  tIterator<char>* bufferIterator = this->buffer->getIterator();
    9493  char* charElem = bufferIterator->firstElement();
    9594  while (charElem != NULL)
     
    9897    charElem = bufferIterator->nextElement();
    9998  }
    100   delete this->bufferIterator;
     99  delete bufferIterator;
    101100  delete this->buffer;
    102101  this->buffer = new tList<char>;
    103   this->bufferIterator = this->buffer->getIterator();
    104 
    105102}
    106103
     
    193190
    194191/**
    195  * moves the buffer around lineCount lines upwards (negative values move down)
    196  * @param lineCount the Count of lines to move upwards
    197  *
    198  * @todo
    199  */
    200 void ShellBuffer::moveBuffer(unsigned int lineCount)
    201 {
    202 }
    203 
    204 /**
    205  * @param lineNumber the n-th line from the bottom
    206  * @returns the Buffer at Line lineNumber
    207  */
    208 const char* ShellBuffer::getBufferLine(unsigned int lineNumber)
    209 {
     192 * displays some nice output from the Shell
     193 */
     194void ShellBuffer::debug() const
     195{
     196  PRINT(3)("Debugging output to console (not this shell)\n");
     197
    210198  tIterator<char>* charIterator = this->buffer->getIterator();
    211   char* charElem = charIterator->firstElement();
    212 
    213   int i = 1;
    214   while (charElem != NULL)
    215   {
    216     if (i++ < lineNumber)
    217     {
    218       delete charIterator;
    219       return charElem;
    220     }
    221 
    222     charElem = charIterator->nextElement();
     199  char* tmpChar = charIterator->firstElement();
     200  while(tmpChar != NULL)
     201  {
     202    printf(tmpChar);
     203    tmpChar = charIterator->nextElement();
    223204  }
    224205  delete charIterator;
    225206}
    226 
    227 /**
    228  * displays some nice output from the Shell
    229  */
    230 void ShellBuffer::debug() const
    231 {
    232   PRINT(3)("Debugging output to console (not this shell)\n");
    233 
    234   char* tmpChar = bufferIterator->firstElement();
    235   while(tmpChar != NULL)
    236   {
    237     printf(tmpChar);
    238     tmpChar = bufferIterator->nextElement();
    239   }
    240 }
Note: See TracChangeset for help on using the changeset viewer.