2021-05-08 03:36:26 +02:00
|
|
|
#ifndef POLICY_H
|
|
|
|
#define POLICY_H
|
|
|
|
|
2021-05-16 01:44:19 +02:00
|
|
|
#include <memory>
|
2021-05-08 03:36:26 +02:00
|
|
|
#include <string>
|
|
|
|
|
2021-05-16 01:44:19 +02:00
|
|
|
class Actor;
|
|
|
|
|
2021-05-08 03:36:26 +02:00
|
|
|
class Policy
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
explicit Policy(const std::string& satisfaction, const std::string& dissatisfaction);
|
|
|
|
virtual ~Policy() = 0;
|
|
|
|
|
|
|
|
struct CheckResult
|
|
|
|
{
|
|
|
|
bool satisfied = false;
|
|
|
|
std::string commentary;
|
|
|
|
};
|
|
|
|
|
2021-05-16 01:44:19 +02:00
|
|
|
virtual CheckResult check(const std::shared_ptr<Actor> &actor) const = 0;
|
2021-05-08 03:36:26 +02:00
|
|
|
|
|
|
|
protected:
|
2021-05-16 01:44:19 +02:00
|
|
|
CheckResult composeMessageFromResult(bool result) const;
|
2021-05-08 03:36:26 +02:00
|
|
|
|
|
|
|
std::string _commentary_on_satisfaction;
|
|
|
|
std::string _commentary_on_dissatisfaction;
|
|
|
|
};
|
|
|
|
|
|
|
|
#endif // POLICY_H
|