slumber-quest/controllers/controller.h

41 lines
927 B
C++

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