slumber-quest/controllers/controller.h

43 lines
958 B
C
Raw Normal View History

2021-05-07 21:36:26 -04:00
#ifndef CONTROLLER_H
#define CONTROLLER_H
#include <memory>
#include <string>
#include <list>
class Node;
class Actor;
class Policy;
class Controller
{
public:
struct Initializer
{
const std::list<std::string>& keywords;
const std::string& message;
};
explicit Controller(Initializer&& initializer);
virtual ~Controller() = 0;
virtual std::string interact(std::shared_ptr<Actor> actor) = 0;
virtual bool validateInput(const std::string& input_word) const final;
virtual void setValidationPolicies(const std::list<std::shared_ptr<Policy>>& policies) final;
struct ValidationResult
{
bool success = false;
std::string validation_output;
};
protected:
virtual ValidationResult validatePolicies() const final;
std::list<std::string> _keywords;
std::string _interaction_message;
std::list<std::shared_ptr<Policy>> _validation_policies;
};
#endif // CONTROLLER_H