minor fixes

This commit is contained in:
liuhaibo.2020 2020-05-15 16:29:20 +08:00
parent 646db73f73
commit b739ef71e2
7 changed files with 28 additions and 25 deletions

View File

@ -18,7 +18,6 @@
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
// THE SOFTWARE. // THE SOFTWARE.
#pragma once
#include <kiwano-physics/Global.h> #include <kiwano-physics/Global.h>
namespace kiwano namespace kiwano

View File

@ -65,6 +65,9 @@ void Action::UpdateStep(Actor* target, Duration dt)
case Status::Started: case Status::Started:
Update(target, dt); Update(target, dt);
break; break;
default:
break;
} }
if (status_ == Status::Done) if (status_ == Status::Done)

View File

@ -73,9 +73,9 @@ public:
/// \~chinese /// \~chinese
/// @brief »ñÈ¡º¬ÓжÔÏóÀàÐÍ /// @brief »ñÈ¡º¬ÓжÔÏóÀàÐÍ
inline const type_info& GetType() const noexcept inline const std::type_info& GetType() const noexcept
{ {
const type_info* const info = GetTypeinfo(); const std::type_info* const info = GetTypeinfo();
if (info) if (info)
{ {
return *info; return *info;
@ -132,7 +132,7 @@ public:
{ {
static_assert(!std::is_void<_Ty>::value, "oc::Any cannot contain void"); static_assert(!std::is_void<_Ty>::value, "oc::Any cannot contain void");
const type_info* const info = GetTypeinfo(); const std::type_info* const info = GetTypeinfo();
if (info && (*info == typeid(std::decay<_Ty>::type))) if (info && (*info == typeid(std::decay<_Ty>::type)))
{ {
if (HasSmallType()) if (HasSmallType())
@ -193,12 +193,12 @@ public:
} }
private: private:
const type_info*& GetTypeinfo() const std::type_info*& GetTypeinfo()
{ {
return storage_.small_.info_; return storage_.small_.info_;
} }
const type_info* GetTypeinfo() const const std::type_info* GetTypeinfo() const
{ {
return storage_.small_.info_; return storage_.small_.info_;
} }
@ -430,14 +430,14 @@ private:
private: private:
struct SmallStorage struct SmallStorage
{ {
const type_info* info_; const std::type_info* info_;
SmallStorageRTTI rtti_; SmallStorageRTTI rtti_;
char buffer_[ANY_SMALL_SPACE_SIZE]; char buffer_[ANY_SMALL_SPACE_SIZE];
}; };
struct BigStorage struct BigStorage
{ {
const type_info* info_; const std::type_info* info_;
BigStorageRTTI rtti_; BigStorageRTTI rtti_;
void* ptr_; void* ptr_;
}; };

View File

@ -75,9 +75,9 @@ public:
virtual void Release() = 0; virtual void Release() = 0;
virtual _Ret Invoke(_Args&&... args) const = 0; virtual _Ret Invoke(_Args&&... args) const = 0;
virtual const type_info& TargetType() const noexcept = 0; virtual const std::type_info& TargetType() const noexcept = 0;
virtual const void* Target(const type_info& type) const noexcept = 0; virtual const void* Target(const std::type_info& type) const noexcept = 0;
}; };
template <typename _Ret, typename... _Args> template <typename _Ret, typename... _Args>
@ -121,12 +121,12 @@ public:
return std::invoke(callee_, std::forward<_Args>(args)...); return std::invoke(callee_, std::forward<_Args>(args)...);
} }
virtual const type_info& TargetType() const noexcept virtual const std::type_info& TargetType() const noexcept
{ {
return typeid(_Ty); return typeid(_Ty);
} }
virtual const void* Target(const type_info& type) const noexcept virtual const void* Target(const std::type_info& type) const noexcept
{ {
if (type == this->TargetType()) if (type == this->TargetType())
return &callee_; return &callee_;
@ -153,12 +153,12 @@ public:
return std::invoke(func_, ptr_, std::forward<_Args>(args)...); return std::invoke(func_, ptr_, std::forward<_Args>(args)...);
} }
virtual const type_info& TargetType() const noexcept virtual const std::type_info& TargetType() const noexcept
{ {
return typeid(ProxyMemCallable); return typeid(ProxyMemCallable);
} }
virtual const void* Target(const type_info& type) const noexcept virtual const void* Target(const std::type_info& type) const noexcept
{ {
if (type == this->TargetType()) if (type == this->TargetType())
return this; return this;
@ -193,12 +193,12 @@ public:
return std::invoke(func_, ptr_, std::forward<_Args>(args)...); return std::invoke(func_, ptr_, std::forward<_Args>(args)...);
} }
virtual const type_info& TargetType() const noexcept virtual const std::type_info& TargetType() const noexcept
{ {
return typeid(ProxyConstMemCallable); return typeid(ProxyConstMemCallable);
} }
virtual const void* Target(const type_info& type) const noexcept virtual const void* Target(const std::type_info& type) const noexcept
{ {
if (type == this->TargetType()) if (type == this->TargetType())
return this; return this;
@ -321,7 +321,7 @@ public:
std::swap(callable_, rhs.callable_); std::swap(callable_, rhs.callable_);
} }
const type_info& target_type() const noexcept const std::type_info& target_type() const noexcept
{ {
return callable_->TargetType(); return callable_->TargetType();
} }

View File

@ -246,13 +246,13 @@ public:
} }
public: public:
template <typename _PtrTy> template <typename _IterPtrTy>
struct Iterator struct Iterator
{ {
using iterator_category = std::bidirectional_iterator_tag; using iterator_category = std::bidirectional_iterator_tag;
using value_type = _PtrTy; using value_type = _IterPtrTy;
using pointer = _PtrTy*; using pointer = _IterPtrTy*;
using reference = _PtrTy&; using reference = _IterPtrTy&;
using difference_type = ptrdiff_t; using difference_type = ptrdiff_t;
inline Iterator(value_type ptr = nullptr, bool is_end = false) inline Iterator(value_type ptr = nullptr, bool is_end = false)

View File

@ -73,13 +73,13 @@ public:
SmartPtr(pointer_type p) SmartPtr(pointer_type p)
: ptr_(p) : ptr_(p)
{ {
typename _ProxyTy::Retain(ptr_); _ProxyTy::Retain(ptr_);
} }
SmartPtr(const SmartPtr& other) SmartPtr(const SmartPtr& other)
: ptr_(other.ptr_) : ptr_(other.ptr_)
{ {
typename _ProxyTy::Retain(ptr_); _ProxyTy::Retain(ptr_);
} }
SmartPtr(SmartPtr&& other) noexcept SmartPtr(SmartPtr&& other) noexcept
@ -97,7 +97,7 @@ public:
SmartPtr(const SmartPtr<_UTy, _ProxyTy>& other) SmartPtr(const SmartPtr<_UTy, _ProxyTy>& other)
{ {
ptr_ = const_cast<pointer_type>(dynamic_cast<const_pointer_type>(other.Get())); ptr_ = const_cast<pointer_type>(dynamic_cast<const_pointer_type>(other.Get()));
typename _ProxyTy::Retain(ptr_); _ProxyTy::Retain(ptr_);
} }
inline pointer_type Get() noexcept inline pointer_type Get() noexcept
@ -193,7 +193,7 @@ public:
private: private:
void Tidy() void Tidy()
{ {
typename _ProxyTy::Release(ptr_); _ProxyTy::Release(ptr_);
ptr_ = nullptr; ptr_ = nullptr;
} }

View File

@ -19,6 +19,7 @@
// THE SOFTWARE. // THE SOFTWARE.
#pragma once #pragma once
#include <kiwano/render/Color.h>
#include <kiwano/render/NativeObject.h> #include <kiwano/render/NativeObject.h>
#include <kiwano/render/Texture.h> #include <kiwano/render/Texture.h>