/* orxonox - the future of 3D-vertical-scrollers Copyright (C) 2004 orx This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2, or (at your option) any later version. ### File Specific: main-programmer: Benjamin Grauer co-programmer: ... */ #define DEBUG_SPECIAL_MODULE DEBUG_MODULE_SHELL #include "shell_completion_plugin.h" #include "shell_command_class.h" #include "shell_command.h" #include "substring.h" #include "class_list.h" #include "debug.h" namespace OrxShell { CompletorDefault::CompletorDefault(const MultiType* value) :_value(value) { } void CompletorDefault::addToCompleteList(std::vector& completionList, const std::string& completionBegin) const { PRINT(0)("Requires '%s'\n", MultiType::MultiTypeToString(this->_value->getType()).c_str()); } CompletorPlugin* CompletorDefault::clone() const { return new CompletorDefault(this->_value); } void CompletorStringArray::addToCompleteList(std::vector& completionList, const std::string& completionBegin) const { printf("TEST\n"); unsigned int inputLen = completionBegin.size(); for (unsigned int i = 0; i < this->_size; ++i) { printf("%s\n", this->_stringArray[i].c_str()); if (!nocaseCmp(this->_stringArray[i], completionBegin, inputLen)) completionList.push_back(this->_stringArray[i]); } } CompletorPlugin* CompletorStringArray::clone() const { return new CompletorStringArray(this->_stringArray, this->_size); } CompletorList::CompletorList(const std::list* list) { this->_list = list; } void CompletorList::addToCompleteList(std::vector& completionList, const std::string& completionBegin) const { unsigned int inputLen = completionBegin.size(); std::list::const_iterator it; for (it = this->_list->begin(); it != this->_list->end(); ++it) if (!nocaseCmp((*it), completionBegin, inputLen)) completionList.push_back(*it); } CompletorPlugin* CompletorList::clone() const { return new CompletorList(this->_list); } CompletorFileSystem::CompletorFileSystem(const std::string& fileExtension, StartDirectory startDir, const std::string& subDir) : _fileExtension(fileExtension), _startDir(startDir), _subDir(subDir) { } void CompletorFileSystem::addToCompleteList(std::vector& completionList, const std::string& completionBegin) const { if (completionBegin.empty()) // if we do not yet have the beginning of the line, start with the chosen startDir. { } } CompletorPlugin* CompletorFileSystem::clone() const { return new CompletorFileSystem(this->_fileExtension, this->_startDir, this->_subDir); } }