GossipNewsAgency.cpp 1015 B

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