Added constructor support

This commit is contained in:
Reece Wilson 2021-10-07 17:03:20 +01:00
parent e1ea73c70c
commit 078d3d77e7

View File

@ -31,13 +31,37 @@
return name ## Functional(AUI_EXPAND_PARAMS_PARAMS params); \
}
#define AUI_METHOD_FUNCTIONAL_FWD(ret, name, params) \
AuFunction<ret(AUI_EXPAND_PARAMS_TYPES params)> name ## Functional; \
#define AUI_METHOD_PROTOTYPE_TO_FUNCTIONAL(ret, name, params) \
AuFunction<ret(AUI_EXPAND_PARAMS_TYPES params)> name ## Functional
#define AUI_METHOD_FUNCTIONAL_CTOR_PARAMS_BASE_A(ret, name, params) AUI_METHOD_PROTOTYPE_TO_FUNCTIONAL(ret, name, params)
#define AUI_METHOD_FUNCTIONAL_CTOR_PARAMS_BASE_B(ret, name, params) , AUI_METHOD_PROTOTYPE_TO_FUNCTIONAL(ret, name, params)
#define AUI_METHOD_PROTOTYPE_ASSIGN(ret, name, params) \
name ## Functional(name ## Functional)
#define AUI_METHOD_FUNCTIONAL_ASSIGN_A(ret, name, params) AUI_METHOD_PROTOTYPE_ASSIGN(ret, name, params)
#define AUI_METHOD_FUNCTIONAL_ASSIGN_B(ret, name, params) , AUI_METHOD_PROTOTYPE_ASSIGN(ret, name, params)
#define AUI_METHOD_FUNCTIONAL_FWD(ret, name, params) \
AUI_METHOD_PROTOTYPE_TO_FUNCTIONAL(ret, name, params); \
virtual ret name (AUI_EXPAND_PARAMS params) override;
#define AUI_DEFINE_INTERFACE_START_STRUCT(name, ...) struct name { AU_FOR_EACH_3(AUI_METHOD_IMPL, __VA_ARGS__) };
#define AUI_DEFINE_INTERFACE_START_CPP_WRAPPER_FWD(name, ...) struct name ## Functional : name { AU_FOR_EACH_3(AUI_METHOD_FUNCTIONAL_FWD, __VA_ARGS__) };
#define AUI_DEFINE_INTERFACE_START_CPP_WRAPPER_IMPL(name, ...) struct name ## Functional : name { AU_FOR_EACH_3(AUI_METHOD_FUNCTIONAL_IMPL, __VA_ARGS__) };
#define AUI_DEFINE_INTERFACE_START_FUNCTIONAL_BASE(tmpl, name, ...) struct name ## Functional : name \
{ \
inline name ## Functional () {} \
inline ~name ## Functional () {} \
inline name ## Functional (AU_FOR_EACH_FIRST_3(AUI_METHOD_FUNCTIONAL_CTOR_PARAMS_BASE_A, AUI_METHOD_FUNCTIONAL_CTOR_PARAMS_BASE_B, __VA_ARGS__)) : \
AU_FOR_EACH_FIRST_3(AUI_METHOD_FUNCTIONAL_ASSIGN_A, AUI_METHOD_FUNCTIONAL_ASSIGN_B, __VA_ARGS__) \
{} \
AU_FOR_EACH_3(tmpl, __VA_ARGS__) \
};
#define AUI_DEFINE_INTERFACE_START_CPP_WRAPPER_FWD(name, ...) AUI_DEFINE_INTERFACE_START_FUNCTIONAL_BASE(AUI_METHOD_FUNCTIONAL_FWD, name, __VA_ARGS__)
#define AUI_DEFINE_INTERFACE_START_CPP_WRAPPER_IMPL(name, ...) AUI_DEFINE_INTERFACE_START_FUNCTIONAL_BASE(AUI_METHOD_FUNCTIONAL_IMPL, name, __VA_ARGS__)
#define AUI_PARAMS(...) AU_BRACKET_SCOPE(__VA_ARGS__)
#define AUI_METHODS(...) AU_BRACKET_SCOPE(__VA_ARGS__)