SerializableJSONString.hpp 874 B

12345678910111213141516171819202122232425262728293031323334353637
  1. /*
  2. * Author: Patrick-Christopher Mattulat
  3. * Company: Lynar Studios
  4. * E-Mail: webmaster@lynarstudios.com
  5. * Created: 2020-08-30
  6. * Changed: 2020-08-30
  7. *
  8. * */
  9. #ifndef SERIALIZABLE_JSON_STRING_HPP
  10. #define SERIALIZABLE_JSON_STRING_HPP
  11. #include <memory>
  12. #include <json.hpp>
  13. #include "../../serialization/ISerializable.hpp"
  14. #include "../../boxing/String.hpp"
  15. namespace ls_std {
  16. class SerializableJSONString : public Class, public ISerializable {
  17. public:
  18. explicit SerializableJSONString(std::shared_ptr<ls_std::String> _value);
  19. ~SerializableJSONString() = default;
  20. ls_std::byte_field marshal() override;
  21. void unmarshal(const ls_std::byte_field& _data) override;
  22. private:
  23. nlohmann::json jsonObject {};
  24. std::shared_ptr<ls_std::String> value {};
  25. void _update();
  26. };
  27. }
  28. #endif