Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

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

Last change on this file since 7227 was 7225, checked in by bensch, 19 years ago

orxonox/trunk: more std::string

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