xref: /php-src/ext/dom/lexbor/lexbor/core/serialize.h (revision f0934090)
1 /*
2  * Copyright (C) 2021 Alexander Borisov
3  *
4  * Author: Alexander Borisov <borisov@lexbor.com>
5  */
6 
7 #ifndef LEXBOR_SERIALIZE_H
8 #define LEXBOR_SERIALIZE_H
9 
10 
11 #include "lexbor/core/base.h"
12 
13 
14 #define lexbor_serialize_write(cb, data, length, ctx, status)                 \
15     do {                                                                      \
16         (status) = (cb)((lxb_char_t *) (data), (length), (ctx));              \
17         if ((status) != LXB_STATUS_OK) {                                      \
18             return (status);                                                  \
19         }                                                                     \
20     }                                                                         \
21     while (false)
22 
23 
24 LXB_API lxb_status_t
25 lexbor_serialize_length_cb(const lxb_char_t *data, size_t length, void *ctx);
26 
27 
28 LXB_API lxb_status_t
29 lexbor_serialize_copy_cb(const lxb_char_t *data, size_t length, void *ctx);
30 
31 
32 #endif /* LEXBOR_SERIALIZE_H */
33