Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

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

Last change on this file since 7366 was 7343, checked in by bensch, 19 years ago

oroxnox/trunk: ShellInput and ShellCompletion more c++-like

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
[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:
[7343]41  ShellCompletion();
[5170]42  virtual ~ShellCompletion();
[1853]43
[7343]44  bool autoComplete(std::string& input);
[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
[7343]53  bool generalComplete(std::string& input,
54                       const std::string& begin, const std::string& displayAs = "%s",
[7225]55                       const std::string& addBack = "", const std::string& addFront = "");
[5178]56
[7225]57  bool addToCompleteList(const std::list<std::string>* inputList, const std::string& completionBegin, SHELLC_TYPE type);
58  bool addToCompleteList(const std::list<BaseObject*>* inputList, const std::string& completionBegin, SHELLC_TYPE type);
[5187]59  void emptyCompletionList();
[5178]60
[5245]61  static const char* ShellCompletion::typeToString(SHELLC_TYPE type);
62
[3245]63 private:
[5780]64   std::list<ShellC_Element>    completionList;          //!< A list of completions, that are io.
[1853]65};
66
[5170]67#endif /* _SHELL_COMPLETION_H */
Note: See TracBrowser for help on using the repository browser.