Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

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


Ignore:
Timestamp:
Apr 19, 2006, 4:33:55 AM (19 years ago)
Author:
bensch
Message:

orxonox/trunk: c_str() removed

File:
1 edited

Legend:

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

    r7343 r7344  
    4848/**
    4949 * @brief autocompletes the Shell's inputLine
     50 * @param input the input to complete.
    5051 * @returns true, if a result was found, false otherwise
    5152 */
     
    5859  bool emptyComplete = false;           //< if the completion input is empty string. e.g ""
    5960  long completeType = SHELLC_NONE;      //< the Type we'd like to complete.
    60   const char* completeString;           //< the string to complete.
     61  std::string completeString;           //< the string to complete.
    6162
    6263
     
    6667  // Check if we are in a input. eg. the supplied string "class " and now we complete either function or object
    6768  if (input[input.size()-1] == ' ')
    68   {
    6969    emptyComplete = true;
    70   }
    7170
    7271  // CREATE INPUTS
    73   SubString inputSplits(input, " \t\n,");
     72  SubString inputSplits(input, SubString::WhiteSpacesWithComma);
    7473
    7574  // What String will be completed
     
    7776    completeString = "";
    7877  else
    79     completeString = inputSplits.getString(inputSplits.size()-1).c_str();
     78    completeString = inputSplits.getString(inputSplits.size()-1);
    8079
    8180  // CLASS COMPLETION
     
    9594            (inputSplits.size() == 2 && emptyComplete == false))
    9695  {
    97     classID = ClassList::StringToID(inputSplits.getString(0).c_str()); //FIXME
     96    classID = ClassList::StringToID(inputSplits.getString(0));
    9897    objectList = ClassList::getList((ClassID)classID);
    9998    if (classID != CL_NULL)
     
    105104            (inputSplits.size() == 3 && emptyComplete == false))
    106105  {
    107     classID = ClassList::StringToID(inputSplits.getString(0) .c_str()); // FIXME
     106    classID = ClassList::StringToID(inputSplits.getString(0));
    108107    if (classID == CL_NULL)
    109108      return false;
     
    117116    this->objectComplete(completeString, classID);
    118117  if (completeType & SHELLC_FUNCTION)
    119     this->functionComplete(completeString, inputSplits.getString(0).c_str()); // FIXME
     118    this->functionComplete(completeString, inputSplits.getString(0));
    120119  if (completeType & SHELLC_ALIAS)
    121120    this->aliasComplete(completeString);
     
    199198/**
    200199 * @brief completes the inputline on grounds of an inputList
     200 * @param input the Input to complete.
    201201 * @param begin the String to search in the inputList, and to extend with it.
    202202 * @param displayAs how to display the found value to the user, printf-style, !!with only one %s!! ex.: "::%s::"
Note: See TracChangeset for help on using the changeset viewer.