Divide Framework 0.1
A free and open-source 3D Framework under heavy development
Loading...
Searching...
No Matches
GUIConsoleCommandParser.h
Go to the documentation of this file.
1/*
2 Copyright (c) 2018 DIVIDE-Studio
3 Copyright (c) 2009 Ionut Cava
4
5 This file is part of DIVIDE Framework.
6
7 Permission is hereby granted, free of charge, to any person obtaining a copy
8 of this software
9 and associated documentation files (the "Software"), to deal in the Software
10 without restriction,
11 including without limitation the rights to use, copy, modify, merge, publish,
12 distribute, sublicense,
13 and/or sell copies of the Software, and to permit persons to whom the
14 Software is furnished to do so,
15 subject to the following conditions:
16
17 The above copyright notice and this permission notice shall be included in
18 all copies or substantial portions of the Software.
19
20 THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
21 IMPLIED,
22 INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A
23 PARTICULAR PURPOSE AND NONINFRINGEMENT.
24 IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
25 DAMAGES OR OTHER LIABILITY,
26 WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR
27 IN CONNECTION WITH THE SOFTWARE
28 OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
29
30 */
31
32#pragma once
33#ifndef DVD_GUI_CONSOLE_COMMAND_PARSER_H_
34#define DVD_GUI_CONSOLE_COMMAND_PARSER_H_
35
39
40namespace Divide {
41
42class AudioDescriptor;
44
45class PlatformContext;
47 public:
49
50 [[nodiscard]] bool processCommand(const string& commandString) override;
51
52 private:
53 using CommandMap = hashMap<U64 /*command name*/, DELEGATE_STD<void, string /*args*/> >;
54
55 void handleSayCommand(const string& args);
56 void handleQuitCommand(const string& args);
57 void handleHelpCommand(const string& args);
58 void handleEditParamCommand(const string& args);
59 void handlePlaySoundCommand(const string& args);
60 void handleNavMeshCommand(const string& args);
61 void handleShaderRecompileCommand(const string& args);
62 void handleFOVCommand(const string& args);
63 void handleInvalidCommand(const string& args);
64
65 private:
69 Handle<AudioDescriptor> _sound{INVALID_HANDLE<AudioDescriptor>};
70};
71
72}; // namespace Divide
73
74#endif //DVD_GUI_CONSOLE_COMMAND_PARSER_H_
#define TYPEDEF_SMART_POINTERS_FOR_TYPE(T)
A utility class used to process a string input.
Definition: CommandParser.h:39
void handleNavMeshCommand(const string &args)
void handleHelpCommand(const string &args)
hashMap< U64, DELEGATE_STD< void, string > > CommandMap
void handleEditParamCommand(const string &args)
Handle< AudioDescriptor > _sound
used for sound playback
hashMap< U64, const char * > _commandHelp
Help text for every command.
void handleShaderRecompileCommand(const string &args)
void handleQuitCommand(const string &args)
void handleInvalidCommand(const string &args)
void handleSayCommand(const string &args)
void handlePlaySoundCommand(const string &args)
bool processCommand(const string &commandString) override
If we need a parser , just override this.
PlatformContext & context() noexcept
Handle console commands that start with a forward slash.
Definition: AIProcessor.cpp:7
std::function< Ret(Args...) > DELEGATE_STD
hashAlg::unordered_map< K, V, HashFun, Predicate > hashMap
Definition: HashMap.h:55
uint64_t U64