Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 7403 in orxonox.OLD for trunk/src/lib/shell/shell_completion.h


Ignore:
Timestamp:
Apr 27, 2006, 5:49:12 PM (18 years ago)
Author:
bensch
Message:

orxonox/trunk: more exists functions to ClassList, and improved shellcompletion

File:
1 edited

Legend:

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

    r7393 r7403  
    2222  class ShellCompletion
    2323  {
    24     //! an enumerator for different types the Shell can complete.
    25     typedef enum {
    26       NullCompletion         = 0,
    27       ClassCompletion        = 1,
    28       ObjectCompletion       = 2,
    29       FunctionCompletion     = 4,
    30       AliasCompletion        = 8,
     24      //! an enumerator for different types the Shell can complete.
     25      typedef enum {
     26        NullCompletion         = 0,
     27        ClassCompletion        = 1,
     28        ObjectCompletion       = 2,
     29        FunctionCompletion     = 4,
     30        AliasCompletion        = 8,
    3131    } CompletionType;
    3232
    33     //! A struct for ShellElements (these are used as containers to identify an Input for what it is)
    34     struct CompletionElement
    35     {
    36       std::string     name;     //!< the Name of the Element to be completed.
    37       CompletionType  type;     //!< the type of the Element
    38     };
     33      //! A struct for ShellElements (these are used as containers to identify an Input for what it is)
     34      struct CompletionElement
     35      {
     36        std::string     name;     //!< the Name of the Element to be completed.
     37        CompletionType  type;     //!< the type of the Element
     38      };
    3939
    40   public:
    41     ShellCompletion();
    42     virtual ~ShellCompletion();
     40    public:
     41      ShellCompletion();
     42      virtual ~ShellCompletion();
    4343
    4444
    45     // Functions to produce the Complete Lists.
    46     bool autoComplete(std::string& input);
    47     //  long classMatch(const char* input, unsigned int* length);
    48     bool objectComplete(const std::string& objectBegin, long classID);
    49     //  bool objectMatch(const char* objectBegin, long classID, unsigned int* length);
    50     bool commandComplete(const std::string& commandBegin, const std::string& className);
    51     //  bool functionMatch(const char* functionBegin, long classID, unsigned int* length);
    52     bool aliasComplete(const std::string& aliasBegin);
     45      // Functions to produce the Complete Lists.
     46      bool autoComplete(std::string& input);
    5347
    54     // Generally Completes.
    55     bool generalComplete(std::string& input,
    56                          const std::string& begin, const std::string& displayAs = "%s",
    57                          const std::string& addBack = "", const std::string& addFront = "");
     48      static const std::string& ShellCompletion::typeToString(ShellCompletion::CompletionType type);
     49
     50    private:
     51      //  long classMatch(const char* input, unsigned int* length);
     52      bool objectComplete(const std::string& objectBegin, long classID);
     53      //  bool objectMatch(const char* objectBegin, long classID, unsigned int* length);
     54      bool commandComplete(const std::string& commandBegin, const std::string& className);
     55      //  bool functionMatch(const char* functionBegin, long classID, unsigned int* length);
     56      bool aliasComplete(const std::string& aliasBegin);
     57
     58      // Generally Completes.
     59      bool generalComplete(std::string& input,
     60                           const std::string& begin, const std::string& displayAs = "%s",
     61                           const std::string& addBack = "", const std::string& addFront = "");
    5862
    5963
    60     bool addToCompleteList(const std::list<std::string>& inputList, const std::string& completionBegin, ShellCompletion::CompletionType type);
    61     bool addToCompleteList(const std::list<BaseObject*>& inputList, const std::string& completionBegin, ShellCompletion::CompletionType type);
     64      bool addToCompleteList(const std::list<std::string>& inputList, const std::string& completionBegin, ShellCompletion::CompletionType type);
     65      bool addToCompleteList(const std::list<BaseObject*>& inputList, const std::string& completionBegin, ShellCompletion::CompletionType type);
    6266
     67      // Helpers.
     68      void clearCompletionList();
    6369
    64     // Helpers.
    65     void clearCompletionList();
    66     static const std::string& ShellCompletion::typeToString(ShellCompletion::CompletionType type);
     70    private:
     71      std::vector<CompletionElement>  completionList;          //!< A list of completions, that are io.
    6772
    68   private:
    69     std::vector<CompletionElement>  completionList;          //!< A list of completions, that are io.
    70 
    71     static const std::string        typeNames[];             //!< A list of Completion-Type-Names.
     73      static const std::string        typeNames[];             //!< A list of Completion-Type-Names.
    7274  };
    7375
Note: See TracChangeset for help on using the changeset viewer.