Derive-C
Loading...
Searching...
No Matches
derive.h
Go to the documentation of this file.
1#pragma once
2
3#define DC_DERIVE_STRUCT_MEMBER(MEMBER_TYPE, MEMBER_NAME) MEMBER_TYPE MEMBER_NAME;
4
5// Given you have define a reflect for an ID, the struct can be defined.
6// ```c
7// #define Foo_REFLECT(F, ...) \
8// F(int, x, __VA_ARGS__) \
9// F(int, y, __VA_ARGS__)
10//
11// DC_DERIVE_STRUCT(Foo)
12// ```
13#define DC_DERIVE_STRUCT(TYPE, ...) \
14 typedef struct { \
15 NS(TYPE, REFLECT)(DC_DERIVE_STRUCT_MEMBER) \
16 }(TYPE)__VA_ARGS__;