#include <scoped_ref.h>
Public Types | |
typedef JniType ThisType::* | UnspecifiedBoolType |
Public Member Functions | |
scoped_ref (JniType javaObject=nullptr) | |
~scoped_ref () | |
bool | operator! () const |
operator UnspecifiedBoolType () const | |
JniType | get () const |
void | swap (scoped_ref &lhs) |
void | reset (JniType javaObject=nullptr) |
A scoped_ref works in the same way a AZStd::scoped_ptr except it's specificially designed for the opaque pointer JNI types (e.g. jobject, jarray, etc.). Guarantees the java object is released from the JNI environment when the scoped_ref falls out of scope.
|
inlineexplicit |
Only explicit scoped_refs are allowed to be constructed
javaObject | Raw pointer to the java object. Currently only supports Local and Global reference types. Weak Global reference are NOT supported. |
|
inline |
Automatically release the reference with the JNI environment when the object goes out of scope
|
inline |
Explicit accessor of the raw pointer to the java reference.
|
inline |
Operator for implicit bool conversions
|
inline |
Compatibilty with the 'not' operator for validity checks. Only checkes for raw pointer validity, NOT if it's pointing to a null reference (weak global ref).
|
inline |
Reset the internal reference with a new pointer
javaObject | Raw pointer to the java object. Must be of same type. |
|
inline |
Swap the internal reference with another scoped_ref of the same type
lhs | The scoped_ref (of same type) to be swaped with |