2021-05-07 21:36:26 -04:00
|
|
|
#ifndef CONTROLLER_H
|
|
|
|
#define CONTROLLER_H
|
|
|
|
|
|
|
|
#include <memory>
|
|
|
|
#include <string>
|
|
|
|
#include <list>
|
|
|
|
|
|
|
|
class Node;
|
|
|
|
class Actor;
|
2021-05-15 19:44:19 -04:00
|
|
|
class Validator;
|
|
|
|
class Modificator;
|
2021-05-07 21:36:26 -04:00
|
|
|
|
|
|
|
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;
|
2021-05-15 19:44:19 -04:00
|
|
|
bool validateInput(const std::string& input_word) const;
|
2021-05-07 21:36:26 -04:00
|
|
|
|
2021-05-15 19:44:19 -04:00
|
|
|
void setValidator(const std::shared_ptr<Validator>& validator);
|
|
|
|
void setModificators(const std::list<std::shared_ptr<Modificator>>& modificators);
|
2021-05-07 21:36:26 -04:00
|
|
|
|
|
|
|
protected:
|
2021-05-15 19:44:19 -04:00
|
|
|
void runModificators() const;
|
2021-05-07 21:36:26 -04:00
|
|
|
|
|
|
|
std::list<std::string> _keywords;
|
|
|
|
std::string _interaction_message;
|
2021-05-15 19:44:19 -04:00
|
|
|
std::shared_ptr<Validator> _validator;
|
|
|
|
std::list<std::shared_ptr<Modificator>> _modificators;
|
2021-05-07 21:36:26 -04:00
|
|
|
};
|
|
|
|
|
|
|
|
#endif // CONTROLLER_H
|