fix: native object validate
This commit is contained in:
parent
b4f1f0f566
commit
4a5c2bdcb1
|
|
@ -106,25 +106,21 @@ public:
|
||||||
|
|
||||||
inline pointer_type operator->()
|
inline pointer_type operator->()
|
||||||
{
|
{
|
||||||
KGE_ASSERT(ptr_ != nullptr && "Invalid pointer");
|
|
||||||
return ptr_;
|
return ptr_;
|
||||||
}
|
}
|
||||||
|
|
||||||
inline const_pointer_type operator->() const
|
inline const_pointer_type operator->() const
|
||||||
{
|
{
|
||||||
KGE_ASSERT(ptr_ != nullptr && "Invalid pointer");
|
|
||||||
return ptr_;
|
return ptr_;
|
||||||
}
|
}
|
||||||
|
|
||||||
inline reference_type operator*()
|
inline reference_type operator*()
|
||||||
{
|
{
|
||||||
KGE_ASSERT(ptr_ != nullptr && "Invalid pointer");
|
|
||||||
return *ptr_;
|
return *ptr_;
|
||||||
}
|
}
|
||||||
|
|
||||||
inline const_reference_type operator*() const
|
inline const_reference_type operator*() const
|
||||||
{
|
{
|
||||||
KGE_ASSERT(ptr_ != nullptr && "Invalid pointer");
|
|
||||||
return *ptr_;
|
return *ptr_;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -47,6 +47,8 @@ public:
|
||||||
|
|
||||||
void ResetNative();
|
void ResetNative();
|
||||||
|
|
||||||
|
bool IsValid() const override;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
Any native_;
|
Any native_;
|
||||||
};
|
};
|
||||||
|
|
@ -86,4 +88,9 @@ inline void NativeObject::ResetNative()
|
||||||
native_.Clear();
|
native_.Clear();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
inline bool NativeObject::IsValid() const
|
||||||
|
{
|
||||||
|
return native_.HasValue() && ObjectBase::IsValid();
|
||||||
|
}
|
||||||
|
|
||||||
} // namespace kiwano
|
} // namespace kiwano
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue