lintel 0.2.0
Loading...
Searching...
No Matches
AbstractCommandLineMenu.h
Go to the documentation of this file.
1#ifndef LINTEL_ABSTRACTCOMMANDLINEMENU_H
2#define LINTEL_ABSTRACTCOMMANDLINEMENU_H
3
4#include <map>
5#include <memory>
6#include <string>
7#include <vector>
8
10
11namespace lintel {
14{
15private:
16 std::vector<std::shared_ptr<CommandLineComponent>> m_components;
17 std::map<std::string_view, std::shared_ptr<CommandLineComponent>> m_componentMap;
18 std::shared_ptr<CommandLineComponent> m_current = nullptr;
19
21 static std::map<std::string_view, std::shared_ptr<CommandLineComponent>> build(
22 const std::vector<std::shared_ptr<CommandLineComponent>> &components);
23
24public:
26 explicit AbstractCommandLineMenu(const std::vector<std::shared_ptr<CommandLineComponent>> &components);
27
29 void onShowMenu();
30
32 std::set<std::string> allMenuEntriesOf();
33
35 bool onMenu(const std::string &command);
36
38 bool onExit();
39
42
44 void onCommand(const UserDto &userDto, const std::string &command, const std::vector<std::string> &parameters);
45
47 std::vector<std::string> allCommandsOf();
48
50 void onHelp();
51
53 const std::shared_ptr<CommandLineComponent> &currentOf();
54};
55
56}// namespace lintel
57#endif// LINTEL_ABSTRACTCOMMANDLINEMENU_H
Definition AbstractCommandLineMenu.h:14
AbstractCommandLineMenu(const std::vector< std::shared_ptr< CommandLineComponent > > &components)
void onCommand(const UserDto &userDto, const std::string &command, const std::vector< std::string > &parameters)
std::vector< std::string > allCommandsOf()
bool onMenu(const std::string &command)
const std::shared_ptr< CommandLineComponent > & currentOf()
std::set< std::string > allMenuEntriesOf()
Definition UserDto.h:16
Definition BaseFeature.h:6
constexpr std::string_view type_name()
Definition TypeName.h:9