42 lines
784 B
C++
42 lines
784 B
C++
#ifndef NTX_CMDLIST_H
|
|
#define NTX_CMDLIST_H
|
|
|
|
#include <ntxicommand.h>
|
|
#include <vector>
|
|
|
|
namespace ntx
|
|
{
|
|
|
|
class NtxCmdList : public NtxICommand
|
|
{
|
|
public:
|
|
|
|
NtxCmdList();
|
|
explicit NtxCmdList(const NtxString& description);
|
|
~NtxCmdList() override = default;
|
|
|
|
bool execute() override;
|
|
bool undo() override;
|
|
|
|
bool canExecute() const override;
|
|
bool canUndo() const override;
|
|
|
|
NtxString getDescription() const override;
|
|
|
|
void addCommand(NtxCommandUPtr command);
|
|
void clear();
|
|
|
|
size_t count() const;
|
|
bool isEmpty() const;
|
|
|
|
private:
|
|
|
|
std::vector<NtxCommandUPtr> m_commands;
|
|
size_t m_executedCount;
|
|
|
|
void rollback(size_t upToIndex);
|
|
};
|
|
|
|
} // namespace ntx
|
|
|
|
#endif // NTX_CMDLIST_H
|