Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

source: orxonox.OLD/trunk/src/lib/shell/shell_completion.h @ 7371

Last change on this file since 7371 was 7371, checked in by bensch, 18 years ago

orxonox/trunk: better completion-algos

File size: 2.2 KB
RevLine 
[4838]1/*!
[5170]2 * @file shell_completion.h
3 * @brief The Shell Completion Tasks
[5371]4 *
5 * @todo if the second string is a Command, the third should not be completed!
6 * @todo also make some completion for registered (or special) Types
[3245]7*/
[1853]8
[5170]9#ifndef _SHELL_COMPLETION_H
10#define _SHELL_COMPLETION_H
[1853]11
[5779]12#include <list>
[7225]13#include <string>
[5779]14
[4838]15// FORWARD DECLARATION
[5178]16class BaseObject;
[5181]17class ShellInput;
[5178]18#ifndef NULL
19#define NULL 0            //!< a pointer to NULL
20#endif
[3543]21
[5187]22
[3955]23//! A class for ...
[5170]24class ShellCompletion {
[1853]25
[7371]26  //! an enumerator for different types the Shell can complete.
27  typedef enum {
28    SHELLC_NONE        = 0,
29    SHELLC_CLASS       = 1,
30    SHELLC_OBJECT      = 2,
31    SHELLC_FUNCTION    = 4,
32    SHELLC_ALIAS       = 8,
33  } SHELLC_TYPE;
34
35//! A struct for ShellElements (these are used as containers to identify an Input for what it is)
36  struct ShellC_Element{
37    std::string     name;     //!< the Name of the Element to be completed.
38    SHELLC_TYPE     type;     //!< the type of the Element
39  };
40
[1904]41 public:
[7343]42  ShellCompletion();
[5170]43  virtual ~ShellCompletion();
[1853]44
[7343]45  bool autoComplete(std::string& input);
[7225]46  bool classComplete(const std::string& classBegin);
[5197]47//  long classMatch(const char* input, unsigned int* length);
[7225]48  bool objectComplete(const std::string& objectBegin, long classID);
[5197]49//  bool objectMatch(const char* objectBegin, long classID, unsigned int* length);
[7225]50  bool functionComplete(const std::string& functionBegin, const std::string& className);
[5197]51//  bool functionMatch(const char* functionBegin, long classID, unsigned int* length);
[7225]52  bool aliasComplete(const std::string& aliasBegin);
[3245]53
[7343]54  bool generalComplete(std::string& input,
55                       const std::string& begin, const std::string& displayAs = "%s",
[7225]56                       const std::string& addBack = "", const std::string& addFront = "");
[5178]57
58
[7371]59  bool addToCompleteList(const std::list<std::string>& inputList, const std::string& completionBegin, SHELLC_TYPE type);
60  bool addToCompleteList(const std::list<BaseObject*>& inputList, const std::string& completionBegin, SHELLC_TYPE type);
61  void clearCompletionList();
62
[5245]63  static const char* ShellCompletion::typeToString(SHELLC_TYPE type);
64
[3245]65 private:
[5780]66   std::list<ShellC_Element>    completionList;          //!< A list of completions, that are io.
[1853]67};
68
[5170]69#endif /* _SHELL_COMPLETION_H */
Note: See TracBrowser for help on using the repository browser.