GossipNewsAgency.cpp 950 B

123456789101112131415161718192021222324252627282930313233343536373839
  1. /*
  2. * Author: Patrick-Christopher Mattulat
  3. * Company: Lynar Studios
  4. * E-Mail: webmaster@lynarstudios.com
  5. * Created: 2020-11-27
  6. * Changed: 2022-05-14
  7. *
  8. * */
  9. #include "GossipNewsAgency.hpp"
  10. #include <ls_std/ls_std_event.hpp>
  11. ls_std_test::GossipNewsAgency::GossipNewsAgency() : ls_std_test::NewsAgency("GossipNewsAgency")
  12. {}
  13. void ls_std_test::GossipNewsAgency::listen(const ls::std::core::Class &_info)
  14. {
  15. ls::std::event::Event event = dynamic_cast<const ls::std::event::Event &>(_info);
  16. if (event.getId() == "SeriousNewsEvent")
  17. {
  18. this->news = this->getName() + ": " + event.getParameterList().at("news");
  19. }
  20. if (event.getId() == "GossipNewsEvent")
  21. {
  22. this->news = this->getName() + ": " + event.getParameterList().at("news");
  23. }
  24. }
  25. void ls_std_test::GossipNewsAgency::clear()
  26. {
  27. this->news.clear();
  28. }
  29. std::string ls_std_test::GossipNewsAgency::getNews()
  30. {
  31. return this->news;
  32. }