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

Make the typed object wrapper more compatible with QAndroidJniObject

parent 3612554a
Pipeline #181540 passed with stage
in 3 minutes and 20 seconds
......@@ -11,6 +11,8 @@
namespace KAndroidExtras {
namespace java { namespace lang { struct String; } }
namespace Jni {
/** Wrapper for JNI objects with a convertible C++ type.
......@@ -27,6 +29,15 @@ public:
inline operator typename Jni::converter<T>::type() const {
return Jni::converter<T>::convert(m_handle);
}
// forward basic QAndroidJniObject API
inline bool isValid() const {
return m_handle.isValid();
}
template <typename StrT = QString, typename = std::enable_if_t<std::is_same_v<T, java::lang::String>, StrT>>
inline QString toString() const {
return m_handle.toString();
}
private:
QAndroidJniObject m_handle;
};
......
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