Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 5164 in orxonox.OLD for trunk/src/lib/shell


Ignore:
Timestamp:
Sep 5, 2005, 11:02:09 PM (19 years ago)
Author:
bensch
Message:

orxonox/trunk: ability to describe the presented options :)

Location:
trunk/src/lib/shell
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/lib/shell/shell.cc

    r5162 r5164  
    3232using namespace std;
    3333
    34 SHELL_COMMAND(clear, Shell, clear);
     34SHELL_COMMAND(clear, Shell, clear)->describe("Clears the shell from unwanted lines (empties all buffers)");
    3535
    3636/**
  • trunk/src/lib/shell/shell_command.cc

    r5163 r5164  
    3232  this->setClassID(CL_SHELL_COMMAND, "ShellCommand");
    3333  this->setName(commandName);
     34  this->description = NULL;
    3435
    3536//  this->classID = classID;
     
    217218}
    218219
     220
     221ShellCommandBase* ShellCommandBase::describe(const char* description)
     222{
     223  if (this == NULL)
     224    return NULL;
     225
     226  this->description = description;
     227  return this;
     228}
     229
     230
    219231void ShellCommandBase::debugDyn()
    220232{
     
    236248    PRINT(0)("Class %s registered command %s with %d parameters: ", elem->className, elem->getName(), elem->paramCount);
    237249    for (unsigned int i = 0; i< elem->paramCount; i++)
    238       printf(ShellCommandBase::paramToString(elem->parameters[i]));
     250      printf("%s ", ShellCommandBase::paramToString(elem->parameters[i]));
     251    if (elem->description != NULL)
     252      printf("- %s", elem->description);
    239253    printf("\n");
    240254
  • trunk/src/lib/shell/shell_command.h

    r5163 r5164  
    2323
    2424#define SHELL_COMMAND(command, class, function) \
    25         ShellCommand<class>* shell_command_##class##_##command = ShellCommand<class>::registerCommand(#command, #class, &class::function)
     25        ShellCommandBase* shell_command_##class##_##command = ShellCommand<class>::registerCommand(#command, #class, &class::function)
    2626
    2727
     
    3535    static bool execute (const char* executionString);
    3636
     37    ShellCommandBase* describe(const char* description);
     38
    3739    static const tList<ShellCommandBase>* getCommandList() { return ShellCommandBase::commandList; };
    3840
     
    6567//    long                             classID;             //!< The ID of the Class associated to this Command
    6668    const char*                      className;                            //!< The Name of the Class associated to this Command
     69
     70    const char*                      description;
    6771
    6872    // STATIC MEMBERS
Note: See TracChangeset for help on using the changeset viewer.