parent
5ada9d5e1c
commit
0160e7c623
@ -0,0 +1,26 @@
|
||||
/******************************************************************************
|
||||
* File - binary_serializable.h
|
||||
* Author - Joey Pollack
|
||||
* Date - 2022/06/29 (y/m/d)
|
||||
* Mod Date - 2022/06/29 (y/m/d)
|
||||
* Description - base class for any object that can be serialized to binary
|
||||
******************************************************************************/
|
||||
|
||||
#ifndef LUNARIUM_BINARY_SERIALIZABLE_H_
|
||||
#define LUNARIUM_BINARY_SERIALIZABLE_H_
|
||||
|
||||
#include <utils/op_res.h>
|
||||
|
||||
namespace lunarium
|
||||
{
|
||||
class BinaryFileBuffer;
|
||||
|
||||
class BinarySerializable
|
||||
{
|
||||
public:
|
||||
[[nodiscard]] OpRes Serialize(BinaryFileBuffer* pBuffer);
|
||||
[[nodiscard]] OpRes Deserialize(BinaryFileBuffer* pBuffer);
|
||||
};
|
||||
}
|
||||
|
||||
#endif // LUNARIUM_BINARY_SERIALIZABLE_H_
|
||||
@ -0,0 +1,28 @@
|
||||
/******************************************************************************
|
||||
* File - json_serializable.h
|
||||
* Author - Joey Pollack
|
||||
* Date - 2022/06/29 (y/m/d)
|
||||
* Mod Date - 2022/06/29 (y/m/d)
|
||||
* Description - Base class for any json serializable object
|
||||
******************************************************************************/
|
||||
|
||||
#ifndef LUNARIUM_JSON_SERIALIZABLE_H_
|
||||
#define LUNARIUM_JSON_SERIALIZABLE_H_
|
||||
|
||||
#include <utils/op_res.h>
|
||||
#include <nlohmann/json.hpp>
|
||||
|
||||
namespace lunarium
|
||||
{
|
||||
class JSONSerializable
|
||||
{
|
||||
public:
|
||||
[[nodiscard]] virtual OpRes Serialize(nlohmann::json& node) = 0;
|
||||
[[nodiscard]] virtual OpRes Deserialize(nlohmann::json& node) = 0;
|
||||
[[nodiscard]] virtual nlohmann::json AsJSON() = 0;
|
||||
[[nodiscord]] virtual bool IsValidNode(nlohmann::json& node) = 0;
|
||||
|
||||
};
|
||||
}
|
||||
|
||||
#endif // LUNARIUM_JSON_SERIALIZABLE_H_
|
||||
Loading…
Reference in New Issue