Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

source: orxonox.OLD/trunk/src/lib/shell/shell_command.h @ 5449

Last change on this file since 5449 was 5391, checked in by bensch, 19 years ago

orxonox/trunk: more gui-definitions

File size: 18.9 KB
RevLine 
[4838]1/*!
[5129]2 * @file shell_command.h
[5068]3 * Definition of a on-screen-shell
[5391]4 */
[1853]5
[5129]6#ifndef _SHELL_COMMAND_H
7#define _SHELL_COMMAND_H
[1853]8
[5129]9#include "base_object.h"
[1853]10
[5141]11#include "helper_functions.h"
[5155]12#include "substring.h"
[5143]13#include "functor_list.h"
[5141]14
[5068]15#include <stdarg.h>
16
[5166]17#define     SHELL_COMMAND_MAX_SIZE      //!< The maximum size of a Shell Command
[5130]18
[5127]19
[5130]20
[4838]21// FORWARD DECLARATION
[5068]22template<class T> class tList;
[3543]23
[5166]24/**
25 * an easy to use Macro to create a Command
26 * @param command the name of the command (without "" around the string)
27 * @param class the name of the class to apply this command to (without the "" around the string)
28 * @param function the function to call
[5179]29 *
30 * MEANING:
31 *  ShellCommandBase* someUniqueVarName =
32 *       ShellCommand<ClassName>::registerCommand("commandNameInShell", "ClassName", &ClassName::FunctionToCall);
33 *
34 * In the Shell you would call this Command using:
35 * $ ClassName [ObjectName] commandNameInShell [parameters]
[5166]36 */
[5162]37#define SHELL_COMMAND(command, class, function) \
[5164]38        ShellCommandBase* shell_command_##class##_##command = ShellCommand<class>::registerCommand(#command, #class, &class::function)
[5329]39/**
40 * an easy to use Macro to create a Command
41 * @param command the name of the command (without "" around the string)
42 * @param class the name of the class to apply this command to (without the "" around the string)
43 * @param function the function to call
44 *
45 * MEANING:
46 *  ShellCommandBase* someUniqueVarName =
47 *       ShellCommand<ClassName>::registerCommand("commandNameInShell", "ClassName", &ClassName::FunctionToCall);
48 *
49 * In the Shell you would call this Command using:
50 * $ ClassName [ObjectName] commandNameInShell [parameters]
51 */
52#define SHELL_COMMAND_STATIC(command, class, function) \
53                         ShellCommandBase* shell_command_##class##_##command = ShellCommandStatic<class>::registerCommand(#command, #class, function)
[5135]54
[5162]55
[5328]56//! an enumerator for the definition of the Type.
57typedef enum {
58  ShellCommand_Objective = 1,
59  ShellCommand_Static    = 2,
60} ShellCommand_Type;
61
[5161]62////////////////
63// BASE CLASS //
64////////////////
[5170]65class ShellCommandBase;
[5190]66class ShellCommandAlias;
[5170]67
68//! A class to hold all Classes that have (once) registered Commands.
69class ShellCommandClass : public BaseObject
70{
71  friend class ShellCommandBase;
72
73  public:
[5197]74    /** @returns the CommandClassList */
[5170]75    static const tList<ShellCommandClass>* getCommandClassList() { return ShellCommandClass::commandClassList; };
[5195]76    static bool getCommandListOfClass(const char* className, tList<const char>* stringList);
77    static bool getCommandListOfAlias(tList<const char>* aliasList);
[5190]78
[5170]79    static ShellCommandClass* getCommandClass(const char* className);
[5171]80    static void unregisterAllCommands();
[5170]81
[5204]82    static void help (const char* className);
83
[5170]84  private:
85    ShellCommandClass(const char* className);
86    ~ShellCommandClass();
87
88    static const ShellCommandClass* isRegistered(const char* className);
89    static void initCommandClassList();
90
91  private:
[5171]92    const char*                      className;                 //!< The Name of the Class. This should match the ClassName of the Commands Class.
93    long                             classID;                   //!< The classID of this Class
94    tList<ShellCommandBase>*         commandList;               //!< A list of Commands from this Class
95    static tList<ShellCommandClass>* commandClassList;          //!< A list of Classes
[5195]96    static tList<ShellCommandAlias>* aliasList;                 //!< An Alias to A Command. (only for classes with one Instance)
[5170]97};
98
99
[5161]100//! a baseClass for all possible ShellCommands
101class ShellCommandBase : public BaseObject
102{
[5170]103  friend class ShellCommandClass;
[5161]104  public:
105    static bool execute (const char* executionString);
106
[5164]107    ShellCommandBase* describe(const char* description);
[5190]108    ShellCommandBase* setAlias(const char* alias);
[5207]109    ShellCommandBase* defaultValues(unsigned int count, ...);
[5164]110
[5166]111    /** @returns the CommandList of the Shell */
112    static void unregisterCommand(const char* commandName, const char* className);
[5161]113
114    static void debug();
115
116  protected:
117    ShellCommandBase(const char* commandName, const char* className, unsigned int paramCount, ...);
118    ~ShellCommandBase();
119
[5328]120    /** @returns the Type of this Function (either static or objective) */
121    inline ShellCommand_Type getType() { return this->functorType; };
122
[5161]123    static bool isRegistered(const char* commandName, const char* className, unsigned int paramCount, ...);
124    static const char* paramToString(long parameter);
125
126  private:
[5166]127    /** executes a Command @param object the object to apply this to @param parameters the parameters the command takes */
[5279]128    virtual void executeCommand (BaseObject* object, const char* parameters) = 0;
[5161]129
130  protected:
[5328]131    ShellCommand_Type                functorType;                          //!< The type of Function we've got (either static or objective).
[5163]132    void*                            functionPointer;                      //!< The pointeer to the function of the Class (or static pointer if ClassID == CL_NULL )
[5166]133    unsigned int                     paramCount;                           //!< the count of parameters.
134    unsigned int*                    parameters;                           //!< Parameters the function of this Command takes.
135    char*                            defaultStrings[FUNCTOR_MAX_ARGUMENTS];//!< A list of default Strings stored.
136    int                              defaultInts[FUNCTOR_MAX_ARGUMENTS];   //!< A list of default Ints stored.
137    float                            defaultFloats[FUNCTOR_MAX_ARGUMENTS]; //!< A list of default Floats stored.
138    bool                             defaultBools[FUNCTOR_MAX_ARGUMENTS];  //!< A list of default Bools stored.
[5161]139
[5328]140
[5161]141  private:
[5170]142    ShellCommandClass*               shellClass;                           //!< A Pointer to the Shell-Class this Command belongs to.
[5196]143    ShellCommandAlias*               alias;                                //!< An Alias for the Class.
[5161]144
[5166]145    const char*                      description;                          //!< A description for this commnand. (initially NULL). Assigned with (create)->describe("blablabla");
[5161]146};
147
148///////////////////////////////////////////////////
149///////////////////////////////////////////////////
150
[5326]151/////////////////////////////////
152// MACRO DEFINITION EXTENSIONS //
153/////////////////////////////////
[5166]154//! where to chek for default BOOL values
[5151]155#define   l_BOOL_DEFGRAB(i)         this->defaultBools[i]
[5166]156//! where to chek for default INT values
[5151]157#define   l_INT_DEFGRAB(i)          this->defaultInts[i]
[5166]158//! where to chek for default UINT values
[5151]159#define   l_UINT_DEFGRAB(i)         (unsigned int)this->defaultInts[i]
[5166]160//! where to chek for default LONG values
[5151]161#define   l_LONG_DEFGRAB(i)         (long)this->defaultInts[i]
[5166]162//! where to chek for default FLOAT values
[5151]163#define   l_FLOAT_DEFGRAB(i)        this->defaultFloats[i]
[5166]164//! where to chek for default STRING values
[5151]165#define   l_STRING_DEFGRAB(i)       this->defaultStrings[i]
[5135]166
[5153]167//////////////////////////
168// COMMAND REGISTRATION //
169//////////////////////////
[5326]170// SHELLCOMMAND can be redefined as ShellCommand or ShellCommandStatic
171// SHELLCOMMANDEXECUTER can be redefined too.
[5327]172// SHELLCOMMANDINCLASS
[5328]173// SHELLCOMMANDTYPE
[5166]174//! registers a command without any parameters
[5153]175#define ShellCommandRegister0() \
[5327]176  static SHELLCOMMAND<T>* registerCommand(const char* commandName, const char* className, void SHELLCOMMANDINCLASS(*function)()) \
[5142]177  { \
[5161]178    if (isRegistered(commandName, className, 0)== true) \
179      return NULL; \
[5327]180    return new SHELLCOMMAND<T>(commandName, className, function); \
[5142]181  }
[5135]182
[5166]183//! registers a command with 1 parameter
[5145]184#define ShellCommandRegister1(t1) \
[5327]185  static SHELLCOMMAND<T>* registerCommand(const char* commandName, const char* className, void SHELLCOMMANDINCLASS(*function)(t1##_TYPE), t1##_TYPE d1 = t1##_DEFAULT) \
[5135]186  { \
[5161]187    if (isRegistered(commandName, className, 1, t1##_PARAM)== true) \
188      return NULL; \
[5327]189    return new SHELLCOMMAND<T>(commandName, className, function, d1); \
[5142]190  }
191
[5166]192//! registers a command with 2 parameters
[5153]193#define ShellCommandRegister2(t1,t2) \
[5327]194  static SHELLCOMMAND<T>* registerCommand(const char* commandName, const char* className, void SHELLCOMMANDINCLASS(*function)(t1##_TYPE, t2##_TYPE), t1##_TYPE d1 = t1##_DEFAULT, t2##_TYPE d2 = t2##_DEFAULT) \
[5153]195  { \
[5161]196    if (isRegistered(commandName, className, 2, t1##_PARAM, t2##_PARAM)== true) \
197      return NULL; \
[5327]198    return new SHELLCOMMAND<T>(commandName, className, function, d1, d2); \
[5153]199  }
200
[5166]201//! registers a command with 3 parameters
[5153]202#define ShellCommandRegister3(t1,t2,t3) \
[5327]203  static SHELLCOMMAND<T>* registerCommand(const char* commandName, const char* className, void SHELLCOMMANDINCLASS(*function)(t1##_TYPE, t2##_TYPE, t3##_TYPE), t1##_TYPE d1 = t1##_DEFAULT, t2##_TYPE d2 = t2##_DEFAULT, t3##_TYPE d3 = t3##_DEFAULT) \
[5153]204  { \
[5161]205    if (isRegistered(commandName, className, 3, t1##_PARAM, t2##_PARAM, t3##_PARAM)== true) \
206      return NULL; \
[5327]207    return new SHELLCOMMAND<T>(commandName, className, function, d1, d2, d3); \
[5153]208  }
209
[5166]210//! registers a command with 4 parameters
[5153]211#define ShellCommandRegister4(t1,t2,t3,t4) \
[5327]212  static SHELLCOMMAND<T>* registerCommand(const char* commandName, const char* className, void SHELLCOMMANDINCLASS(*function)(t1##_TYPE, t2##_TYPE, t3##_TYPE, t4##_TYPE), t1##_TYPE d1 = t1##_DEFAULT, t2##_TYPE d2 = t2##_DEFAULT, t3##_TYPE d3 = t3##_DEFAULT, t4##_TYPE d4 = t4##_DEFAULT) \
[5153]213  { \
[5161]214    if (isRegistered(commandName, className, 4, t1##_PARAM, t2##_PARAM, t3##_PARAM, t4##_PARAM)== true) \
215      return NULL; \
[5327]216    return new SHELLCOMMAND<T>(commandName, className, function, d1, d2, d3, d4); \
[5153]217  }
[5161]218
[5166]219//! registers a command with 5 parameters
[5153]220#define ShellCommandRegister5(t1,t2,t3,t4,t5) \
[5327]221  static SHELLCOMMAND<T>* registerCommand(const char* commandName, const char* className, void SHELLCOMMANDINCLASS(*function)(t1##_TYPE, t2##_TYPE, t3##_TYPE, t4##_TYPE, t5##_TYPE), t1##_TYPE d1 = t1##_DEFAULT, t2##_TYPE d2 = t2##_DEFAULT, t3##_TYPE d3 = t3##_DEFAULT, t4##_TYPE d4 = t4##_DEFAULT, t5##_TYPE d5 = t5##_DEFAULT) \
[5153]222  { \
[5161]223    if (isRegistered(commandName, className, 5, t1##_PARAM, t2##_PARAM, t3##_PARAM, t4##_PARAM, t5##_PARAM)== true) \
224      return NULL; \
225    return new ShellCommand<T>(commandName, className, function, d1, d2, d3, d4, d5); \
[5153]226  }
227
228//////////////////
229// CONSTRUCTORS //
230/////////////////
[5166]231//! creates a command that takes no parameters
[5153]232#define ShellCommandConstructor0() \
[5327]233  void SHELLCOMMANDINCLASS(*functionPointer_0)(); \
234  SHELLCOMMAND(const char* commandName, const char* className, void SHELLCOMMANDINCLASS(*function)()) \
[5161]235  : ShellCommandBase(commandName, className, 0) \
[5142]236  { \
[5328]237    this->functorType = SHELLCOMMANDTYPE; \
[5145]238    this->functionPointer_0 = function; \
[5142]239  }
240
[5166]241//! creates a command that takes one parameter
[5145]242#define ShellCommandConstructor1(t1) \
[5327]243  void SHELLCOMMANDINCLASS(*functionPointer_1_##t1)(t1##_TYPE); \
244  SHELLCOMMAND(const char* commandName, const char* className, void SHELLCOMMANDINCLASS(*function)(t1##_TYPE), t1##_TYPE d1) \
[5161]245  : ShellCommandBase(commandName, className, 1, t1##_PARAM, d1) \
[5135]246  { \
[5328]247    this->functorType = SHELLCOMMANDTYPE; \
[5145]248    this->functionPointer_1_##t1 = function; \
[5135]249  }
250
[5166]251//! creates a command that takes two parameters
[5153]252#define ShellCommandConstructor2(t1,t2) \
[5327]253  void SHELLCOMMANDINCLASS(*functionPointer_2_##t1##_##t2)(t1##_TYPE, t2##_TYPE); \
254  SHELLCOMMAND(const char* commandName, const char* className, void SHELLCOMMANDINCLASS(*function)(t1##_TYPE, t2##_TYPE), t1##_TYPE d1, t2##_TYPE d2) \
[5161]255  : ShellCommandBase(commandName, className, 2, t1##_PARAM, d1, t2##_PARAM, d2) \
[5153]256  { \
[5328]257    this->functorType = SHELLCOMMANDTYPE; \
[5153]258    this->functionPointer_2_##t1##_##t2 = function; \
259  }
[5135]260
[5166]261//! creates a command that takes three parameter
[5153]262#define ShellCommandConstructor3(t1,t2,t3) \
[5327]263  void SHELLCOMMANDINCLASS(*functionPointer_3_##t1##_##t2##_##t3)(t1##_TYPE, t2##_TYPE, t3##_TYPE); \
264  SHELLCOMMAND(const char* commandName, const char* className, void SHELLCOMMANDINCLASS(*function)(t1##_TYPE, t2##_TYPE, t3##_TYPE), t1##_TYPE d1, t2##_TYPE d2, t3##_TYPE d3) \
[5161]265  : ShellCommandBase(commandName, className, 3, t1##_PARAM, d1, t2##_PARAM, d2, t3##_PARAM, d3) \
[5153]266  { \
[5328]267    this->functorType = SHELLCOMMANDTYPE; \
[5153]268    this->functionPointer_3_##t1##_##t2##_##t3 = function; \
269  }
[5141]270
[5166]271//! creates a command that takes four parameter
[5153]272#define ShellCommandConstructor4(t1,t2,t3,t4) \
[5327]273  void SHELLCOMMANDINCLASS(*functionPointer_4_##t1##_##t2##_##t3##_##t4)(t1##_TYPE, t2##_TYPE, t3##_TYPE, t4##_TYPE); \
274  SHELLCOMMAND(const char* commandName, const char* className, void SHELLCOMMANDINCLASS(*function)(t1##_TYPE, t2##_TYPE, t3##_TYPE, t4##_TYPE), t1##_TYPE d1, t2##_TYPE d2, t3##_TYPE d3, t4##_TYPE d4) \
[5161]275  : ShellCommandBase(commandName, className, 4, t1##_PARAM, d1, t2##_PARAM, d2, t3##_PARAM, d3, t4##_PARAM, d4) \
[5153]276  { \
[5328]277    this->functorType = SHELLCOMMANDTYPE; \
[5153]278    this->functionPointer_4_##t1##_##t2##_##t3##_##t4 = function; \
279  }
280
[5166]281//! creates a command that takes five parameter
[5153]282#define ShellCommandConstructor5(t1,t2,t3,t4,t5) \
[5327]283  void SHELLCOMMANDINCLASS(*functionPointer_5_##t1##_##t2##_##t3##_##t4##_##t5)(t1##_TYPE, t2##_TYPE, t3##_TYPE, t4##_TYPE, t5##_TYPE); \
284  SHELLCOMMAND(const char* commandName, const char* className, void SHELLCOMMANDINCLASS(*function)(t1##_TYPE, t2##_TYPE, t3##_TYPE, t4##_TYPE, t5##_TYPE), t1##_TYPE d1, t2##_TYPE d2, t3##_TYPE d3, t4##_TYPE d4, t5##_TYPE d5) \
[5161]285  : ShellCommandBase(commandName, className, 5, t1##_PARAM, d1, t2##_PARAM, d2, t3##_PARAM, d3, t4##_PARAM, d4, t5##_PARAM, d5) \
[5153]286  { \
[5328]287    this->functorType = SHELLCOMMANDTYPE; \
[5153]288    this->functionPointer_5_##t1##_##t2##_##t3##_##t4##_##t5 = function; \
289  }
290
291///////////////
292// EXECUTION //
293///////////////
[5166]294//! execute-macro for functions with no parameters
[5153]295#define ShellCommandExecute0() \
[5145]296  if (this->paramCount == 0) \
[5326]297    SHELLCOMMANDEXECUTER(_0)()
[5145]298
[5166]299//! execute-macro for functions with one parameter
[5145]300#define ShellCommandExecute1(t1) \
[5146]301   else if (this->paramCount == 1 && this->parameters[0] == t1##_PARAM) \
[5326]302    SHELLCOMMANDEXECUTER(_1_##t1)(t1##_FUNC(parameters, t1##_DEFGRAB(0)))
[5145]303
[5166]304//! execute-macro for functions with two parameters
[5153]305#define ShellCommandExecute2(t1,t2) \
306   else if (this->paramCount == 2 && this->parameters[0] == t1##_PARAM && this->parameters[1] == t2##_PARAM) \
[5326]307    SHELLCOMMANDEXECUTER(_2_##t1##_##t2)(t1##_FUNC(sub.getString(0), t1##_DEFGRAB(0)), t2##_FUNC(sub.getString(1), t2##_DEFGRAB(1)))
[5145]308
[5166]309//! execute-macro for functions with three parameters
[5153]310#define ShellCommandExecute3(t1,t2,t3) \
311   else if (this->paramCount == 3 && this->parameters[0] == t1##_PARAM && this->parameters[1] == t2##_PARAM && this->parameters[2] == t3##_PARAM) \
[5326]312    SHELLCOMMANDEXECUTER(_3_##t1##_##t2##_##t3)(t1##_FUNC(sub.getString(0), t1##_DEFGRAB(0)), t2##_FUNC(sub.getString(1), t2##_DEFGRAB(1)), t3##_FUNC(sub.getString(2), t3##_DEFGRAB(2)))
[5153]313
[5166]314//! execute-macro for functions with four parameters
[5153]315#define ShellCommandExecute4(t1,t2,t3,t4) \
316   else if (this->paramCount == 4 && this->parameters[0] == t1##_PARAM && this->parameters[1] == t2##_PARAM && this->parameters[2] == t3##_PARAM && this->parameters[3] == t4##_PARAM) \
[5326]317    SHELLCOMMANDEXECUTER(_4_##t1##_##t2##_##t3##_##t4)(t1##_FUNC(sub.getString(0), t1##_DEFGRAB(0)), t2##_FUNC(sub.getString(1), t2##_DEFGRAB(1)), t3##_FUNC(sub.getString(2), t3##_DEFGRAB(2)), t4##_FUNC(sub.getString(3), t4##_DEFGRAB(3)))
[5153]318
[5166]319//! execute-macro for functions with five parameters
[5153]320#define ShellCommandExecute5(t1,t2,t3,t4,t5) \
321   else if (this->paramCount == 5 && this->parameters[0] == t1##_PARAM && this->parameters[1] == t2##_PARAM && this->parameters[2] == t3##_PARAM && this->parameters[3] == t4##_PARAM && this->parameters[4] == t5##_PARAM) \
[5326]322    SHELLCOMMANDEXECUTER(_5_##t1##_##t2##_##t3##_##t4##_##t5)(t1##_FUNC(sub.getString(0), t1##_DEFGRAB(0)), t2##_FUNC(sub.getString(1), t2##_DEFGRAB(1)), t3##_FUNC(sub.getString(2), t3##_DEFGRAB(2)), t4##_FUNC(sub.getString(3), t4##_DEFGRAB(3)), t5##_FUNC(sub.getString(4), t5##_DEFGRAB(4)))
[5153]323
324
[5129]325//! keeps information about a ShellCommand
326template<class T> class ShellCommand : public ShellCommandBase
327{
328  public:
[5153]329#ifdef FUNCTOR_LIST
330#undef FUNCTOR_LIST
331#endif
[5326]332#ifdef SHELLCOMMAND
333#undef SHELLCOMMAND
334#endif
[5327]335#define SHELLCOMMAND                       ShellCommand
[5326]336#ifdef SHELLCOMMANDEXECUTER
337#undef SHELLCOMMANDEXECUTER
338#endif
[5327]339#define SHELLCOMMANDEXECUTER(nameExt)      (dynamic_cast<T*>(object)->*functionPointer##nameExt)
340#ifdef SHELLCOMMANDINCLASS
341#undef SHELLCOMMANDINCLASS
342#endif
343#define SHELLCOMMANDINCLASS(FUNCTION)      (T::FUNCTION)
[5328]344#ifdef SHELLCOMMANDTYPE
345#undef SHELLCOMMANDTYPE
346#endif
347#define SHELLCOMMANDTYPE                   ShellCommand_Objective
[5166]348//! FUNCTOR_LIST is the List of command-registerers
[5142]349#define FUNCTOR_LIST(x) ShellCommandRegister ## x
[5153]350#include "functor_list.h"
[5142]351#undef FUNCTOR_LIST
[5136]352
[5142]353
[5068]354  private:
[5166]355//! FUNCTOR_LIST is the List of CommandConstructors
[5142]356#define FUNCTOR_LIST(x) ShellCommandConstructor ## x
[5153]357#include "functor_list.h"
[5142]358#undef FUNCTOR_LIST
359
360    virtual void executeCommand (BaseObject* object, const char* parameters)
[5135]361    {
[5204]362      SubString sub(parameters, true);
[5166]363//! FUNCTOR_LIST is the List of Executive Functions
[5145]364#define FUNCTOR_LIST(x) ShellCommandExecute ## x
[5153]365#include "functor_list.h"
[5135]366#undef FUNCTOR_LIST
[5145]367    }
[5129]368};
[5113]369
[5327]370//! keeps information about a ShellCommand, that points to a Static Function
[5326]371template<class T> class ShellCommandStatic : public ShellCommandBase
372{
373  public:
374#ifdef FUNCTOR_LIST
375#undef FUNCTOR_LIST
376#endif
377#ifdef SHELLCOMMAND
378#undef SHELLCOMMAND
379#endif
380#define SHELLCOMMAND                      ShellCommandStatic
381#ifdef SHELLCOMMANDEXECUTER
382#undef SHELLCOMMANDEXECUTER
383#endif
[5328]384#define SHELLCOMMANDEXECUTER(nameExt)     functionPointer##nameExt
[5327]385#ifdef SHELLCOMMANDINCLASS
386#undef SHELLCOMMANDINCLASS
387#endif
388#define SHELLCOMMANDINCLASS(FUNCTION)     (FUNCTION)
[5328]389#ifdef SHELLCOMMANDTYPE
390#undef SHELLCOMMANDTYPE
391#endif
392#define SHELLCOMMANDTYPE                   ShellCommand_Static
[5326]393
394//! FUNCTOR_LIST is the List of command-registerers
395#define FUNCTOR_LIST(x) ShellCommandRegister ## x
396#include "functor_list.h"
397#undef FUNCTOR_LIST
398
399  private:
400//! FUNCTOR_LIST is the List of CommandConstructors
401#define FUNCTOR_LIST(x) ShellCommandConstructor ## x
402#include "functor_list.h"
403#undef FUNCTOR_LIST
404
405    virtual void executeCommand (BaseObject* object, const char* parameters)
406    {
407  SubString sub(parameters, true);
408//! FUNCTOR_LIST is the List of Executive Functions
409#define FUNCTOR_LIST(x) ShellCommandExecute ## x
410#include "functor_list.h"
411#undef FUNCTOR_LIST
412    }
413};
414
[5197]415//! A Class, that handles aliases.
[5190]416class ShellCommandAlias
417{
[5196]418  friend class ShellCommandBase;
[5190]419  public:
[5197]420    /** @returns the Name of the Alias. */
[5195]421    const char* getName() const { return this->aliasName; };
[5197]422    /** @returns the Command, this Alias is asociated with */
[5195]423    ShellCommandBase* getCommand() const { return this->command; };
[5196]424
[5190]425  private:
[5197]426    /** @param aliasName the name of the Alias @param command the Command, to associate this alias with */
[5196]427    ShellCommandAlias(const char* aliasName, ShellCommandBase* command) { this->aliasName = aliasName; this->command = command; };
428
429  private:
[5197]430    const char*         aliasName;       //!< the name of the Alias
431    ShellCommandBase*   command;         //!< a pointer to the command, this alias executes.
[5190]432};
433
[5129]434#endif /* _SHELL_COMMAND_H */
Note: See TracBrowser for help on using the repository browser.