- Timestamp:
- Apr 17, 2006, 1:32:25 AM (19 years ago)
- Location:
- trunk/src/lib/shell
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/lib/shell/shell.cc
r7221 r7315 74 74 this->bufferDisplaySize = 10; 75 75 this->bufferOffset = 0; 76 this->bufferIterator = ShellBuffer::getInstance()->getBuffer() ->begin();76 this->bufferIterator = ShellBuffer::getInstance()->getBuffer().begin(); 77 77 78 78 // INPUT LINE … … 130 130 this->setRelCoorSoft2D(0, 0, 1, 5); 131 131 132 list< char*>::const_iterator textLine = --ShellBuffer::getInstance()->getBuffer()->end();132 list<std::string>::const_iterator textLine = --ShellBuffer::getInstance()->getBuffer().end(); 133 133 bool top = false; 134 134 for (int i = 0; i < this->bufferDisplaySize; i++) … … 138 138 { 139 139 this->bufferText[i]->setText((*textLine)); 140 if (textLine != ShellBuffer::getInstance()->getBuffer() ->begin())140 if (textLine != ShellBuffer::getInstance()->getBuffer().begin()) 141 141 top = true; 142 142 textLine--; … … 159 159 this->setRelCoorSoft2D(0, -(int)this->shellHeight, 1, 5); 160 160 161 list< char*>::const_iterator textLine = --ShellBuffer::getInstance()->getBuffer()->end();161 list<std::string>::const_iterator textLine = --ShellBuffer::getInstance()->getBuffer().end(); 162 162 for (int i = 0; i < this->bufferDisplaySize; i++) 163 163 { 164 164 this->bufferText[i]->setVisibility(false); 165 if (textLine != ShellBuffer::getInstance()->getBuffer() ->begin())165 if (textLine != ShellBuffer::getInstance()->getBuffer().begin()) 166 166 { 167 167 this->bufferText[i]->setText((*textLine)); … … 306 306 } 307 307 308 list< char*>::const_iterator textLine = --ShellBuffer::getInstance()->getBuffer()->end();308 list<std::string>::const_iterator textLine = --ShellBuffer::getInstance()->getBuffer().end(); 309 309 bufferText = new Text*[bufferDisplaySize]; 310 310 for (unsigned int i = 0; i < bufferDisplaySize; i++) … … 313 313 bufferText[i]->setAlignment(TEXT_ALIGN_LEFT); 314 314 bufferText[i]->setParent2D(this); 315 if(textLine != ShellBuffer::getInstance()->getBuffer() ->begin())315 if(textLine != ShellBuffer::getInstance()->getBuffer().begin()) 316 316 { 317 317 bufferText[i]->setText(*textLine); … … 390 390 if (this->bufferOffset == 0) 391 391 { 392 this->bufferIterator = ShellBuffer::getInstance()->getBuffer() ->end();392 this->bufferIterator = ShellBuffer::getInstance()->getBuffer().end(); 393 393 // for (unsigned int i = 0; i < this->bufferDisplaySize; i++) 394 394 // this->bufferIterator->prevStep(); … … 396 396 397 397 // boundraries 398 if (this->bufferOffset + lineCount > (int)ShellBuffer::getInstance()->getBuffer() ->size())399 lineCount = (int)ShellBuffer::getInstance()->getBuffer() ->size()- this->bufferOffset;398 if (this->bufferOffset + lineCount > (int)ShellBuffer::getInstance()->getBuffer().size()) 399 lineCount = (int)ShellBuffer::getInstance()->getBuffer().size()- this->bufferOffset; 400 400 else if (this->bufferOffset + lineCount < 0) 401 401 lineCount = -bufferOffset; … … 418 418 } 419 419 // redisplay the buffers 420 list< char*>::const_iterator it = this->bufferIterator;420 list<std::string>::const_iterator it = this->bufferIterator; 421 421 for (unsigned int i = 0; i < this->bufferDisplaySize; i++) 422 422 { -
trunk/src/lib/shell/shell.h
r7221 r7315 104 104 Text** bufferText; //!< A list of stored bufferTexts for the display of the buffer. 105 105 int bufferOffset; //!< how many lines from the bottom up we display the Buffer. 106 std::list< char*>::const_iterator bufferIterator; //!< used to move through and print the Buffer106 std::list<std::string>::const_iterator bufferIterator; //!< used to move through and print the Buffer 107 107 }; 108 108 -
trunk/src/lib/shell/shell_buffer.cc
r7314 r7315 90 90 void ShellBuffer::flush() 91 91 { 92 // delete all the Chars in the Buffers93 list<char*>::iterator bufferLine;94 for (bufferLine = this->buffer.begin(); bufferLine != this->buffer.end(); bufferLine++)95 {96 delete[] (*bufferLine);97 }98 92 this->buffer.clear(); 99 93 } … … 176 170 } 177 171 178 char* addLine = new char[strlen(newLineBegin)+1];179 strcpy(addLine, newLineBegin);180 181 172 this->lineCount++; 182 this->buffer.push_back( addLine);173 this->buffer.push_back(newLineBegin); 183 174 if (likely (this->shell != NULL) && unlikely (this->shell->isActive())) 184 this->shell->printToDisplayBuffer( addLine);175 this->shell->printToDisplayBuffer(newLineBegin); 185 176 186 177 if (this->buffer.size() > this->bufferSize) 187 {188 delete[] this->buffer.front();189 178 this->buffer.pop_front(); 190 }191 179 192 180 newLineBegin = newLineEnd+1; … … 201 189 PRINT(3)("Debugging output to console (not this shell)\n"); 202 190 203 list< char*>::const_iterator bufferLine;191 list<std::string>::const_iterator bufferLine; 204 192 for (bufferLine = this->buffer.begin(); bufferLine != this->buffer.end(); bufferLine++) 205 printf( *bufferLine);193 printf((*bufferLine).c_str()); 206 194 } -
trunk/src/lib/shell/shell_buffer.h
r7314 r7315 41 41 void addBufferLine(const char* line, va_list arg); 42 42 /** @returns the List of stings from the Buffer */ 43 const std::list< char*>* getBuffer() const { return &this->buffer; };43 const std::list<std::string>& getBuffer() const { return this->buffer; }; 44 44 /** @returns the Count of lines processed by the Shell. */ 45 45 inline long getLineCount() const { return this->lineCount; }; … … 53 53 static ShellBuffer* singletonRef; //!< The singleton-reference to the only memeber of this class. 54 54 unsigned int bufferSize; //!< The Size of the buffer 55 std::list< char*>buffer; //!< A list of stored char-arrays(strings) to store the history55 std::list<std::string> buffer; //!< A list of stored char-arrays(strings) to store the history 56 56 57 57 Shell* shell; //!< the Registered Shell.
Note: See TracChangeset
for help on using the changeset viewer.