[*] Simplify linking with inline virtual override methods under fwd declare
This commit is contained in:
parent
f6025d08cd
commit
8712c9a621
@ -41,7 +41,7 @@
|
||||
|
||||
#define AUI_METHOD_FUNCTIONAL_IMPL(ret, name, params) \
|
||||
name ## _t name ## Functional; \
|
||||
virtual ret name (AUI_EXPAND_PARAMS params) override \
|
||||
inline virtual ret name (AUI_EXPAND_PARAMS params) override \
|
||||
{ \
|
||||
if (!name ## Functional) \
|
||||
{ \
|
||||
@ -96,7 +96,7 @@
|
||||
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_FWD(name, ...) AUI_DEFINE_INTERFACE_START_FUNCTIONAL_BASE(AUI_METHOD_FUNCTIONAL_IMPL, 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_METHOD(returnValue, name, parameters) returnValue, name, parameters
|
||||
@ -113,4 +113,6 @@
|
||||
#define AUI_INTERFACE_FWD(name, ...) AUI_DEFINE_INTERFACE_START_STRUCT(name, __VA_ARGS__) AUI_DEFINE_INTERFACE_START_CPP_WRAPPER_FWD(name, __VA_ARGS__)
|
||||
|
||||
/// Entrypoint into Aurora Interfaces | Forward declare and define in a single translation unit
|
||||
#define AUI_INTERFACE_IMPL(name, ...) AUI_DEFINE_INTERFACE_START_STRUCT(name, __VA_ARGS__) AUI_DEFINE_INTERFACE_START_CPP_WRAPPER_IMPL(name, __VA_ARGS__) AUI_PIN_ODR(name)
|
||||
#define AUI_INTERFACE_IMPL AUI_INTERFACE_FWD //(name, ...) AUI_DEFINE_INTERFACE_START_STRUCT(name, __VA_ARGS__) AUI_DEFINE_INTERFACE_START_CPP_WRAPPER_IMPL(name, __VA_ARGS__) AUI_PIN_ODR(name)
|
||||
|
||||
#define AUI_INTERFACE AUI_INTERFACE_FWD
|
18
README.md
18
README.md
@ -4,32 +4,16 @@ This library implements the macros required to define Aurora style interfaces. D
|
||||
|
||||
## Example usage:
|
||||
|
||||
#### In your common header:
|
||||
```c
|
||||
#if defined(MY_LIB_GEN_BINDINGS)
|
||||
#define LIB_INTERFACE(name, list) AUI_INTERFACE_IMPL(name, list)
|
||||
#define
|
||||
#define LIB_INTERFACE(name, list) AUI_INTERFACE_FWD(name, list)
|
||||
#endif
|
||||
```
|
||||
|
||||
#### In your public API:
|
||||
```c
|
||||
LIB_INTERFACE(IInputMouseSubscriber,
|
||||
AUI_INTERFACE(IInputMouseSubscriber,
|
||||
AUI_METHOD(void, onButtonPress, (AuUInt8, mb)),
|
||||
AUI_METHOD(void, onButtonTick, (AuUInt8, mb)),
|
||||
AUI_METHOD(void, onButtonUp, (AuUInt8, mb))
|
||||
);
|
||||
```
|
||||
|
||||
#### In a dedicated translation unit:
|
||||
```c++
|
||||
#define MY_LIB_GEN_BINDINGS
|
||||
#include <AuroraForEach.hpp>
|
||||
#include <AuroraInterfaces.hpp>
|
||||
#include <[MyPublicAPI].hpp>
|
||||
```
|
||||
|
||||
#### Usage: C++ inheritance (covers SWIG and CppSharp)
|
||||
```
|
||||
#include <AuroraForEach.hpp>
|
||||
|
Loading…
Reference in New Issue
Block a user