15 #ifndef SHAKA_EMBEDDED_CORE_REF_PTR_H_ 16 #define SHAKA_EMBEDDED_CORE_REF_PTR_H_ 18 #include <glog/logging.h> 47 static std::string
name() {
115 operator T*()
const {
121 return ptr_ ==
nullptr;
129 template <
typename U = T>
133 static_assert(std::is_convertible<U*, T*>::value,
134 "U must be implicitly convertible to T");
141 template <
typename U>
147 template <
typename T>
148 std::ostream& operator<<(std::ostream& os, RefPtr<T> arg) {
150 return os <<
"(NULL)";
152 return os << arg.get();
155 template <
typename T>
168 dest->
reset(static_cast<T*>(ptr));
176 return source->JsThis();
182 #endif // SHAKA_EMBEDDED_CORE_REF_PTR_H_ RefPtr & operator=(const RefPtr &other)
static bool FromJsValue(Handle< JsValue > source, RefPtr< T > *dest)
bool IsNullOrUndefined(Handle< JsValue > value)
ReturnVal< JsValue > JsNull()
BackingObject * GetInternalPointer(Handle< JsValue > value)
bool IsDerivedFrom(BackingObject *ptr, const std::string &name)
RefPtr(const RefPtr &other)
static ObjectTracker * Instance()
void reset(U *other=nullptr)
void reset(U *other=nullptr)
static std::string name()
RefPtr(const RefPtr< U > &other)
RefPtr(RefPtr< U > &&other)
static std::string name()
static ReturnVal< JsValue > ToJsValue(RefPtr< T > source)
RefPtr & operator=(RefPtr &&other)