Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

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


Ignore:
Timestamp:
Mar 15, 2006, 3:10:45 PM (18 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_completion.cc

    r5885 r7221  
    7676
    7777  // Check if we are in a input. eg. the supplied string "class " and now we complete either function or object
    78   if (this->input->getInput() != NULL &&
    79       strrchr(this->input->getInput(), ' ') >= this->input->getInput() + strlen(this->input->getInput())-1)
     78  if (this->input->getInput()[this->input->getInput().size()-1] == ' ')
    8079  {
    8180    emptyComplete = true;
     
    8382
    8483  // CREATE INPUTS
    85   if (this->input->getInput() == NULL)
    86     completionLine = "";
    87   else
    88     completionLine = this->input->getInput() + strspn(this->input->getInput(), " \t\n");
    89   SubString inputSplits(completionLine, " \t\n,");
     84  SubString inputSplits(this->input->getInput(), " \t\n,");
    9085
    9186  // What String will be completed
     
    9388    completeString = "";
    9489  else
    95     completeString = inputSplits.getString(inputSplits.getCount()-1);
     90    completeString = inputSplits.getString(inputSplits.getCount()-1).c_str();
    9691
    9792  // CLASS COMPLETION
     
    111106            (inputSplits.getCount() == 2 && emptyComplete == false))
    112107  {
    113     classID = ClassList::StringToID(inputSplits.getString(0));
     108    classID = ClassList::StringToID(inputSplits.getString(0).c_str()); //FIXME
    114109    objectList = ClassList::getList((ClassID)classID);
    115110    if (classID != CL_NULL)
     
    121116            (inputSplits.getCount() == 3 && emptyComplete == false))
    122117  {
    123     classID = ClassList::StringToID(inputSplits.getString(0));
     118    classID = ClassList::StringToID(inputSplits.getString(0) .c_str()); // FIXME
    124119    if (classID == CL_NULL)
    125120      return false;
     
    133128    this->objectComplete(completeString, classID);
    134129  if (completeType & SHELLC_FUNCTION)
    135     this->functionComplete(completeString, inputSplits.getString(0));
     130    this->functionComplete(completeString, inputSplits.getString(0).c_str()); // FIXME
    136131  if (completeType & SHELLC_ALIAS)
    137132    this->aliasComplete(completeString);
     
    151146  if (unlikely(classBegin == NULL))
    152147    return false;
    153   const std::list<const char*>* clList = ClassList::getClassNames();
     148  const std::list<std::string>* clList = ClassList::getClassNames();
    154149  if (clList != NULL)
    155150  {
     
    195190  if (unlikely(functionBegin == NULL))
    196191    return false;
    197   std::list<const char*> fktList;
     192  std::list<std::string> fktList;
    198193  ShellCommandClass::getCommandListOfClass(className, &fktList);
    199194  //printf("%s\n", boList->firstElement()->getName());
     
    212207  if (unlikely(aliasBegin == NULL))
    213208    return false;
    214   std::list<const char*> aliasList;
     209  std::list<std::string> aliasList;
    215210  ShellCommandClass::getCommandListOfAlias(&aliasList);
    216211  //printf("%s\n", boList->firstElement()->getName());
     
    295290 * !! The strings MUST NOT be deleted !!
    296291 */
    297 bool ShellCompletion::addToCompleteList(const std::list<const char*>* inputList, const char* completionBegin, SHELLC_TYPE type)
     292bool ShellCompletion::addToCompleteList(const std::list<std::string>* inputList, const char* completionBegin, SHELLC_TYPE type)
    298293{
    299294  if (inputList == NULL || completionBegin == NULL)
     
    301296  unsigned int searchLength = strlen(completionBegin);
    302297
    303   list<const char*>::const_iterator string;
     298  list<std::string>::const_iterator string;
    304299  for (string = inputList->begin(); string != inputList->end(); string++)
    305300  {
    306     if (strlen(*string) >= searchLength &&
    307         !strncasecmp(*string, completionBegin, searchLength))
     301    if ((*string).size() >= searchLength &&
     302          !strncasecmp((*string).c_str(), completionBegin, searchLength))
    308303    {
    309304      ShellC_Element newElem;
    310       newElem.name = *string;
     305      newElem.name = (*string).c_str();
    311306      newElem.type = type;
    312307      this->completionList.push_back(newElem);
Note: See TracChangeset for help on using the changeset viewer.