54 lines
2.1 KiB
C++
54 lines
2.1 KiB
C++
|
|
#pragma once
|
|
|
|
#include <Nazara/Core/Export.hpp>
|
|
#include <Nazara/Core/Serialization.hpp>
|
|
|
|
namespace Nz
|
|
{
|
|
class NAZARA_CORE_API JsonSerializationContext
|
|
: public SerializationContext
|
|
{
|
|
public:
|
|
JsonSerializationContext();
|
|
~JsonSerializationContext();
|
|
|
|
bool Load(const std::filesystem::path& path);
|
|
|
|
EnumSerializationMode GetEnumSerializationMode() const override { return EnumSerializationMode::String; }
|
|
bool PushObject(std::string_view name) override;
|
|
bool PopObject() override;
|
|
bool PushArray(std::string_view name) override;
|
|
bool PopArray() override;
|
|
|
|
bool Write(std::string_view name, bool value) override;
|
|
bool Write(std::string_view name, Nz::Int8 value) override;
|
|
bool Write(std::string_view name, Nz::Int16 value) override;
|
|
bool Write(std::string_view name, Nz::Int32 value) override;
|
|
bool Write(std::string_view name, Nz::Int64 value) override;
|
|
bool Write(std::string_view name, Nz::UInt8 value) override;
|
|
bool Write(std::string_view name, Nz::UInt16 value) override;
|
|
bool Write(std::string_view name, Nz::UInt32 value) override;
|
|
bool Write(std::string_view name, Nz::UInt64 value) override;
|
|
bool Write(std::string_view name, float value) override;
|
|
bool Write(std::string_view name, double value) override;
|
|
bool Write(std::string_view name, const std::string& value) override;
|
|
|
|
bool Read(std::string_view name, bool* value) override;
|
|
bool Read(std::string_view name, Nz::Int8* value) override;
|
|
bool Read(std::string_view name, Nz::Int16* value) override;
|
|
bool Read(std::string_view name, Nz::Int32* value) override;
|
|
bool Read(std::string_view name, Nz::Int64* value) override;
|
|
bool Read(std::string_view name, Nz::UInt8* value) override;
|
|
bool Read(std::string_view name, Nz::UInt16* value) override;
|
|
bool Read(std::string_view name, Nz::UInt32* value) override;
|
|
bool Read(std::string_view name, Nz::UInt64* value) override;
|
|
bool Read(std::string_view name, float* value) override;
|
|
bool Read(std::string_view name, double* value) override;
|
|
bool Read(std::string_view name, std::string* value) override;
|
|
|
|
private:
|
|
std::unique_ptr<struct JsonImpl> m_impl;
|
|
};
|
|
}
|