SerializableJSONFloat.hpp 957 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-11-20
  7. *
  8. * */
  9. #ifndef LS_STD_SERIALIZABLE_JSON_FLOAT_HPP
  10. #define LS_STD_SERIALIZABLE_JSON_FLOAT_HPP
  11. #include <memory>
  12. #include <ls_std/lib/nlohmann_json/include/nlohmann/json.hpp>
  13. #include <ls_std/base/Class.hpp>
  14. #include <ls_std/serialization/ISerializable.hpp>
  15. #include <ls_std/boxing/Float.hpp>
  16. namespace ls_std {
  17. class SerializableJSONFloat : public Class, public ISerializable {
  18. public:
  19. explicit SerializableJSONFloat(std::shared_ptr<ls_std::Float> _value);
  20. ~SerializableJSONFloat() = 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::Float> value {};
  25. nlohmann::json jsonObject {};
  26. void _update();
  27. };
  28. }
  29. #endif