Narrator.hpp 857 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: 2022-05-05
  7. *
  8. * */
  9. #ifndef LS_STD_NARRATOR_HPP
  10. #define LS_STD_NARRATOR_HPP
  11. #include <ls_std/core/Class.hpp>
  12. #include "IListener.hpp"
  13. #include <list>
  14. #include <memory>
  15. namespace ls
  16. {
  17. class Narrator : public ls::Class
  18. {
  19. public:
  20. Narrator();
  21. ~Narrator() override = default;
  22. bool addListener(const ::std::shared_ptr<ls::IListener> &_listener);
  23. void clear();
  24. ::std::list<::std::shared_ptr<ls::IListener>> getListeners();
  25. bool removeListener(const ::std::shared_ptr<ls::IListener> &_listener);
  26. void tell(const ls::Class &_info);
  27. private:
  28. ::std::list<::std::shared_ptr<ls::IListener>> listeners{};
  29. };
  30. }
  31. #endif