Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

source: code/branches/consolecommands3/src/libraries/core/command/CommandExecutor.h @ 7221

Last change on this file since 7221 was 7221, checked in by landauf, 14 years ago

adapted CommandExecutor and CommandEvaluation to make it compile again, but it doesn't run yet. ready for refactoring.

  • Property svn:eol-style set to native
File size: 3.5 KB
Line 
1/*
2 *   ORXONOX - the hottest 3D action shooter ever to exist
3 *                    > www.orxonox.net <
4 *
5 *
6 *   License notice:
7 *
8 *   This program is free software; you can redistribute it and/or
9 *   modify it under the terms of the GNU General Public License
10 *   as published by the Free Software Foundation; either version 2
11 *   of the License, or (at your option) any later version.
12 *
13 *   This program is distributed in the hope that it will be useful,
14 *   but WITHOUT ANY WARRANTY; without even the implied warranty of
15 *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
16 *   GNU General Public License for more details.
17 *
18 *   You should have received a copy of the GNU General Public License
19 *   along with this program; if not, write to the Free Software
20 *   Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
21 *
22 *   Author:
23 *      Fabian 'x3n' Landau
24 *   Co-authors:
25 *      ...
26 *
27 */
28
29#ifndef _CommandExecutor_H__
30#define _CommandExecutor_H__
31
32#include "core/CorePrereqs.h"
33
34#include <map>
35#include <set>
36#include <string>
37
38#include "util/MultiType.h"
39#include "CommandEvaluation.h"
40
41// tolua_begin
42namespace orxonox
43{
44    class _CoreExport CommandExecutor
45    {
46// tolua_end
47        public:
48            static bool execute(const std::string& command, bool useTcl = true); // tolua_export
49
50            static MultiType queryMT(const std::string& command, bool* success = 0, bool useTcl = true);
51            static std::string query(const std::string& command, bool* success = 0, bool useTcl = true); // tolua_export
52
53            static std::string complete(const std::string& command);
54            static std::string hint(const std::string& command);
55
56            static CommandEvaluation evaluate(const std::string& command);
57
58        private:
59            CommandExecutor() {}
60            CommandExecutor(const CommandExecutor& other);
61            ~CommandExecutor() {}
62
63            static CommandExecutor& getInstance();
64            static CommandEvaluation& getEvaluation();
65
66            static void parseIfNeeded(const std::string& command);
67            static void parse(const std::string& command, bool bInitialize = true);
68
69            static unsigned int argumentsFinished();
70            static unsigned int argumentsGiven();
71            static bool enoughArgumentsGiven(_ConsoleCommand* command);
72            static const std::string& getArgument(unsigned int index);
73            static const std::string& getLastArgument();
74
75            static void createListOfPossibleIdentifiers(const std::string& fragment);
76            static void createListOfPossibleFunctions(const std::string& fragment, Identifier* identifier = 0);
77            static void createListOfPossibleArguments(const std::string& fragment, _ConsoleCommand* command, unsigned int param);
78
79            static Identifier* getPossibleIdentifier(const std::string& name);
80            static _ConsoleCommand* getPossibleCommand(const std::string& name, Identifier* identifier = 0);
81            static const std::string& getPossibleArgument(const std::string& name, _ConsoleCommand* command, unsigned int param);
82
83            static void createArgumentCompletionList(_ConsoleCommand* command, unsigned int param);
84            static std::string getCommonBegin(const std::list<std::pair<const std::string*, const std::string*> >& list);
85            static std::string getCommonBegin(const ArgumentCompletionList& list);
86
87            CommandEvaluation evaluation_;
88    }; // tolua_export
89} // tolua_export
90
91#endif /* _CommandExecutor_H__ */
Note: See TracBrowser for help on using the repository browser.