Narrator.hpp 873 B

123456789101112131415161718192021222324252627282930313233343536373839
  1. /*
  2. * Author: Patrick-Christopher Mattulat
  3. * Company: Lynar Studios
  4. * E-Mail: webmaster@lynarstudios.com
  5. * Created: 2020-11-14
  6. * Changed: 2021-05-27
  7. *
  8. * */
  9. #ifndef LS_STD_NARRATOR_HPP
  10. #define LS_STD_NARRATOR_HPP
  11. #include <ls_std/base/Class.hpp>
  12. #include "IListener.hpp"
  13. #include <list>
  14. #include <memory>
  15. namespace ls_std
  16. {
  17. class Narrator : public ls_std::Class
  18. {
  19. public:
  20. Narrator();
  21. ~Narrator() override = default;
  22. bool addListener(const std::shared_ptr<ls_std::IListener> &_listener);
  23. void clear();
  24. std::list<std::shared_ptr<ls_std::IListener>> getListeners();
  25. bool removeListener(const std::shared_ptr<ls_std::IListener> &_listener);
  26. void tell(const ls_std::Class &_info);
  27. private:
  28. std::list<std::shared_ptr<ls_std::IListener>> listeners{};
  29. };
  30. }
  31. #endif