V-Gears 0
Free Final Fantasy VII engine.
ConfigCmdHandler.h
Go to the documentation of this file.
1/*
2 * Copyright (C) 2022 The V-Gears Team
3 *
4 * This file is part of V-Gears
5 *
6 * V-Gears is free software: you can redistribute it and/or modify it under
7 * terms of the GNU General Public License as published by the Free Software
8 * Foundation, version 3.0 (GPLv3) of the License.
9 *
10 * V-Gears is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
14 */
15
16#pragma once
17
18#include <OgreSingleton.h>
19#include <vector>
20#include <memory>
21#include "ConfigCmd.h"
22
26class ConfigCmdHandler : public Ogre::Singleton<ConfigCmdHandler>{
27
28 public:
29
34
39
49 void AddCommand(
50 const Ogre::String& name, const Ogre::String& description,
51 const Ogre::String& params_description, ConfigCmdParams params,
52 ConfigCmdCompletion completion
53 );
54
60 void ExecuteString( const Ogre::String& cmd_string );
61
68 ConfigCmd* Find(const Ogre::String& name) const;
69
76
82 ConfigCmd* GetConfigCmd(unsigned int i) const;
83
84 private:
85
91 ConfigCmdHandler(const ConfigCmdHandler& rhs) = delete;
92
99
105 void InitCmd();
106
110 std::vector<std::unique_ptr<ConfigCmd>> commands_;
111};
112
void(* ConfigCmdParams)(const Ogre::StringVector &params)
Definition: ConfigCmd.h:23
void(* ConfigCmdCompletion)(Ogre::StringVector &complete_params)
Definition: ConfigCmd.h:25
A handler for configuration commands.
Definition: ConfigCmdHandler.h:26
ConfigCmd * GetConfigCmd(unsigned int i) const
Retrieves a command by index.
Definition: ConfigCmdHandler.cpp:54
ConfigCmdHandler(const ConfigCmdHandler &rhs)=delete
Forbidden copy constructor.
ConfigCmdHandler operator=(const ConfigCmdHandler &rhs)=delete
Forbidden copy constructor.
~ConfigCmdHandler()
Destructor.
Definition: ConfigCmdHandler.cpp:28
void InitCmd()
Initializes the command.
Definition: ConfigCmdHandlerCommands.h:428
ConfigCmd * Find(const Ogre::String &name) const
Finds a command by name.
Definition: ConfigCmdHandler.cpp:46
void AddCommand(const Ogre::String &name, const Ogre::String &description, const Ogre::String &params_description, ConfigCmdParams params, ConfigCmdCompletion completion)
Adds a command to the manager.
Definition: ConfigCmdHandler.cpp:30
int GetConfigCmdNumber()
Counts the commands in the manager.
Definition: ConfigCmdHandler.cpp:52
std::vector< std::unique_ptr< ConfigCmd > > commands_
List of command in the manager.
Definition: ConfigCmdHandler.h:110
void ExecuteString(const Ogre::String &cmd_string)
Executes a command.
Definition: ConfigCmdHandler.cpp:44
ConfigCmdHandler()
Constructor.
Definition: ConfigCmdHandler.cpp:26
A configuration command.
Definition: ConfigCmd.h:31
Ogre::String String
Definition: TypeDefine.h:37