Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 7219 in orxonox.OLD for branches/std/src/lib/shell


Ignore:
Timestamp:
Mar 12, 2006, 5:14:44 PM (19 years ago)
Author:
bensch
Message:

orxonox/std: less char*

Location:
branches/std/src/lib/shell
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • branches/std/src/lib/shell/shell_command.cc

    r7218 r7219  
    4141  PRINTF(5)("create shellcommand %s %s\n", commandName, className);
    4242  this->setName(commandName);
    43   this->description = NULL;
    44   this->alias = NULL;
    4543  this->executor = executor.clone();
    4644  this->executor->setName(commandName);
     
    177175      for (alias = ShellCommandClass::aliasList->begin(); alias != ShellCommandClass::aliasList->end(); alias++ )
    178176      {
    179         if ((*alias)->getName() != NULL && inputSplits.getString(0) == (*alias)->getName() && (*alias)->getCommand() != NULL &&
     177        if (inputSplits.getString(0) == (*alias)->getName() && (*alias)->getCommand() != NULL &&
    180178            (*alias)->getCommand()->shellClass != NULL )
    181179        {
     
    258256 * @param description the description of the Given command
    259257 */
    260 ShellCommand* ShellCommand::describe(const char* description)
     258ShellCommand* ShellCommand::describe(const std::string& description)
    261259{
    262260  if (this == NULL)
     
    338336      /*      for (unsigned int i = 0; i< elem->paramCount; i++)
    339337       printf("%s ", ShellCommand::paramToString(elem->parameters[i]));*/
    340       if ((*cmdIT)->description != NULL)
    341        printf("- %s", (*cmdIT)->description);
     338      if (!(*cmdIT)->description.empty())
     339        printf("- %s", (*cmdIT)->description.c_str());
    342340      printf("\n");
    343341
  • branches/std/src/lib/shell/shell_command.h

    r7216 r7219  
    6363    static bool execute (const std::string& executionString);
    6464
    65     ShellCommand* describe(const char* description);
     65    ShellCommand* describe(const std::string& description);
    6666    ShellCommand* setAlias(const char* alias);
    6767    ShellCommand* defaultValues(const MultiType& value0 = MT_NULL, const MultiType& value1 = MT_NULL,
     
    8989    ShellCommandAlias*               alias;                                //!< An Alias for the Class.
    9090
    91     const char*                      description;                          //!< A description for this commnand. (initially NULL). Assigned with (create)->describe("blablabla");
     91    std::string                      description;                          //!< A description for this commnand. (initially NULL). Assigned with (create)->describe("blablabla");
    9292    Executor*                        executor;                             //!< The Executor, that really executes the Function.
    9393
     
    100100  public:
    101101    /** @returns the Name of the Alias. */
    102     const char* getName() const { return this->aliasName; };
     102    const std::string& getName() const { return this->aliasName; };
    103103    /** @returns the Command, this Alias is asociated with */
    104104    ShellCommand* getCommand() const { return this->command; };
     
    106106  private:
    107107    /** @param aliasName the name of the Alias @param command the Command, to associate this alias with */
    108     ShellCommandAlias(const char* aliasName, ShellCommand* command) { this->aliasName = aliasName; this->command = command; };
     108    ShellCommandAlias(const std::string& aliasName, ShellCommand* command) { this->aliasName = aliasName; this->command = command; };
    109109
    110110  private:
    111     const char*     aliasName;       //!< the name of the Alias
     111    std::string     aliasName;       //!< the name of the Alias
    112112    ShellCommand*   command;         //!< a pointer to the command, this alias executes.
    113113};
  • branches/std/src/lib/shell/shell_command_class.cc

    r7216 r7219  
    130130 * @returns the CommandClass if found, NULL otherwise
    131131 */
    132 const ShellCommandClass* ShellCommandClass::isRegistered(const char* className)
     132const ShellCommandClass* ShellCommandClass::isRegistered(const std::string& className)
    133133{
    134134  if (ShellCommandClass::commandClassList == NULL)
     
    203203          /*          for (unsigned int i = 0; i< elem->paramCount; i++)
    204204            PRINT(0)("%s ", ShellCommand::paramToString(elem->parameters[i]));*/
    205           if ((*cmdIT)->description != NULL)
    206             PRINT(0)("- %s", (*cmdIT)->description);
     205          if (!(*cmdIT)->description.empty())
     206            PRINT(0)("- %s", (*cmdIT)->description.c_str());
    207207          PRINT(0)("\n");
    208208        }
  • branches/std/src/lib/shell/shell_command_class.h

    r7216 r7219  
    3939    virtual ~ShellCommandClass();
    4040
    41     static const ShellCommandClass* isRegistered(const char* className);
     41    static const ShellCommandClass* isRegistered(const std::string& className);
    4242    static void initCommandClassList();
    4343
Note: See TracChangeset for help on using the changeset viewer.