Skip to content

Commit

Permalink
Add NBIND_ALIAS macro to support enum classes.
Browse files Browse the repository at this point in the history
  • Loading branch information
jjrv committed Jul 14, 2017
1 parent 0090a28 commit 0dfb207
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions include/nbind/noconflict.h
Original file line number Diff line number Diff line change
Expand Up @@ -74,4 +74,18 @@
#define NBIND_GETSET(getName, setName, ...) \
definer.property(#getName, &Bound::getName, &Bound::setName, ## __VA_ARGS__)

#define NBIND_ALIAS(Name, base) \
namespace nbind { \
template<> struct BindingType<Name> : BindingType<base> { \
static inline Name fromWireType(WireType arg) { \
return(static_cast<Name>(BindingType<Type>::fromWireType(arg))); \
} \
static inline WireType toWireType(Name arg) { \
return(BindingType<Type>::toWireType(static_cast<Type>(arg))); \
} \
}; \
template<> struct Typer<Name> : Typer<base> {}; \
}


#endif // BUILDING_NODE_EXTENSION || __EMSCRIPTEN__

0 comments on commit 0dfb207

Please sign in to comment.