Files
fx/fx.serial/include/fx/serial/ctx.h
T

56 lines
1.1 KiB
C

#ifndef FX_SERIAL_CTX_H_
#define FX_SERIAL_CTX_H_
#include <fx/macros.h>
#include <fx/misc.h>
#include <fx/object.h>
#include <fx/status.h>
#include <fx/stream.h>
#include <fx/value.h>
FX_DECLS_BEGIN;
#define FX_TYPE_SERIAL_CTX (fx_serial_ctx_get_type())
typedef enum fx_serial_flags {
FX_SERIAL_F_NONE = 0,
FX_SERIAL_F_PRETTY = 0x01u,
} fx_serial_flags;
FX_DECLARE_TYPE(fx_serial_ctx);
FX_TYPE_CLASS_DECLARATION_BEGIN(fx_serial_ctx)
fx_result (*s_serialise)(
fx_serial_ctx *,
const fx_value *,
fx_stream *,
fx_serial_flags);
fx_result (*s_deserialise)(
fx_serial_ctx *,
fx_stream *,
fx_value *,
fx_serial_flags);
FX_TYPE_CLASS_DECLARATION_END(fx_serial_ctx)
typedef struct fx_serial_ctx_data {
fx_stream_buffer *ctx_streambuf;
} fx_serial_ctx_data;
FX_API fx_type_id fx_serial_ctx_get_type(void);
FX_API fx_result fx_serial_ctx_serialise(
fx_serial_ctx *ctx,
const fx_value *src,
fx_stream *dest,
fx_serial_flags flags);
FX_API fx_result fx_serial_ctx_deserialise(
fx_serial_ctx *ctx,
fx_stream *src,
fx_value *dest,
fx_serial_flags flags);
FX_DECLS_END;
#endif