json-gen-c  0.1.5
json-gen-c generate C code for json manipulation
gencode.h
Go to the documentation of this file.
1
7#ifndef GENCODE_H_
8#define GENCODE_H_
9
10#include "utils/hash_map.h"
11#include "utils/sstr.h"
12
13#ifdef __cplusplus
14extern "C" {
15#endif
16
17// the output file names
18#define OUTPUT_C_FILENAME "json.gen.c"
19#define OUTPUT_H_FILENAME "json.gen.h"
20#define OUTPUT_MSGPACK_C_FILENAME "msgpack.gen.c"
21#define OUTPUT_MSGPACK_H_FILENAME "msgpack.gen.h"
22#define OUTPUT_CBOR_C_FILENAME "cbor.gen.c"
23#define OUTPUT_CBOR_H_FILENAME "cbor.gen.h"
24#define OUTPUT_CPP_FILENAME "json_gen_c.gen.hpp"
25#define OUTPUT_RUST_FILENAME "json_gen_c.gen.rs"
26#define OUTPUT_GO_FILENAME "json_gen_c.gen.go"
27
39extern int gencode_source(struct hash_map* struct_map, struct hash_map* enum_map,
40 struct hash_map* oneof_map, sstr_t source, sstr_t header);
41
53extern int gencode_msgpack_source(struct hash_map* struct_map, struct hash_map* enum_map,
54 struct hash_map* oneof_map, sstr_t source, sstr_t header);
55
59extern int gencode_cbor_source(struct hash_map* struct_map, struct hash_map* enum_map,
60 struct hash_map* oneof_map, sstr_t source, sstr_t header);
61
74extern int gencode_cpp_wrapper(struct hash_map* struct_map, struct hash_map* enum_map,
75 struct hash_map* oneof_map, const char* c_header_name,
76 int format, sstr_t output);
77
88extern int gencode_rust(struct hash_map* struct_map, struct hash_map* enum_map,
89 struct hash_map* oneof_map, sstr_t output);
90
102extern int gencode_go(struct hash_map* struct_map, struct hash_map* enum_map,
103 struct hash_map* oneof_map, const char* package_name,
104 sstr_t output);
105
106#ifdef __cplusplus
107}
108#endif
109
110#endif // GENCODE_H_
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.
Definition gencode_rust.c:497
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.
Definition gencode_go.c:537
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.
Definition gencode_cbor.c:1412
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.
Definition gencode.c:2392
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.
Definition gencode_cpp.c:710
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.
Definition gencode_msgpack.c:1413
A simple hash_map implementation.
sstr_t are objects that represent sequences of characters.
void * sstr_t
sstr_t are objects that represent sequences of characters.
Definition sstr.h:75
Definition hash_map.h:34