semf
history.h
Go to the documentation of this file.
1
10#ifndef SEMF_COMMUNICATION_ESH_HISTORY_H_
11#define SEMF_COMMUNICATION_ESH_HISTORY_H_
12
14#include <array>
15#include <cstdint>
16#include <string_view>
17
18namespace semf::esh
19{
24{
25public:
32 History(char* historyBuffer, size_t numberOfEntries, size_t lineSize);
33 History(const History& other) = delete;
34 virtual ~History() = default;
39 void insert(std::string_view command);
45 void handleArrowUp(char commandBuffer[]);
51 void handleArrowDown(char commandBuffer[]);
52
53private:
55 char* const m_history;
57 const size_t m_numberOfEntries;
59 const size_t m_lineSize;
61 int32_t m_savedCommands = 0;
63 int32_t m_index = 0;
64};
65} // namespace semf::esh
66#endif // SEMF_COMMUNICATION_ESH_HISTORY_H_
Manages the shell's history.
Definition: history.h:24
void insert(std::string_view command)
Inserts a command.
Definition: history.cpp:25
virtual ~History()=default
History(char *historyBuffer, size_t numberOfEntries, size_t lineSize)
Constructor.
Definition: history.cpp:18
void handleArrowUp(char commandBuffer[])
Performes a lookup based on an up-arrow key stroke.
Definition: history.cpp:37
History(const History &other)=delete
void handleArrowDown(char commandBuffer[])
Performes a lookup based on an down-arrow key stroke.
Definition: history.cpp:52