Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 7221 in orxonox.OLD for trunk/src/lib/shell/shell_command_class.cc


Ignore:
Timestamp:
Mar 15, 2006, 3:10:45 PM (19 years ago)
Author:
bensch
Message:

orxonox/trunk: merged the std-branche back, it runs on windows and Linux

svn merge https://svn.orxonox.net/orxonox/branches/std . -r7202:HEAD

File:
1 edited

Legend:

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

    r5780 r7221  
    3636 * @param className the Name of the command-class to create
    3737 */
    38 ShellCommandClass::ShellCommandClass(const char* className)
     38ShellCommandClass::ShellCommandClass(const std::string& className)
     39  : className(className)
    3940{
    4041  this->setClassID(CL_SHELL_COMMAND_CLASS, "ShellCommandClass");
    4142  this->setName(className);
    4243
    43   this->className = className;
    4444  this->classID = CL_NULL;
    4545
     
    6565 * @returns true on success, false otherwise
    6666 */
    67 bool ShellCommandClass::getCommandListOfClass(const char* className, std::list<const char*>* stringList)
    68 {
    69   if (stringList == NULL || className == NULL)
     67bool ShellCommandClass::getCommandListOfClass(const std::string& className, std::list<std::string>* stringList)
     68{
     69  if (stringList == NULL)
    7070    return false;
    7171
     
    7373  for(elem = ShellCommandClass::commandClassList->begin(); elem != ShellCommandClass::commandClassList->end(); elem++)
    7474  {
    75     if (!strcmp ((*elem)->getName(), className))
     75    if (className == (*elem)->getName())
    7676    {
    7777      list<ShellCommand*>::iterator command;
     
    8888 * @returns true on success, false otherwise
    8989 */
    90 bool ShellCommandClass::getCommandListOfAlias(std::list<const char*>* stringList)
     90bool ShellCommandClass::getCommandListOfAlias(std::list<std::string>* stringList)
    9191{
    9292  if (stringList == NULL || ShellCommandClass::aliasList == NULL)
     
    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)
     
    138138  for (classIT = ShellCommandClass::commandClassList->begin(); classIT != ShellCommandClass::commandClassList->end(); classIT++)
    139139  {
    140     if (!strcmp(className, (*classIT)->className))
     140    if (className == (*classIT)->className)
    141141    {
    142142      if ((*classIT)->classID == CL_NULL)
     
    154154 * @returns the CommandClass if found, or a new CommandClass if not
    155155 */
    156 ShellCommandClass* ShellCommandClass::getCommandClass(const char* className)
     156ShellCommandClass* ShellCommandClass::getCommandClass(const std::string& className)
    157157{
    158158  if (ShellCommandClass::commandClassList == NULL)
     
    162162  for (classIT = ShellCommandClass::commandClassList->begin(); classIT != ShellCommandClass::commandClassList->end(); classIT++)
    163163  {
    164     if (!strcmp(className, (*classIT)->className))
     164    if (className == (*classIT)->className)
    165165    {
    166166      return (*classIT);
     
    186186 * @param className: the Class of Commands to show help about
    187187 */
    188 void ShellCommandClass::help(const char* className)
    189 {
    190   if (className == NULL)
    191     return;
     188void ShellCommandClass::help(const std::string& className)
     189{
    192190  if (likely(ShellCommandClass::commandClassList != NULL))
    193191  {
     
    195193    for (classIT = ShellCommandClass::commandClassList->begin(); classIT != ShellCommandClass::commandClassList->end(); classIT++)
    196194    {
    197       if ((*classIT)->className && !strcasecmp(className, (*classIT)->className))
     195      if (className == (*classIT)->className)
    198196      {
    199         PRINT(0)("Class:'%s' registered %d commands: \n", (*classIT)->className, (*classIT)->commandList.size());
     197        PRINT(0)("Class:'%s' registered %d commands: \n", (*classIT)->className.c_str(), (*classIT)->commandList.size());
    200198        list<ShellCommand*>::const_iterator cmdIT;
    201199        for (cmdIT = (*classIT)->commandList.begin(); cmdIT != (*classIT)->commandList.end(); cmdIT++)
     
    205203          /*          for (unsigned int i = 0; i< elem->paramCount; i++)
    206204            PRINT(0)("%s ", ShellCommand::paramToString(elem->parameters[i]));*/
    207           if ((*cmdIT)->description != NULL)
    208             PRINT(0)("- %s", (*cmdIT)->description);
     205          if (!(*cmdIT)->description.empty())
     206            PRINT(0)("- %s", (*cmdIT)->description.c_str());
    209207          PRINT(0)("\n");
    210208        }
     
    212210      }
    213211    }
    214     PRINTF(3)("Class %s not found in Command's classes\n", className);
     212    PRINTF(3)("Class %s not found in Command's classes\n", className.c_str());
    215213  }
    216214  else
Note: See TracChangeset for help on using the changeset viewer.