2025-06-27 21:53:40 +01:00
|
|
|
#ifndef BLUELIB_SERIAL_H_
|
|
|
|
|
#define BLUELIB_SERIAL_H_
|
|
|
|
|
|
|
|
|
|
#include <blue/core/misc.h>
|
|
|
|
|
#include <blue/core/status.h>
|
|
|
|
|
#include <blue/core/stream.h>
|
|
|
|
|
|
2025-08-09 19:57:42 +01:00
|
|
|
struct b_dsref;
|
2025-06-27 21:53:40 +01:00
|
|
|
|
|
|
|
|
typedef enum b_serial_format {
|
|
|
|
|
B_SERIAL_FORMAT_NONE = 0,
|
|
|
|
|
B_SERIAL_FORMAT_BITCODE,
|
|
|
|
|
B_SERIAL_FORMAT_JSON,
|
|
|
|
|
} b_serial_format;
|
|
|
|
|
|
|
|
|
|
typedef enum b_serial_flags {
|
|
|
|
|
B_SERIAL_F_NONE = 0,
|
|
|
|
|
B_SERIAL_F_PRETTY = 0x01u,
|
|
|
|
|
} b_serial_flags;
|
|
|
|
|
|
|
|
|
|
typedef struct b_serial_ctx b_serial_ctx;
|
|
|
|
|
|
|
|
|
|
BLUE_API b_status b_serial_ctx_create(b_serial_ctx **out);
|
|
|
|
|
BLUE_API b_status b_serial_ctx_destroy(b_serial_ctx *ctx);
|
|
|
|
|
|
|
|
|
|
BLUE_API b_status b_serial_ctx_serialise(
|
2025-08-09 19:57:42 +01:00
|
|
|
b_serial_ctx *ctx, b_serial_format fmt, struct b_dsref *src,
|
2025-06-27 21:53:40 +01:00
|
|
|
b_stream *dest, b_serial_flags flags);
|
|
|
|
|
|
|
|
|
|
BLUE_API b_status b_serial_ctx_deserialise(
|
|
|
|
|
b_serial_ctx *ctx, b_serial_format fmt, b_stream *src,
|
2025-08-09 19:57:42 +01:00
|
|
|
struct b_dsref **dest, b_serial_flags flags);
|
2025-06-27 21:53:40 +01:00
|
|
|
|
|
|
|
|
#endif
|