XmlReader.hpp 1.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556
  1. /*
  2. * Author: Patrick-Christopher Mattulat
  3. * Company: Lynar Studios
  4. * E-Mail: webmaster@lynarstudios.com
  5. * Created: 2020-10-08
  6. * Changed: 2024-09-13
  7. *
  8. * */
  9. #ifndef LS_STD_XML_READER_HPP
  10. #define LS_STD_XML_READER_HPP
  11. #include "XmlDocument.hpp"
  12. #include "XmlParseMode.hpp"
  13. #include "XmlParseParameter.hpp"
  14. #include <list>
  15. #include <ls-std/core/Class.hpp>
  16. #include <ls-std/core/interface/IReader.hpp>
  17. #include <ls-std/io/File.hpp>
  18. #include <ls-std/os/dynamic-goal.hpp>
  19. /*
  20. * @doc: class(name: 'XmlReader', package: 'io')
  21. * @doc: io.XmlReader.description('This class reads an XML file and returns an XML document.')
  22. * */
  23. namespace ls::std::io
  24. {
  25. class LS_STD_DYNAMIC_GOAL XmlReader : public ls::std::core::Class, public ls::std::core::interface_type::IReader
  26. {
  27. public:
  28. explicit XmlReader(const ::std::shared_ptr<ls::std::io::XmlDocument> &_document, const ::std::string &_absolutePath);
  29. ~XmlReader() noexcept override;
  30. // implementation
  31. ls::std::core::type::byte_field read() override; // nodiscard is optional here
  32. // additional functionality
  33. [[nodiscard]] ::std::shared_ptr<ls::std::io::XmlDocument> getDocument() const;
  34. void setDocument(const ::std::shared_ptr<ls::std::io::XmlDocument> &_document);
  35. void setFile(const ls::std::io::File &_xmlFile);
  36. private:
  37. ::std::shared_ptr<ls::std::io::XmlDocument> document{};
  38. ls::std::io::File xmlFile = ls::std::io::File{""};
  39. void _assignDocument(const ::std::shared_ptr<ls::std::io::XmlDocument> &_document);
  40. void _assignFile(const ls::std::io::File &_xmlFile);
  41. };
  42. }
  43. #endif