generate json manipulate codes.
More...
Go to the source code of this file.
|
|
#define | OUTPUT_C_FILENAME "json.gen.c" |
| |
|
#define | OUTPUT_H_FILENAME "json.gen.h" |
| |
|
#define | OUTPUT_MSGPACK_C_FILENAME "msgpack.gen.c" |
| |
|
#define | OUTPUT_MSGPACK_H_FILENAME "msgpack.gen.h" |
| |
|
#define | OUTPUT_CBOR_C_FILENAME "cbor.gen.c" |
| |
|
#define | OUTPUT_CBOR_H_FILENAME "cbor.gen.h" |
| |
|
#define | OUTPUT_CPP_FILENAME "json_gen_c.gen.hpp" |
| |
|
#define | OUTPUT_RUST_FILENAME "json_gen_c.gen.rs" |
| |
|
#define | OUTPUT_GO_FILENAME "json_gen_c.gen.go" |
| |
|
| int | gencode_source (struct hash_map *struct_map, struct hash_map *enum_map, struct hash_map *oneof_map, sstr_t source, sstr_t header) |
| | generate json manipulate codes by struct_map, enum_map and oneof_map into source and header.
|
| |
| int | gencode_msgpack_source (struct hash_map *struct_map, struct hash_map *enum_map, struct hash_map *oneof_map, sstr_t source, sstr_t header) |
| | generate MessagePack pack/unpack codes.
|
| |
|
int | gencode_cbor_source (struct hash_map *struct_map, struct hash_map *enum_map, struct hash_map *oneof_map, sstr_t source, sstr_t header) |
| | generate CBOR (RFC 8949) pack/unpack codes.
|
| |
| int | gencode_cpp_wrapper (struct hash_map *struct_map, struct hash_map *enum_map, struct hash_map *oneof_map, const char *c_header_name, int format, sstr_t output) |
| | generate C++ wrapper header (.gen.hpp) that provides RAII classes around the generated C structs.
|
| |
| int | gencode_rust (struct hash_map *struct_map, struct hash_map *enum_map, struct hash_map *oneof_map, sstr_t output) |
| | generate a Rust module (.rs) with native serde-compatible structs and enums.
|
| |
| int | gencode_go (struct hash_map *struct_map, struct hash_map *enum_map, struct hash_map *oneof_map, const char *package_name, sstr_t output) |
| | generate a Go source file (.go) with native encoding/json-compatible structs and enums.
|
| |
generate json manipulate codes.
- Author
- your name (you@d.nosp@m.omai.nosp@m.n.com)
◆ gencode_cpp_wrapper()
| int gencode_cpp_wrapper |
( |
struct hash_map * |
struct_map, |
|
|
struct hash_map * |
enum_map, |
|
|
struct hash_map * |
oneof_map, |
|
|
const char * |
c_header_name, |
|
|
int |
format, |
|
|
sstr_t |
output |
|
) |
| |
|
extern |
generate C++ wrapper header (.gen.hpp) that provides RAII classes around the generated C structs.
- Parameters
-
| struct_map | parsed struct definitions. |
| enum_map | parsed enum definitions. |
| oneof_map | parsed oneof (tagged union) definitions. |
| c_header_name | filename of the generated C header to include. |
| format | output format (0=json, 1=msgpack, 2=cbor) for marshal prefix. |
| output | the output C++ header content. |
- Returns
- 0 on success, -1 on failure.
◆ gencode_go()
generate a Go source file (.go) with native encoding/json-compatible structs and enums.
- Parameters
-
| struct_map | parsed struct definitions. |
| enum_map | parsed enum definitions. |
| oneof_map | parsed oneof (tagged union) definitions. |
| package_name | Go package name to use. |
| output | the output Go source content. |
- Returns
- 0 on success, -1 on failure.
◆ gencode_msgpack_source()
generate MessagePack pack/unpack codes.
- Parameters
-
| struct_map | the hash map that store all structs parsed from struct defintion files. |
| enum_map | the hash map that store all enums parsed from enum definitions. |
| oneof_map | the hash map that store all oneof (tagged union) definitions. |
| source | the output source code. |
| header | the output header code. |
- Returns
- int 0 if success, -1 if failed.
◆ gencode_rust()
generate a Rust module (.rs) with native serde-compatible structs and enums.
- Parameters
-
| struct_map | parsed struct definitions. |
| enum_map | parsed enum definitions. |
| oneof_map | parsed oneof (tagged union) definitions. |
| output | the output Rust source content. |
- Returns
- 0 on success, -1 on failure.
◆ gencode_source()
generate json manipulate codes by struct_map, enum_map and oneof_map into source and header.
- Parameters
-
| struct_map | the hash map that store all structs parsed from struct defintion files. |
| enum_map | the hash map that store all enums parsed from enum definitions. |
| oneof_map | the hash map that store all oneof (tagged union) definitions. |
| source | the output source code. |
| header | the output header code. |
- Returns
- int 0 if success, -1 if failed.