GossipNewsAgency.cpp 892 B

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