pf-core/libs/common/include/command.hpp
Luís Murta 65005e9ba7
Command pattern started
Added virtual base class and first implementation.
2023-07-31 21:33:35 +01:00

28 lines
503 B
C++

/// \file
/// \copyright SPDX-License-Identifier: GPL-3.0-or-later
#pragma once
#include <iostream>
#include <string_view>
namespace command {
class Command {
public:
virtual ~Command() = default;
virtual void execute() const = 0;
};
class PrintCommand : public Command {
public:
explicit PrintCommand(std::string_view sv) : message{std::move(sv)} {}
void execute() const override { std::cout << message << std::endl; }
private:
std::string_view message;
};
} // namespace command