Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

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


Ignore:
Timestamp:
Apr 28, 2006, 11:31:09 AM (19 years ago)
Author:
bensch
Message:

orxonox/trunk: Better implementation

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

Legend:

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

    r7417 r7418  
    168168      {
    169169        assert ((*alias)->getCommand() != NULL && (*alias)->getCommand()->shellClass != NULL);
     170        // Search for Objects.
     171        if (strings.size() == 1)
     172          fillObjectList("", (*alias)->getCommand(), boList);
     173        else
     174        {
     175          if (!fillObjectList(strings[1], (*alias)->getCommand(), boList))
     176            fillObjectList("", (*alias)->getCommand(), boList);
     177        }
    170178        return (*alias)->getCommand();
    171179      }
     
    180188      if (strings.size() >= 1)
    181189      {
     190        // Search for Objects.
    182191        retCmd = ShellCommand::getCommand(strings[1], cmdClass);
    183192        if (retCmd != NULL)
    184193        {
    185194          paramBegin = 2;
     195          fillObjectList("", retCmd, boList);
    186196          return retCmd;
    187197        }
     
    194204        {
    195205          paramBegin = 3;
     206          fillObjectList(strings[1], retCmd, boList);
    196207          return retCmd;
    197208        }
     
    205216  }
    206217
    207   bool ShellCommand::fillObjectList(const std::string& objectDescriptor, ShellCommand* cmd, std::vector<BaseObject*>* boList)
    208   {
    209     assert (cmd != NULL && cmd->shellClass != NULL && boList != NULL);
     218  /**
     219   * @brief fills the ObjectList boList with Objects that can be reffered to by cmd.
     220   * @param objectDescriptor: the ObjectName (beginning, full name or empty) to fill the List with
     221   * @param cmd: The Command to complete Objects for.
     222   * @param boList: The List of BaseObject's that will be filled with found entries.
     223   * @returns: true if more than one Entry was fond, else (false , or if boList is NULL).
     224   */
     225  bool ShellCommand::fillObjectList(const std::string& objectDescriptor, const ShellCommand* cmd, std::vector<BaseObject*>* boList)
     226  {
     227    assert (cmd != NULL && cmd->shellClass != NULL);
     228    if(boList == NULL)
     229      return false;
    210230
    211231    const std::list<BaseObject*>* objectList = ClassList::getList(cmd->shellClass->getName());
     
    228248      }
    229249    }
     250    return !boList->empty();
    230251  }
    231252
  • trunk/src/lib/shell/shell_command.h

    r7417 r7418  
    9090    virtual ~ShellCommand();
    9191
    92     static bool fillObjectList(const std::string& objectDescriptor, ShellCommand* cmd, std::vector<BaseObject*>* boList);
     92    static bool fillObjectList(const std::string& objectDescriptor, const ShellCommand* cmd, std::vector<BaseObject*>* boList);
    9393    static const std::string& paramToString(long parameter);
    9494
Note: See TracChangeset for help on using the changeset viewer.