lintel 0.2.0
Loading...
Searching...
No Matches
CommandLineHistoryService.h
Go to the documentation of this file.
1#ifndef COMMANDLINEHISTORYSERVICE_H
2#define COMMANDLINEHISTORYSERVICE_H
6#include <optional>
7
8namespace lintel {
17class CommandLineHistoryService : public PropertyRegistration<CommandLineHistoryService>
18{
19private:
20 std::shared_ptr<Property<std::size_t>> m_maxCommandHistoryEntries;
21 std::shared_ptr<Property<std::string>> m_historyFileName;
22
23 // runtime parameters
24 std::vector<CommandHistoryEntry> m_history;
25 std::optional<std::size_t> m_position;
26 std::string m_menu;
27
28 std::vector<CommandHistoryEntry> internalAllOf();
29
30public:
31 CommandLineHistoryService(const std::shared_ptr<ProcessName> &processName);
33 std::vector<CommandHistoryEntry> allOf();
34
36 std::optional<CommandHistoryEntry> nextOf(const std::string &menu);
37
39 std::optional<CommandHistoryEntry> previousOf(const std::string &menu);
40
47 std::optional<CommandHistoryEntry> startsWith(const std::string &command, const std::string &menu);
48
54
55 void onInitialize() override;
56};
57}// namespace lintel
58#endif// COMMANDLINEHISTORYSERVICE_H
Definition CommandHistoryEntry.h:11
Definition CommandLineHistoryService.h:18
std::optional< CommandHistoryEntry > previousOf(const std::string &menu)
void historizeOf(const CommandHistoryEntry &commandHistoryEntry)
std::vector< CommandHistoryEntry > allOf()
std::optional< CommandHistoryEntry > nextOf(const std::string &menu)
CommandLineHistoryService(const std::shared_ptr< ProcessName > &processName)
std::optional< CommandHistoryEntry > startsWith(const std::string &command, const std::string &menu)
Definition PropertyRegistration.h:14
Definition BaseFeature.h:6
constexpr std::string_view type_name()
Definition TypeName.h:9