slumber-quest/controllers/controller.h

41 lines
927 B
C
Raw Permalink 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 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;
bool validateInput(const std::string& input_word) const;
2021-05-07 21:36:26 -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:
void runModificators() const;
2021-05-07 21:36:26 -04:00
std::list<std::string> _keywords;
std::string _interaction_message;
std::shared_ptr<Validator> _validator;
std::list<std::shared_ptr<Modificator>> _modificators;
2021-05-07 21:36:26 -04:00
};
#endif // CONTROLLER_H