28 lines
503 B
C++
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
|