java/GlobalRef: remove method Set(), always require initialization
This commit is contained in:
parent
917fe549b0
commit
31f7fede30
@ -30,10 +30,6 @@ class AudioManager : public Java::GlobalObject {
|
||||
public:
|
||||
AudioManager(JNIEnv *env, jobject obj) noexcept;
|
||||
|
||||
AudioManager(std::nullptr_t) noexcept { maxVolume = 0; }
|
||||
|
||||
~AudioManager() noexcept {}
|
||||
|
||||
int GetMaxVolume() { return maxVolume; }
|
||||
int GetVolume(JNIEnv *env);
|
||||
void SetVolume(JNIEnv *env, int);
|
||||
|
@ -110,12 +110,6 @@ class GlobalRef {
|
||||
T value;
|
||||
|
||||
public:
|
||||
/**
|
||||
* Constructs an uninitialized object. The method
|
||||
* set() must be called before it is destructed.
|
||||
*/
|
||||
GlobalRef() = default;
|
||||
|
||||
GlobalRef(JNIEnv *env, T _value) noexcept
|
||||
:value(_value)
|
||||
{
|
||||
@ -135,17 +129,6 @@ public:
|
||||
GlobalRef(const GlobalRef &other) = delete;
|
||||
GlobalRef &operator=(const GlobalRef &other) = delete;
|
||||
|
||||
/**
|
||||
* Sets the object, ignoring the previous value. This
|
||||
* is only allowed once after the default constructor
|
||||
* was used.
|
||||
*/
|
||||
void Set(JNIEnv *env, T _value) noexcept {
|
||||
assert(_value != nullptr);
|
||||
|
||||
value = (T)env->NewGlobalRef(_value);
|
||||
}
|
||||
|
||||
T Get() const noexcept {
|
||||
return value;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user