35#if !defined(WARN_UNUSED_RETURN)
36#define WARN_UNUSED_RETURN
54 T
get()
const {
return m_ptr; }
59 T operator->()
const {
return m_ptr; }
62 explicit operator bool()
const {
return m_ptr; }
119 if (T ptr = leakRef())
125 return std::exchange(m_ptr,
nullptr);
130 return operator=(o.
get());
135 if (T ptr = std::exchange(m_ptr, o.leakRef()))
144 if (T ptr = std::exchange(m_ptr, optr))
151 std::swap(m_ptr, o.m_ptr);
161 return a.
get() == b.
get();
176 return a.
get() != b.
get();
struct OpaqueJSString * JSStringRef
Definition JSBase.h:49
struct OpaqueJSContext * JSGlobalContextRef
Definition JSBase.h:46
void JSGlobalContextRelease(JSGlobalContextRef ctx)
Releases a global JavaScript execution context.
JSGlobalContextRef JSGlobalContextRetain(JSGlobalContextRef ctx)
Retains a global JavaScript execution context.
JSRetainPtr< JSStringRef > adopt(JSStringRef)
Definition JSRetainPtr.h:89
void JSRelease(JSStringRef string)
Definition JSRetainPtr.h:40
void swap(JSRetainPtr< T > &a, JSRetainPtr< T > &b)
Definition JSRetainPtr.h:154
AdoptTag
Definition JSRetainPtr.h:44
@ Adopt
Definition JSRetainPtr.h:44
#define WARN_UNUSED_RETURN
Definition JSRetainPtr.h:36
void JSRetain(JSStringRef string)
Definition JSRetainPtr.h:39
bool operator==(const JSRetainPtr< T > &a, const JSRetainPtr< U > &b)
Definition JSRetainPtr.h:159
bool operator!=(const JSRetainPtr< T > &a, const JSRetainPtr< U > &b)
Definition JSRetainPtr.h:174
void JSStringRelease(JSStringRef string)
Releases a JavaScript string.
JSStringRef JSStringRetain(JSStringRef string)
Retains a JavaScript string.
Definition JSRetainPtr.h:46
void swap(JSRetainPtr &)
Definition JSRetainPtr.h:149
friend JSRetainPtr< JSStringRef > adopt(JSStringRef)
Definition JSRetainPtr.h:89
JSRetainPtr & operator=(const JSRetainPtr &)
Definition JSRetainPtr.h:128
JSRetainPtr(T ptr)
Definition JSRetainPtr.h:49
bool operator!() const
Definition JSRetainPtr.h:61
T leakRef() WARN_UNUSED_RETURN
Definition JSRetainPtr.h:123
T get() const
Definition JSRetainPtr.h:54
void clear()
Definition JSRetainPtr.h:117
~JSRetainPtr()
Definition JSRetainPtr.h:111