Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 7387 in orxonox.OLD for trunk/src


Ignore:
Timestamp:
Apr 26, 2006, 10:45:12 PM (19 years ago)
Author:
bensch
Message:

orxonox/trunk: new Completor

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

Legend:

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

    r7377 r7387  
    3737  }
    3838
     39
     40
     41  CompletorList::CompletorList(const std::list<std::string>* list)
     42  {
     43    this->_list = list;
     44  }
     45
     46  void CompletorList::addToCompleteList(std::vector<std::string>& completionList, const std::string& completionBegin)
     47  {
     48    unsigned int inputLen = completionBegin.size();
     49    std::list<std::string>::const_iterator it;
     50    for (it = this->_list->begin(); it != this->_list->end(); ++it)
     51      if (!nocaseCmp((*it), completionBegin, inputLen))
     52        completionList.push_back(*it);
     53  }
     54
     55
     56
    3957  CompletorFileSystem::CompletorFileSystem(const std::string& fileExtension,
    4058      StartDirectory startDir,
     
    4260  : _fileExtension(fileExtension), _startDir(startDir), _subDir(subDir)
    4361  {  }
     62
    4463
    4564  void CompletorFileSystem::addToCompleteList(std::vector<std::string>& completionList, const std::string& completionBegin)
  • trunk/src/lib/shell/shell_completion_plugin.h

    r7386 r7387  
    1919      virtual void addToCompleteList(std::vector<std::string>& completionList, const std::string& completionBegin) = 0;
    2020      virtual ~Completor() { };
    21 
    2221    protected:
    2322      Completor();
    2423  };
     24
     25
     26
    2527
    2628  //! Completor that completes static Arrays of Strings.
     
    3638      unsigned int         _size;
    3739  };
     40
     41
     42  class CompletorList : public Completor
     43  {
     44    public:
     45      CompletorList(const std::list<std::string>* list);
     46      virtual void addToCompleteList(std::vector<std::string>& completionList, const std::string& completionBegin);
     47    private:
     48      const std::list<std::string>* _list;
     49  };
     50
     51
    3852
    3953  //! Completor that completes FileSystem Entries.
     
    6074      StartDirectory          _startDir;
    6175  };
     76
     77
    6278
    6379
Note: See TracChangeset for help on using the changeset viewer.