Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

source: orxonox.OLD/trunk/src/lib/shell/shell_completion_plugin.cc @ 7387

Last change on this file since 7387 was 7387, checked in by bensch, 18 years ago

orxonox/trunk: new Completor

File size: 1.9 KB
Line 
1/*
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.
10
11   ### File Specific:
12   main-programmer: Benjamin Grauer
13   co-programmer: ...
14*/
15
16#define DEBUG_SPECIAL_MODULE DEBUG_MODULE_SHELL
17
18#include "shell_completion_plugin.h"
19#include "shell_command_class.h"
20
21#include "shell_command.h"
22
23#include "substring.h"
24#include "class_list.h"
25#include "debug.h"
26
27namespace OrxShell
28{
29
30
31  void CompletorStringArray::addToCompleteList(std::vector<std::string>& completionList, const std::string& completionBegin)
32  {
33    unsigned int inputLen = completionBegin.size();
34    for (unsigned int i = 0; i < this->_size; ++i)
35      if (!nocaseCmp(this->_stringArray[i], completionBegin, inputLen))
36        completionList.push_back(this->_stringArray[i]);
37  }
38
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
57  CompletorFileSystem::CompletorFileSystem(const std::string& fileExtension,
58      StartDirectory startDir,
59      const std::string& subDir)
60  : _fileExtension(fileExtension), _startDir(startDir), _subDir(subDir)
61  {  }
62
63
64  void CompletorFileSystem::addToCompleteList(std::vector<std::string>& completionList, const std::string& completionBegin)
65  {
66    if (completionBegin.empty()) // if we do not yet have the beginning of the line, start with the chosen startDir.
67    {
68
69
70    }
71  }
72
73}
74
Note: See TracBrowser for help on using the repository browser.