SerializableXMLState.hpp 1.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051
  1. /*
  2. * Author: Patrick-Christopher Mattulat
  3. * Company: Lynar Studios
  4. * E-Mail: webmaster@lynarstudios.com
  5. * Created: 2020-09-20
  6. * Changed: 2020-09-20
  7. *
  8. * *//*
  9. #ifndef LS_STD_SERIALIZABLE_XML_STATE_HPP
  10. #define LS_STD_SERIALIZABLE_XML_STATE_HPP
  11. #include "../../../base/Class.hpp"
  12. #include "../../ISerializable.hpp"
  13. #include "../../../logic/State.hpp"
  14. #include <memory>
  15. #include <tinyxml2.h>
  16. namespace ls_std {
  17. class SerializableXMLState : public Class, public ISerializable {
  18. public:
  19. explicit SerializableXMLState(std::shared_ptr<State> _value);
  20. ~SerializableXMLState() = default;
  21. // implementation
  22. ls_std::byte_field marshal() override;
  23. void unmarshal(const ls_std::byte_field& _data) override;
  24. // additional functionality
  25. std::shared_ptr<State> getValue();
  26. void setValue(std::shared_ptr<State> _value);
  27. private:
  28. tinyxml2::XMLDocument document {};
  29. std::shared_ptr<State> value {};
  30. void _clear();
  31. void _unmarshalConnections(tinyxml2::XMLElement* _root);
  32. void _unmarshalId(tinyxml2::XMLElement* _root);
  33. void _update();
  34. void _updateStates();
  35. };
  36. }
  37. #endif
  38. */