TestDataFactory.cpp 1.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  1. /*
  2. * Author: Patrick-Christopher Mattulat
  3. * Company: Lynar Studios
  4. * E-Mail: webmaster@lynarstudios.com
  5. * Created: 2022-05-14
  6. * Changed: 2023-02-05
  7. *
  8. * */
  9. #include "TestDataFactory.hpp"
  10. test::io::TestDataFactory::TestDataFactory() = default;
  11. test::io::TestDataFactory::~TestDataFactory() = default;
  12. ::std::shared_ptr<ls::std::io::XmlNode> test::io::TestDataFactory::createXmlContent()
  13. {
  14. ::std::shared_ptr<ls::std::io::XmlNode> root = ::std::make_shared<ls::std::io::XmlNode>("dialog");
  15. ::std::shared_ptr<ls::std::io::XmlAttribute> attribute{};
  16. ::std::shared_ptr<ls::std::io::XmlNode> child{};
  17. ::std::shared_ptr<ls::std::io::XmlNode> text{};
  18. attribute = ::std::make_shared<ls::std::io::XmlAttribute>("name");
  19. attribute->setValue("dungeon_001");
  20. root->addAttributeToEnd(attribute);
  21. child = ::std::make_shared<ls::std::io::XmlNode>("dialogUnit");
  22. attribute = ::std::make_shared<ls::std::io::XmlAttribute>("id");
  23. attribute->setValue("001");
  24. child->addAttributeToEnd(attribute);
  25. text = ::std::make_shared<ls::std::io::XmlNode>("text");
  26. text->setValue("Hello!");
  27. child->addChildToEnd(text);
  28. root->addChildToEnd(child);
  29. child = ::std::make_shared<ls::std::io::XmlNode>("dialogUnit");
  30. attribute = ::std::make_shared<ls::std::io::XmlAttribute>("id");
  31. attribute->setValue("002");
  32. child->addAttributeToEnd(attribute);
  33. text = ::std::make_shared<ls::std::io::XmlNode>("text");
  34. text->setValue("Hello again!");
  35. child->addChildToEnd(text);
  36. root->addChildToEnd(child);
  37. return root;
  38. }