Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 5181 in orxonox.OLD for trunk/src/lib/shell


Ignore:
Timestamp:
Sep 14, 2005, 12:07:06 AM (19 years ago)
Author:
bensch
Message:

orxonox/trunk: partial Completion in the ShellInput again (show but no Completion)

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

Legend:

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

    r5180 r5181  
    6161
    6262  this->rebuildText();
    63   this->completionList = NULL;
    6463
    6564  // EVENT-Handler subscription of '`' to all States.
  • trunk/src/lib/shell/shell.h

    r5180 r5181  
    8787    unsigned int             bufferDisplaySize;      //!< The Size of the Display-buffer, in lines (not in characters)
    8888    Text**                   bufferText;             //!< A list of stored bufferTexts for the display of the buffer
    89 
    90     // completion
    91     tList<const char>*       completionList;          //!< A list of completions, that are io.
    9289};
    9390
  • trunk/src/lib/shell/shell_completion.cc

    r5178 r5181  
    1818#include "shell_completion.h"
    1919
     20#include "shell_input.h"
     21
    2022#include "base_object.h"
    2123#include "class_list.h"
     
    3335ShellCompletion::ShellCompletion ()
    3436{
    35 // this->setClassID(CL_PROTO_ID, "ProtoClass");
    36 
    37    /* If you make a new class, what is most probably the case when you write this file
    38       don't forget to:
    39        1. Add the new file new_class.cc to the ./src/Makefile.am
    40        2. Add the class identifier to ./src/class_id.h eg. CL_NEW_CLASS
    41 
    42       Advanced Topics:
    43       - if you want to let your object be managed via the ObjectManager make sure to read
    44         the object_manager.h header comments. You will use this most certanly only if you
    45         make many objects of your class, like a weapon bullet.
    46    */
     37  this->completionList = NULL;
    4738}
    4839
     
    5445{
    5546  // delete what has to be deleted here
     47  if (this->completionList)
     48  {
     49    delete this->completionList;
     50  }
    5651}
    5752
     
    6459 * @todo implement it!!
    6560 */
    66 bool ShellCompletion::autoComplete(const char* inputLine)
     61bool ShellCompletion::autoComplete(ShellInput* input)
    6762{
    6863  //PRINTF(3)("AutoCompletion not implemented yet\n");
    6964
    70   char* completionLine = new char[strlen(inputLine)+1];
    71   strcpy(completionLine, inputLine);
     65  char* completionLine = new char[strlen(input->getText())+1];
     66  strcpy(completionLine, input->getText());
    7267
    7368  char* commandBegin = strrchr(completionLine, ' ');
  • trunk/src/lib/shell/shell_completion.h

    r5178 r5181  
    99// FORWARD DECLARATION
    1010class BaseObject;
     11class ShellInput;
    1112template<class T> class tList;
    1213#ifndef NULL
     
    2122  virtual ~ShellCompletion();
    2223
    23   bool autoComplete(const char* inputLine);
     24  bool autoComplete(ShellInput* input);
    2425  bool classComplete(const char* classBegin);
    2526  bool objectComplete(const char* objectBegin, long classID);
  • trunk/src/lib/shell/shell_input.cc

    r5180 r5181  
    1818#include "shell_input.h"
    1919
     20
     21
     22#include "shell_command.h"
     23#include "shell_completion.h"
    2024#include "event_handler.h"
    2125
    22 #include "shell_command.h"
    2326#include "debug.h"
    2427#include "list.h"
     
    5053    evh->subscribe(this, ES_SHELL, i);
    5154
     55  this->completion = new ShellCompletion;
    5256}
    5357
     
    5862{
    5963  // delete what has to be deleted here
     64  delete[] this->inputLine;
     65  delete this->completion;
    6066}
    6167
     
    195201      this->debug();
    196202    else if (event.type == SDLK_TAB)
    197       ;//this->autoComplete();
     203      this->completion->autoComplete(this);
    198204    else if (event.type == SDLK_BACKSPACE)
    199205    {
  • trunk/src/lib/shell/shell_input.h

    r5180 r5181  
    1212// FORWARD DECLARATION
    1313template<class T> class tList;
     14class ShellCompletion;
    1415
    1516
     
    3839 private:
    3940    // HANDLING TEXT INPUT
    40    char*                    inputLine;              //!< the Char-Array of the Buffer
     41   ShellCompletion*         completion;             //!< The Completion Interface.
     42
     43   char*                    inputLine;              //!< the Char-Array of the Buffer @todo not needed anymore
    4144   float                    repeatRate;             //!< The Repeat-Delay.
    4245   float                    repeatDelay;            //!< The delay of the first Character of a given Character.
Note: See TracChangeset for help on using the changeset viewer.