GameStatistics.cpp 638 B

12345678910111213141516171819202122232425262728293031323334
  1. /*
  2. * GameStatistics.cpp, part of VCMI engine
  3. *
  4. * Authors: listed in file AUTHORS in main folder
  5. *
  6. * License: GNU General Public License v2.0 or later
  7. * Full text of license available in license.txt file, in main folder
  8. *
  9. */
  10. #include "StdInc.h"
  11. #include "GameStatistics.h"
  12. VCMI_LIB_NAMESPACE_BEGIN
  13. void StatisticDataSet::add(StatisticDataSetEntry entry)
  14. {
  15. data.push_back(entry);
  16. }
  17. std::string StatisticDataSet::toCsv()
  18. {
  19. std::stringstream ss;
  20. ss << "Day" << ";" << "Player" << "\r\n";
  21. for(auto & entry : data)
  22. {
  23. ss << entry.day << ";" << entry.player.getNum() << "\r\n";
  24. }
  25. return ss.str();
  26. }
  27. VCMI_LIB_NAMESPACE_END