XmlDocument.hpp 1.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  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-09
  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. * */
  19. namespace ls::std::io
  20. {
  21. class LS_STD_DYNAMIC_GOAL XmlDocument : public ls::std::core::Class
  22. {
  23. public:
  24. XmlDocument();
  25. ~XmlDocument() noexcept override;
  26. [[nodiscard]] ::std::shared_ptr<ls::std::io::XmlDeclaration> getDeclaration() const;
  27. [[nodiscard]] ::std::shared_ptr<ls::std::io::XmlNode> getRootElement() const;
  28. void setDeclaration(const ::std::shared_ptr<ls::std::io::XmlDeclaration> &_declaration);
  29. void setRootElement(const ::std::shared_ptr<ls::std::io::XmlNode> &_rootElement);
  30. [[nodiscard]] ::std::string toXml() const;
  31. private:
  32. ::std::shared_ptr<ls::std::io::XmlDeclaration> declaration{};
  33. ::std::shared_ptr<ls::std::io::XmlNode> rootElement{};
  34. void _assignDeclaration(const ::std::shared_ptr<ls::std::io::XmlDeclaration> &_declaration);
  35. void _assignRootElement(const ::std::shared_ptr<ls::std::io::XmlNode> &_rootElement);
  36. };
  37. }
  38. #endif