Commit ee63aab8 authored by Volker Krause's avatar Volker Krause
Browse files

Make explicit wrapper objects detectable by type traits

parent 37ac393a
......@@ -53,8 +53,9 @@ private:
* @c JNI_TYPE or @c JNI_NESTED_TYPE macros.
*/
#define JNI_OBJECT(Class, BaseType) \
private: \
public: \
typedef Class _jni_ThisType; \
private: \
static inline constexpr const char *jniName() { return KAndroidExtras::Jni::typeName<BaseType>(); } \
friend constexpr const char* KAndroidExtras::Jni::typeName<Class>();
......
......@@ -46,6 +46,10 @@ template <typename T> struct reverse_converter {
template <typename T> struct is_array : std::false_type {};
template <typename T> struct is_array<Array<T>> : std::true_type {};
/** Type trais for checking whether @tparam T is a JNI object wrapper type. */
template <typename T, typename = std::void_t<>> struct is_object_wrapper : std::false_type {};
template <typename T> struct is_object_wrapper<T, std::void_t<typename T::_jni_ThisType>> : std::true_type {};
}
/**
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment