SerializableJSONBoolean.hpp 911 B

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