XmlDocument.hpp 1.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  1. /*
  2. * Author: Patrick-Christopher Mattulat
  3. * Company: Lynar Studios
  4. * E-Mail: webmaster@lynarstudios.com
  5. * Created: 2020-09-27
  6. * Changed: 2024-09-13
  7. *
  8. * */
  9. #ifndef LS_STD_XML_DOCUMENT_HPP
  10. #define LS_STD_XML_DOCUMENT_HPP
  11. #include "XmlDeclaration.hpp"
  12. #include "XmlNode.hpp"
  13. #include <ls-std/core/Class.hpp>
  14. #include <ls-std/os/dynamic-goal.hpp>
  15. #include <memory>
  16. /*
  17. * @doc: class(name: 'XmlDocument', package: 'io')
  18. * @doc: io.XmlDocument.description('This class represents a whole XML document and can be serialized to a whole XML tree.')
  19. * */
  20. namespace ls::std::io
  21. {
  22. class LS_STD_DYNAMIC_GOAL XmlDocument : public ls::std::core::Class
  23. {
  24. public:
  25. XmlDocument();
  26. ~XmlDocument() noexcept override;
  27. [[nodiscard]] ::std::shared_ptr<ls::std::io::XmlDeclaration> getDeclaration() const;
  28. [[nodiscard]] ::std::shared_ptr<ls::std::io::XmlNode> getRootElement() const;
  29. void setDeclaration(const ::std::shared_ptr<ls::std::io::XmlDeclaration> &_declaration);
  30. void setRootElement(const ::std::shared_ptr<ls::std::io::XmlNode> &_rootElement);
  31. [[nodiscard]] ::std::string toXml() const;
  32. private:
  33. ::std::shared_ptr<ls::std::io::XmlDeclaration> declaration{};
  34. ::std::shared_ptr<ls::std::io::XmlNode> rootElement{};
  35. void _assignDeclaration(const ::std::shared_ptr<ls::std::io::XmlDeclaration> &_declaration);
  36. void _assignRootElement(const ::std::shared_ptr<ls::std::io::XmlNode> &_rootElement);
  37. };
  38. }
  39. #endif