SerializableJSONInteger.hpp 955 B

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