DailyNewsAgency.cpp 897 B

123456789101112131415161718192021222324252627282930313233343536373839404142
  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-23
  7. *
  8. * */
  9. #include "DailyNewsAgency.hpp"
  10. #include <ls-std/ls-std-event.hpp>
  11. using ls::std::core::Class;
  12. using ls::std::event::Event;
  13. using std::string;
  14. using test::event::DailyNewsAgency;
  15. using test::event::NewsAgency;
  16. DailyNewsAgency::DailyNewsAgency() : NewsAgency("DailyNewsAgency")
  17. {}
  18. DailyNewsAgency::~DailyNewsAgency() noexcept = default;
  19. void DailyNewsAgency::listen(const Class &_info)
  20. {
  21. Event event = dynamic_cast<const Event &>(_info);
  22. if (event.getId() == "SeriousNewsEvent")
  23. {
  24. this->news = this->getName() + ": " + event.getParameterList().at("news");
  25. }
  26. }
  27. void DailyNewsAgency::clear()
  28. {
  29. this->news.clear();
  30. }
  31. string DailyNewsAgency::getNews()
  32. {
  33. return this->news;
  34. }