json-gen-c  0.1.5
json-gen-c generate C code for json manipulation
gencode_cpp.c File Reference

Generate a C++ wrapper header (.gen.hpp) providing RAII classes around the generated C structs, with typed accessors and marshal/unmarshal member functions. More...

#include "gencode/gencode.h"
#include "struct/struct_parse.h"
#include "utils/hash_map.h"
#include "utils/sstr.h"
#include <stdio.h>
#include <string.h>
Include dependency graph for gencode_cpp.c:

Classes

struct  cpp_gen_param
 

Functions

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.
 

Detailed Description

Generate a C++ wrapper header (.gen.hpp) providing RAII classes around the generated C structs, with typed accessors and marshal/unmarshal member functions.

Function Documentation

◆ 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 
)

generate C++ wrapper header (.gen.hpp) that provides RAII classes around the generated C structs.

Parameters
struct_mapparsed struct definitions.
enum_mapparsed enum definitions.
oneof_mapparsed oneof (tagged union) definitions.
c_header_namefilename of the generated C header to include.
formatoutput format (0=json, 1=msgpack, 2=cbor) for marshal prefix.
outputthe output C++ header content.
Returns
0 on success, -1 on failure.