TestDataFactory.cpp 1.4 KB

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