Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

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

Last change on this file since 5695 was 5371, checked in by bensch, 19 years ago

orxonox/trunk: todo-list

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
[4838]12// FORWARD DECLARATION
[5178]13class BaseObject;
[5181]14class ShellInput;
[5178]15template<class T> class tList;
16#ifndef NULL
17#define NULL 0            //!< a pointer to NULL
18#endif
[3543]19
[5197]20//! an enumerator for different types the Shell can complete.
[5187]21typedef enum {
[5193]22  SHELLC_NONE        = 0,
23  SHELLC_CLASS       = 1,
24  SHELLC_OBJECT      = 2,
25  SHELLC_FUNCTION    = 4,
26  SHELLC_ALIAS       = 8,
[5192]27} SHELLC_TYPE;
[5187]28
[5197]29//! A struct for ShellElements (these are used as containers to identify an Input for what it is)
[5187]30struct ShellC_Element{
[5197]31  const char*     name;     //!< the Name of the Element to be completed.
32  SHELLC_TYPE     type;     //!< the type of the Element
[5187]33};
34
[3955]35//! A class for ...
[5170]36class ShellCompletion {
[1853]37
[1904]38 public:
[5182]39  ShellCompletion(ShellInput* input = NULL);
[5170]40  virtual ~ShellCompletion();
[1853]41
[5184]42  bool autoComplete(ShellInput* input = NULL);
[5178]43  bool classComplete(const char* classBegin);
[5197]44//  long classMatch(const char* input, unsigned int* length);
[5178]45  bool objectComplete(const char* objectBegin, long classID);
[5197]46//  bool objectMatch(const char* objectBegin, long classID, unsigned int* length);
[5330]47  bool functionComplete(const char* functionBegin, const char* className);
[5197]48//  bool functionMatch(const char* functionBegin, long classID, unsigned int* length);
[5195]49  bool aliasComplete(const char* aliasBegin);
[3245]50
[5192]51  bool generalComplete(const char* begin, const char* displayAs = "%s", const char* addBack = NULL, const char* addFront = NULL);
[5178]52
[5245]53  bool addToCompleteList(const tList<const char>* inputList, const char* completionBegin, SHELLC_TYPE type);
54  bool addToCompleteList(const tList<BaseObject>* inputList, const char* completionBegin, SHELLC_TYPE type);
[5187]55  void emptyCompletionList();
[5178]56
[5245]57  static const char* ShellCompletion::typeToString(SHELLC_TYPE type);
58
[3245]59 private:
[5187]60   tList<ShellC_Element>*   completionList;          //!< A list of completions, that are io.
[5197]61   ShellInput*              input;                   //!< the input this completion works on.
[1853]62};
63
[5170]64#endif /* _SHELL_COMPLETION_H */
Note: See TracBrowser for help on using the repository browser.