[4744] | 1 | /* |
---|
[1853] | 2 | orxonox - the future of 3D-vertical-scrollers |
---|
| 3 | |
---|
| 4 | Copyright (C) 2004 orx |
---|
| 5 | |
---|
| 6 | This program is free software; you can redistribute it and/or modify |
---|
| 7 | it under the terms of the GNU General Public License as published by |
---|
| 8 | the Free Software Foundation; either version 2, or (at your option) |
---|
| 9 | any later version. |
---|
[1855] | 10 | |
---|
| 11 | ### File Specific: |
---|
[5254] | 12 | main-programmer: Benjamin Grauer |
---|
[1855] | 13 | co-programmer: ... |
---|
[1853] | 14 | */ |
---|
| 15 | |
---|
[7374] | 16 | #define DEBUG_SPECIAL_MODULE DEBUG_MODULE_SHELL |
---|
[1853] | 17 | |
---|
[7374] | 18 | #include "shell_completion_plugin.h" |
---|
[5639] | 19 | #include "shell_command_class.h" |
---|
[1853] | 20 | |
---|
[5194] | 21 | #include "shell_command.h" |
---|
[5181] | 22 | |
---|
[5183] | 23 | #include "substring.h" |
---|
[5178] | 24 | #include "class_list.h" |
---|
| 25 | #include "debug.h" |
---|
| 26 | |
---|
[7374] | 27 | namespace OrxShell |
---|
[5178] | 28 | { |
---|
[7377] | 29 | void CompletorStringArray::addToCompleteList(std::vector<std::string>& completionList, const std::string& completionBegin) |
---|
[5184] | 30 | { |
---|
[7374] | 31 | unsigned int inputLen = completionBegin.size(); |
---|
| 32 | for (unsigned int i = 0; i < this->_size; ++i) |
---|
| 33 | if (!nocaseCmp(this->_stringArray[i], completionBegin, inputLen)) |
---|
| 34 | completionList.push_back(this->_stringArray[i]); |
---|
[5184] | 35 | } |
---|
| 36 | |
---|
[7387] | 37 | |
---|
| 38 | |
---|
| 39 | CompletorList::CompletorList(const std::list<std::string>* list) |
---|
| 40 | { |
---|
| 41 | this->_list = list; |
---|
| 42 | } |
---|
| 43 | |
---|
| 44 | void CompletorList::addToCompleteList(std::vector<std::string>& completionList, const std::string& completionBegin) |
---|
| 45 | { |
---|
| 46 | unsigned int inputLen = completionBegin.size(); |
---|
| 47 | std::list<std::string>::const_iterator it; |
---|
| 48 | for (it = this->_list->begin(); it != this->_list->end(); ++it) |
---|
| 49 | if (!nocaseCmp((*it), completionBegin, inputLen)) |
---|
| 50 | completionList.push_back(*it); |
---|
| 51 | } |
---|
| 52 | |
---|
| 53 | |
---|
| 54 | |
---|
[7377] | 55 | CompletorFileSystem::CompletorFileSystem(const std::string& fileExtension, |
---|
| 56 | StartDirectory startDir, |
---|
| 57 | const std::string& subDir) |
---|
| 58 | : _fileExtension(fileExtension), _startDir(startDir), _subDir(subDir) |
---|
| 59 | { } |
---|
| 60 | |
---|
[7387] | 61 | |
---|
[7377] | 62 | void CompletorFileSystem::addToCompleteList(std::vector<std::string>& completionList, const std::string& completionBegin) |
---|
| 63 | { |
---|
| 64 | if (completionBegin.empty()) // if we do not yet have the beginning of the line, start with the chosen startDir. |
---|
| 65 | { |
---|
| 66 | |
---|
| 67 | |
---|
| 68 | } |
---|
| 69 | } |
---|
| 70 | |
---|
| 71 | } |
---|
| 72 | |
---|