diff --git a/projects/kiwano/kiwano.vcxproj b/projects/kiwano/kiwano.vcxproj
index 8e09898c..c4abc73a 100644
--- a/projects/kiwano/kiwano.vcxproj
+++ b/projects/kiwano/kiwano.vcxproj
@@ -12,6 +12,7 @@
+
@@ -20,10 +21,15 @@
+
+
+
+
+
@@ -129,6 +135,7 @@
+
diff --git a/projects/kiwano/kiwano.vcxproj.filters b/projects/kiwano/kiwano.vcxproj.filters
index d470f726..21b248a6 100644
--- a/projects/kiwano/kiwano.vcxproj.filters
+++ b/projects/kiwano/kiwano.vcxproj.filters
@@ -300,6 +300,24 @@
platform
+
+ core
+
+
+ core
+
+
+ core
+
+
+ core
+
+
+ core
+
+
+ core
+
@@ -512,5 +530,8 @@
platform
+
+ core
+
\ No newline at end of file
diff --git a/src/3rd-party/OuterC/LICENSE b/src/3rd-party/OuterC/LICENSE
deleted file mode 100644
index 9e74ea5c..00000000
--- a/src/3rd-party/OuterC/LICENSE
+++ /dev/null
@@ -1,21 +0,0 @@
-MIT License
-
-Copyright (c) 2019 Nomango
-
-Permission is hereby granted, free of charge, to any person obtaining a copy
-of this software and associated documentation files (the "Software"), to deal
-in the Software without restriction, including without limitation the rights
-to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
-copies of the Software, and to permit persons to whom the Software is
-furnished to do so, subject to the following conditions:
-
-The above copyright notice and this permission notice shall be included in all
-copies or substantial portions of the Software.
-
-THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
-SOFTWARE.
diff --git a/src/3rd-party/OuterC/oc/any.h b/src/3rd-party/OuterC/oc/any.h
deleted file mode 100644
index fa4594b5..00000000
--- a/src/3rd-party/OuterC/oc/any.h
+++ /dev/null
@@ -1,511 +0,0 @@
-// Copyright (c) 2019-2020 OuterC - Nomango
-
-#pragma once
-#include
-#include
-#include
-
-namespace oc
-{
-
-class bad_any_cast : public std::exception
-{
-public:
- bad_any_cast() {}
-
- virtual const char* what() const override
- {
- return "bad any_cast";
- }
-};
-
-
-class any
-{
-public:
- any() : storage_{}
- {
- }
-
- template <
- typename _Ty,
- typename _Decayed = typename std::decay<_Ty>::type,
- typename std::enable_if::value, int>::type = 0
- >
- any(_Ty&& val) : storage_{}
- {
- emplace<_Decayed>(std::forward<_Ty>(val));
- }
-
- template <
- typename _Ty,
- typename... _Args
- >
- any(_Args&&... args) : storage_{}
- {
- using _Decayed = typename std::decay<_Ty>::type;
-
- reset();
- emplace_decayed<_Decayed>(std::forward<_Args>(args)...);
- }
-
- any(const any& rhs) : storage_{}
- {
- copy_from(rhs);
- }
-
- any(any&& rhs) noexcept : storage_{}
- {
- move_from(std::move(rhs));
- }
-
- ~any()
- {
- reset();
- }
-
- inline const type_info& type() const noexcept
- {
- const type_info* const info = typeinfo();
- if (info)
- {
- return *info;
- }
- return typeid(void);
- }
-
- inline bool has_value() const noexcept
- {
- return typeinfo() != nullptr;
- }
-
- template <
- typename _Ty,
- typename... _Args
- >
- void emplace(_Args&&... args)
- {
- using _Decayed = typename std::decay<_Ty>::type;
-
- reset();
- emplace_decayed<_Decayed>(std::forward<_Args>(args)...);
- }
-
- void swap(any& rhs) noexcept
- {
- any old = static_cast(rhs);
- rhs = static_cast(*this);
- *this = static_cast(old);
- }
-
- inline void reset() noexcept
- {
- tidy();
- }
-
- template
- _Ty* cast_pointer() noexcept
- {
- return const_cast<_Ty*>(const_cast(this)->cast_pointer<_Ty>());
- }
-
- template
- const _Ty* cast_pointer() const noexcept
- {
- static_assert(!std::is_void<_Ty>::value, "oc::any cannot contain void");
-
- const type_info* const info = typeinfo();
- if (info && (*info == typeid(std::decay<_Ty>::type)))
- {
- if (has_small_type())
- {
- return static_cast(small_data());
- }
- else
- {
- return static_cast(big_data());
- }
- }
- return nullptr;
- }
-
- template
- _Ty cast()
- {
- using _Decayed = typename std::decay<_Ty>::type;
-
- const auto ptr = cast_pointer<_Decayed>();
- if (!ptr)
- {
- throw bad_any_cast{};
- }
- return static_cast<_Ty>(*ptr);
- }
-
- template
- _Ty cast() const
- {
- using _Decayed = typename std::decay<_Ty>::type;
-
- const auto ptr = cast_pointer<_Decayed>();
- if (!ptr)
- {
- throw bad_any_cast{};
- }
- return static_cast<_Ty>(*ptr);
- }
-
- any& operator=(const any& rhs)
- {
- *this = any(rhs);
- return (*this);
- }
-
- any& operator=(any&& rhs) noexcept
- {
- reset();
- move_from(std::move(rhs));
- return (*this);
- }
-
-protected:
- const type_info*& typeinfo()
- {
- return storage_.small_.info_;
- }
-
- const type_info* typeinfo() const
- {
- return storage_.small_.info_;
- }
-
- template <
- typename _Decayed,
- typename... _Args
- >
- inline void emplace_decayed(_Args&&... args)
- {
- store<_Decayed>(decayed_is_small<_Decayed>{}, std::forward<_Args>(args)...);
- }
-
- template <
- typename _Decayed,
- typename... _Args
- >
- void store(std::true_type, _Args&&... args)
- {
- storage_.is_small_ = true;
- typeinfo() = &typeid(_Decayed);
- small_rtti() = small_storage_rtti::make<_Decayed>();
-
- ::new (small_data()) _Decayed(std::forward<_Args>(args)...);
- }
-
- template <
- typename _Decayed,
- typename... _Args
- >
- void store(std::false_type, _Args&&... args)
- {
- storage_.is_small_ = false;
- typeinfo() = &typeid(_Decayed);
- big_rtti() = big_storage_rtti::make<_Decayed>();
-
- big_data() = ::new _Decayed(std::forward<_Args>(args)...);
- }
-
- void tidy() noexcept
- {
- if (has_value())
- {
- if (has_small_type())
- {
- small_rtti().destroy(small_data());
- }
- else
- {
- big_rtti().destroy(big_data());
- big_data() = nullptr;
- }
- typeinfo() = nullptr;
- }
- }
-
- void copy_from(const any& rhs)
- {
- if (rhs.has_value())
- {
- typeinfo() = rhs.typeinfo();
- storage_.is_small_ = rhs.storage_.is_small_;
-
- if (rhs.has_small_type())
- {
- small_rtti() = rhs.small_rtti();
- small_rtti().copy(small_data(), rhs.small_data());
- }
- else
- {
- big_rtti() = rhs.big_rtti();
- big_data() = big_rtti().copy(rhs.big_data());
- }
- }
- }
-
- void move_from(any&& rhs) noexcept
- {
- if (rhs.has_value())
- {
- typeinfo() = rhs.typeinfo();
- storage_.is_small_ = rhs.storage_.is_small_;
-
- if (rhs.has_small_type())
- {
- small_rtti() = rhs.small_rtti();
- small_rtti().move(small_data(), rhs.small_data());
- }
- else
- {
- big_rtti() = rhs.big_rtti();
- big_data() = rhs.big_data();
- rhs.typeinfo() = nullptr;
- }
- }
- }
-
- inline void* small_data()
- {
- return storage_.small_.buffer_;
- }
-
- inline const void* small_data() const
- {
- return storage_.small_.buffer_;
- }
-
- inline void*& big_data()
- {
- return storage_.big_.ptr_;
- }
-
- inline void* big_data() const
- {
- return storage_.big_.ptr_;
- }
-
- inline bool has_small_type() const
- {
- return storage_.is_small_;
- }
-
-protected:
- static const auto ANY_SMALL_SPACE_SIZE = 8U;
-
- template
- struct decayed_is_small : public std::bool_constant
- {
- };
-
- struct big_storage_rtti
- {
- using destroy_func = void(void*);
- using copy_func = void*(const void*);
-
- big_storage_rtti()
- {
- destroy = nullptr;
- copy = nullptr;
- }
-
- template
- static inline big_storage_rtti make()
- {
- big_storage_rtti rtti;
- rtti.destroy = &big_storage_rtti::destroy_impl<_Ty>;
- rtti.copy = &big_storage_rtti::copy_impl<_Ty>;
- return rtti;
- }
-
- template
- static void destroy_impl(void* const ptr) noexcept
- {
- ::delete static_cast<_Ty*>(ptr);
- }
-
- template
- static void* copy_impl(const void* const ptr) noexcept
- {
- return ::new _Ty(*static_cast(ptr));
- }
-
- destroy_func* destroy;
- copy_func* copy;
- };
-
- struct small_storage_rtti
- {
- using destroy_func = void(void*);
- using copy_func = void* (void*, const void*);
- using move_func = void*(void*, void*);
-
- small_storage_rtti()
- {
- destroy = nullptr;
- copy = nullptr;
- move = nullptr;
- }
-
- template
- static inline small_storage_rtti make()
- {
- small_storage_rtti rtti;
- rtti.destroy = &small_storage_rtti::destroy_impl<_Ty>;
- rtti.copy = &small_storage_rtti::copy_impl<_Ty>;
- rtti.move = &small_storage_rtti::move_impl<_Ty>;
- return rtti;
- }
-
- template
- static void destroy_impl(void* const ptr) noexcept
- {
- if (ptr)
- {
- _Ty& obj = *(static_cast<_Ty* const>(ptr));
- obj.~_Ty();
- }
- }
-
- template
- static void* copy_impl(void* const target, const void* const ptr) noexcept
- {
- return ::new (static_cast<_Ty*>(target)) _Ty(*static_cast(ptr));
- }
-
- template
- static void* move_impl(void* const target, void* const ptr) noexcept
- {
- return ::new (static_cast<_Ty*>(target)) _Ty(std::move(*static_cast<_Ty*>(ptr)));
- }
-
- destroy_func* destroy;
- copy_func* copy;
- move_func* move;
- };
-
-protected:
- inline small_storage_rtti& small_rtti()
- {
- return storage_.small_.rtti_;
- }
-
- inline const small_storage_rtti& small_rtti() const
- {
- return storage_.small_.rtti_;
- }
-
- inline big_storage_rtti& big_rtti()
- {
- return storage_.big_.rtti_;
- }
-
- inline const big_storage_rtti& big_rtti() const
- {
- return storage_.big_.rtti_;
- }
-
-protected:
- struct small_storage
- {
- const type_info* info_;
- small_storage_rtti rtti_;
- char buffer_[ANY_SMALL_SPACE_SIZE];
- };
-
- struct big_storage
- {
- const type_info* info_;
- big_storage_rtti rtti_;
- void* ptr_;
- };
-
- struct storage
- {
- bool is_small_;
- union
- {
- small_storage small_;
- big_storage big_;
- };
-
- storage() : is_small_(false), small_() {} // fix error C2280 for VisualStudio 2015
- };
-
- storage storage_;
-};
-
-
-//
-// any_cast functions
-//
-
-template
-_Ty* any_cast(any* const a) noexcept
-{
- return a->cast_pointer<_Ty>();
-}
-
-template
-const _Ty* any_cast(const any* const a) noexcept
-{
- return a->cast_pointer<_Ty>();
-}
-
-template
-_Ty any_cast(any& a)
-{
- using _Decayed = typename std::decay<_Ty>::type;
-
- const auto ptr = any_cast<_Decayed>(&a);
- if (!ptr)
- {
- throw bad_any_cast{};
- }
- return static_cast<_Ty>(*ptr);
-}
-
-template
-const _Ty any_cast(const any& a)
-{
- using _Decayed = typename std::decay<_Ty>::type;
-
- const auto ptr = any_cast<_Decayed>(&a);
- if (!ptr)
- {
- throw bad_any_cast{};
- }
- return static_cast<_Ty>(*ptr);
-}
-
-template
-_Ty any_cast(any&& a)
-{
- using _Decayed = typename std::decay<_Ty>::type;
-
- const auto ptr = any_cast<_Decayed>(&a);
- if (!ptr)
- {
- throw bad_any_cast{};
- }
- return static_cast<_Ty>(std::move(*ptr));
-}
-
-} // namespace oc
-
-namespace std
-{
-
-inline void swap(oc::any& lhs, oc::any& rhs) noexcept
-{
- lhs.swap(rhs);
-}
-
-}
diff --git a/src/3rd-party/OuterC/oc/function.h b/src/3rd-party/OuterC/oc/function.h
deleted file mode 100644
index af9cce32..00000000
--- a/src/3rd-party/OuterC/oc/function.h
+++ /dev/null
@@ -1,169 +0,0 @@
-// Copyright (c) 2019-2020 OuterC - Nomango
-
-#pragma once
-#include "function/details.h"
-#include
-
-namespace oc
-{
-
-class bad_function_call : public ::std::exception
-{
-public:
- bad_function_call() {}
-
- virtual const char* what() const override
- {
- return "bad function call";
- }
-};
-
-
-template
-class function;
-
-template
-class function<_Ret(_Args...)>
-{
-public:
- function()
- : callable_(nullptr)
- {
- }
-
- function(std::nullptr_t)
- : callable_(nullptr)
- {
- }
-
- function(const function& rhs)
- : callable_(rhs.callable_)
- {
- if (callable_) callable_->retain();
- }
-
- function(function&& rhs) noexcept
- : callable_(rhs.callable_)
- {
- rhs.callable_ = nullptr;
- }
-
- function(_Ret(*func)(_Args...))
- {
- callable_ = __function_detail::proxy_callable<_Ret(*)(_Args...), _Ret, _Args...>::make(::std::move(func));
- if (callable_) callable_->retain();
- }
-
- template<
- typename _Ty,
- typename = typename ::std::enable_if<__function_detail::is_callable<_Ty, _Ret, _Args...>::value, int>::type>
- function(_Ty val)
- {
- callable_ = __function_detail::proxy_callable<_Ty, _Ret, _Args...>::make(::std::move(val));
- if (callable_) callable_->retain();
- }
-
- template::value || ::std::is_base_of<_Ty, _Uty>::value, int>::type>
- function(_Uty* ptr, _Ret(_Ty::* func)(_Args...))
- {
- callable_ = __function_detail::proxy_mem_callable<_Ty, _Ret, _Args...>::make(ptr, func);
- if (callable_) callable_->retain();
- }
-
- template::value || ::std::is_base_of<_Ty, _Uty>::value, int>::type>
- function(_Uty* ptr, _Ret(_Ty::* func)(_Args...) const)
- {
- callable_ = __function_detail::proxy_const_mem_callable<_Ty, _Ret, _Args...>::make(ptr, func);
- if (callable_) callable_->retain();
- }
-
- ~function()
- {
- tidy();
- }
-
- inline void swap(const function& rhs)
- {
- std::swap(callable_, rhs.callable_);
- }
-
- inline _Ret operator()(_Args... args) const
- {
- if (!callable_)
- throw bad_function_call();
- return callable_->invoke(::std::forward<_Args>(args)...);
- }
-
- inline operator bool() const
- {
- return !!callable_;
- }
-
- inline function& operator=(const function& rhs)
- {
- tidy();
- callable_ = rhs.callable_;
- if (callable_) callable_->retain();
- return (*this);
- }
-
- inline function& operator=(function&& rhs)
- {
- tidy();
- callable_ = rhs.callable_;
- rhs.callable_ = nullptr;
- return (*this);
- }
-
-private:
- inline void tidy()
- {
- if (callable_)
- {
- callable_->release();
- callable_ = nullptr;
- }
- }
-
-private:
- __function_detail::callable<_Ret, _Args...>* callable_;
-};
-
-template::value || std::is_base_of<_Ty, _Uty>::value, int
- >::type,
- typename _Ret,
- typename... _Args
->
-inline function<_Ret(_Args...)> closure(_Uty* ptr, _Ret(_Ty::* func)(_Args...))
-{
- return function<_Ret(_Args...)>(ptr, func);
-}
-
-template::value || std::is_base_of<_Ty, _Uty>::value, int
- >::type,
- typename _Ret,
- typename... _Args
->
-inline function<_Ret(_Args...)> closure(_Uty* ptr, _Ret(_Ty::* func)(_Args...) const)
-{
- return function<_Ret(_Args...)>(ptr, func);
-}
-
-
-template
-inline void swap(oc::function<_Ret(_Args...)>& lhs, oc::function<_Ret(_Args...)>& rhs) noexcept
-{
- lhs.swap(rhs);
-}
-
-} // namespace oc
diff --git a/src/3rd-party/OuterC/oc/function/details.h b/src/3rd-party/OuterC/oc/function/details.h
deleted file mode 100644
index 66813ea6..00000000
--- a/src/3rd-party/OuterC/oc/function/details.h
+++ /dev/null
@@ -1,168 +0,0 @@
-// Copyright (c) 2019-2020 OuterC - Nomango
-
-#pragma once
-#include
-
-namespace oc
-{
-namespace __function_detail
-{
-
-template
-struct is_callable_helper
-{
- template
- struct class_mem;
-
- template
- struct class_const_mem;
-
- template
- static int test(...);
-
- template
- static char test(class_mem<_Uty, &_Uty::operator()>*);
-
- template
- static char test(class_const_mem<_Uty, &_Uty::operator()>*);
-
- template<
- typename _Uty,
- typename _Uret = typename std::decay().operator()(std::declval<_Args>()...))>::type,
- typename = typename std::enable_if::value>::type
- >
- static char test(int);
-
- static constexpr bool value = sizeof(test<_Ty>(0)) == sizeof(char);
-};
-
-template
-struct is_callable
- : public ::std::bool_constant::value>
-{
-};
-
-//
-// callable
-//
-
-template
-class callable
-{
-public:
- virtual ~callable() {}
-
- virtual void retain() = 0;
- virtual void release() = 0;
- virtual _Ret invoke(_Args... args) const = 0;
-};
-
-template
-class ref_count_callable
- : public callable<_Ret, _Args...>
-{
-public:
- ref_count_callable() : ref_count_(0) {}
-
- virtual void retain() override
- {
- ++ref_count_;
- }
-
- virtual void release() override
- {
- --ref_count_;
- if (ref_count_ <= 0)
- {
- delete this;
- }
- }
-
-private:
- int ref_count_;
-};
-
-template
-class proxy_callable
- : public ref_count_callable<_Ret, _Args...>
-{
-public:
- proxy_callable(_Ty&& val)
- : callee_(::std::move(val))
- {
- }
-
- virtual _Ret invoke(_Args... args) const override
- {
- return callee_(::std::forward<_Args&&>(args)...);
- }
-
- static inline callable<_Ret, _Args...>* make(_Ty&& val)
- {
- return new (::std::nothrow) proxy_callable<_Ty, _Ret, _Args...>(::std::move(val));
- }
-
-private:
- _Ty callee_;
-};
-
-template
-class proxy_mem_callable
- : public ref_count_callable<_Ret, _Args...>
-{
-public:
- typedef _Ret(_Ty::* _FuncType)(_Args...);
-
- virtual _Ret invoke(_Args... args) const override
- {
- return (ptr_->*func_)(::std::forward<_Args>(args)...);
- }
-
- static inline callable<_Ret, _Args...>* make(_Ty* ptr, _FuncType func)
- {
- return new (::std::nothrow) proxy_mem_callable<_Ty, _Ret, _Args...>(ptr, func);
- }
-
-protected:
- proxy_mem_callable(_Ty* ptr, _FuncType func)
- : ptr_(ptr)
- , func_(func)
- {
- }
-
-protected:
- _Ty* ptr_;
- _FuncType func_;
-};
-
-template
-class proxy_const_mem_callable
- : public ref_count_callable<_Ret, _Args...>
-{
-public:
- typedef _Ret(_Ty::* _FuncType)(_Args...) const;
-
- virtual _Ret invoke(_Args... args) const override
- {
- return (ptr_->*func_)(::std::forward<_Args>(args)...);
- }
-
- static inline callable<_Ret, _Args...>* make(_Ty* ptr, _FuncType func)
- {
- return new (::std::nothrow) proxy_const_mem_callable<_Ty, _Ret, _Args...>(ptr, func);
- }
-
-protected:
- proxy_const_mem_callable(_Ty* ptr, _FuncType func)
- : ptr_(ptr)
- , func_(func)
- {
- }
-
-protected:
- _Ty* ptr_;
- _FuncType func_;
-};
-
-} // namespace __function_detail
-} // namespace oc
diff --git a/src/3rd-party/OuterC/oc/intrusive_list.h b/src/3rd-party/OuterC/oc/intrusive_list.h
deleted file mode 100644
index 81c3d8e1..00000000
--- a/src/3rd-party/OuterC/oc/intrusive_list.h
+++ /dev/null
@@ -1,258 +0,0 @@
-// Copyright (c) 2019-2020 OuterC - Nomango
-
-#pragma once
-#include
-#include
-#include
-#include "macros.h"
-
-namespace oc
-{
-
-template ::pointer>
-class intrusive_list;
-
-template ::pointer>
-class intrusive_list_item
-{
-public:
- using pointer = _PTy;
-
- intrusive_list_item() : prev_(nullptr), next_(nullptr) {}
- intrusive_list_item(pointer rhs) : prev_(nullptr), next_(nullptr) { if (rhs) { prev_ = rhs->prev_; next_ = rhs->next_; } }
-
- const pointer prev_item() const { return prev_; }
- pointer prev_item() { return prev_; }
- const pointer next_item() const { return next_; }
- pointer next_item() { return next_; }
-
-private:
- pointer prev_;
- pointer next_;
-
- friend class intrusive_list<_Ty, _PTy>;
-};
-
-
-template
-class intrusive_list
-{
-public:
- using value_type = typename std::pointer_traits<_PTy>::element_type;
- using pointer = _PTy;
- using reference = value_type&;
-
- intrusive_list() : first_(), last_() {}
- ~intrusive_list() { clear(); }
-
- const pointer first_item() const { return first_; }
- pointer first_item() { return first_; }
- const pointer last_item() const { return last_; }
- pointer last_item() { return last_; }
-
- inline bool empty() const
- {
- return first_ == nullptr;
- }
-
- void push_back(pointer child)
- {
- if (child->prev_)
- child->prev_->next_ = child->next_;
- if (child->next_)
- child->next_->prev_ = child->prev_;
-
- child->prev_ = last_;
- child->next_ = nullptr;
-
- if (first_)
- {
- last_->next_ = child;
- }
- else
- {
- first_ = child;
- }
-
- last_ = child;
- }
-
- void push_front(pointer child)
- {
- if (child->prev_)
- child->prev_->next_ = child->next_;
- if (child->next_)
- child->next_->prev_ = child->prev_;
-
- child->prev_ = nullptr;
- child->next_ = first_;
-
- if (first_)
- {
- first_->prev_ = child;
- }
- else
- {
- last_ = child;
- }
-
- first_ = child;
- }
-
- void insert_before(pointer child, pointer before)
- {
- if (child->prev_)
- child->prev_->next_ = child->next_;
- if (child->next_)
- child->next_->prev_ = child->prev_;
-
- if (before->prev_)
- before->prev_->next_ = child;
- else
- first_ = child;
-
- child->prev_ = before->prev_;
- child->next_ = before;
- before->prev_ = child;
- }
-
- void insert_after(pointer child, pointer after)
- {
- if (child->prev_)
- child->prev_->next_ = child->next_;
- if (child->next_)
- child->next_->prev_ = child->prev_;
-
- if (after->next_)
- after->next_->prev_ = child;
- else
- last_ = child;
-
- child->next_ = after->next_;
- child->prev_ = after;
- after->next_ = child;
- }
-
- void remove(pointer child)
- {
- if (child->next_)
- {
- child->next_->prev_ = child->prev_;
- }
- else
- {
- last_ = child->prev_;
- }
-
- if (child->prev_)
- {
- child->prev_->next_ = child->next_;
- }
- else
- {
- first_ = child->next_;
- }
-
- child->prev_ = nullptr;
- child->next_ = nullptr;
- }
-
- void clear()
- {
- pointer p = first_;
- while (p)
- {
- pointer tmp = p;
- p = p->next_;
- if (tmp)
- {
- tmp->next_ = nullptr;
- tmp->prev_ = nullptr;
- }
- }
- first_ = nullptr;
- last_ = nullptr;
- }
-
- void check_list()
- {
- if (!first_)
- return;
-
- int pos = 0;
- pointer p = first_;
- pointer tmp = p;
- do
- {
- tmp = p;
- p = p->next_;
- ++pos;
-
- if (p)
- {
- OC_ASSERT(p->prev_ == tmp && "Check list failed");
- }
- else
- {
- OC_ASSERT(tmp == last_ && "Check list failed");
- }
- } while (p);
- }
-
-public:
- // Iterator
- template
- struct iterator_impl
- {
- using iterator_category = std::bidirectional_iterator_tag;
- using value_type = typename std::pointer_traits<_PTy>::element_type;
- using difference_type = ptrdiff_t;
- using pointer = _PTy;
- using reference = value_type&;
-
- inline iterator_impl(pointer ptr = nullptr, bool is_end = false) : base_(ptr), is_end_(is_end) {}
-
- inline pointer base() const { OC_ASSERT(!is_end_); return const_cast(base_); }
- inline reference operator*() const { OC_ASSERT(base_ && !is_end_); return const_cast(*base_); }
- inline pointer operator->() const { OC_ASSERT(base_ && !is_end_); return const_cast(base_); }
- inline iterator_impl& operator++() { OC_ASSERT(base_ && !is_end_); pointer next = base_->next_item(); if (next) base_ = next; else is_end_ = true; return (*this); }
- inline iterator_impl operator++(int) { iterator_impl old = (*this); ++(*this); return old; }
- inline iterator_impl& operator--() { OC_ASSERT(base_); if (is_end_) is_end_ = false; else base_ = pointer(base_->prev_item()); return (*this); }
- inline iterator_impl operator--(int) { iterator_impl old = (*this); --(*this); return old; }
- inline bool operator==(iterator_impl const& other) const { return base_ == other.base_ && is_end_ == other.is_end_; }
- inline bool operator!=(iterator_impl const& other) const { return !(*this == other); }
- inline operator bool() const { return base_ != nullptr && !is_end_; }
-
- private:
- bool is_end_;
- pointer base_;
- };
-
- using iterator = iterator_impl;
- using const_iterator = iterator_impl;
- using reverse_iterator = std::reverse_iterator;
- using const_reverse_iterator = std::reverse_iterator;
-
- inline iterator begin() { return iterator(first_item(), first_item() == nullptr); }
- inline const_iterator begin() const { return const_iterator(first_item(), first_item() == nullptr); }
- inline const_iterator cbegin() const { return begin(); }
- inline iterator end() { return iterator(last_item(), true); }
- inline const_iterator end() const { return const_iterator(last_item(), true); }
- inline const_iterator cend() const { return end(); }
- inline reverse_iterator rbegin() { return reverse_iterator(end()); }
- inline const_reverse_iterator rbegin() const { return const_reverse_iterator(end()); }
- inline const_reverse_iterator crbegin() const { return rbegin(); }
- inline reverse_iterator rend() { return reverse_iterator(begin()); }
- inline const_reverse_iterator rend() const { return const_reverse_iterator(begin()); }
- inline const_reverse_iterator crend() const { return rend(); }
- inline pointer front() { if (empty()) throw std::out_of_range("front() called on empty intrusive_list"); return first_item(); }
- inline const pointer front() const { if (empty()) throw std::out_of_range("front() called on empty intrusive_list"); return first_item(); }
- inline pointer back() { if (empty()) throw std::out_of_range("back() called on empty intrusive_list"); return last_item(); }
- inline const pointer back() const { if (empty()) throw std::out_of_range("back() called on empty intrusive_list"); return last_item(); }
-
-private:
- pointer first_;
- pointer last_;
-};
-
-} // namespace oc
diff --git a/src/3rd-party/OuterC/oc/intrusive_ptr.h b/src/3rd-party/OuterC/oc/intrusive_ptr.h
deleted file mode 100644
index e13aef0c..00000000
--- a/src/3rd-party/OuterC/oc/intrusive_ptr.h
+++ /dev/null
@@ -1,201 +0,0 @@
-// Copyright (c) 2019-2020 OuterC - Nomango
-//
-// Permission is hereby granted, free of charge, to any person obtaining lhs copy
-// of this software and associated documentation files (the "Software"), to deal
-// in the Software without restriction, including without limitation the rights
-// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
-// copies of the Software, and to permit persons to whom the Software is
-// furnished to do so, subject to the following conditions:
-//
-// The above copyright notice and this permission notice shall be included in
-// all copies or substantial portions of the Software.
-//
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
-// THE SOFTWARE.
-
-#pragma once
-#include
-#include
-#include
-#include "macros.h"
-
-namespace oc
-{
-
-template
-class intrusive_ptr
-{
-public:
- using value_type = _Ty;
- using pointer_type = _Ty*;
- using const_pointer_type = const _Ty*;
- using reference_type = _Ty&;
- using const_reference_type = const _Ty&;
- using ref_proxy_type = _ProxyTy;
-
- intrusive_ptr() noexcept : ptr_(nullptr) {}
- intrusive_ptr(std::nullptr_t) noexcept : ptr_(nullptr) {}
- intrusive_ptr(pointer_type p) : ptr_(p) { typename ref_proxy_type::add_ref(ptr_); }
- intrusive_ptr(const intrusive_ptr& other) : ptr_(other.ptr_) { typename ref_proxy_type::add_ref(ptr_); }
- intrusive_ptr(intrusive_ptr&& other) noexcept : ptr_(nullptr) { swap(other); }
- ~intrusive_ptr() { tidy(); }
-
- template
- intrusive_ptr(const intrusive_ptr<_UTy, ref_proxy_type>& other) { ptr_ = const_cast(dynamic_cast(other.get())); typename ref_proxy_type::add_ref(ptr_); }
-
- inline pointer_type get() noexcept { return ptr_; }
- inline const_pointer_type get() const noexcept { return ptr_; }
- inline void reset(pointer_type ptr = nullptr) { if (ptr) intrusive_ptr(ptr).swap(*this); else tidy(); }
- inline void swap(intrusive_ptr& other) noexcept { std::swap(ptr_, other.ptr_); }
-
- inline pointer_type operator ->() { OC_ASSERT(ptr_ != nullptr && "Invalid pointer"); return ptr_; }
- inline const_pointer_type operator ->() const { OC_ASSERT(ptr_ != nullptr && "Invalid pointer"); return ptr_; }
- inline reference_type operator *() { OC_ASSERT(ptr_ != nullptr && "Invalid pointer"); return *ptr_; }
- inline const_reference_type operator *() const { OC_ASSERT(ptr_ != nullptr && "Invalid pointer"); return *ptr_; }
- inline pointer_type* operator &() { OC_ASSERT(ptr_ == nullptr && "Memory leak"); return &ptr_; }
- inline operator bool() const noexcept { return ptr_ != nullptr; }
- inline bool operator !() const noexcept { return ptr_ == 0; }
-
- inline intrusive_ptr& operator=(const intrusive_ptr& other) { if (other.ptr_ != ptr_) intrusive_ptr(other).swap(*this); return (*this); }
- inline intrusive_ptr& operator=(intrusive_ptr&& other) noexcept { if (other.ptr_ != ptr_) other.swap(*this); return (*this); }
- inline intrusive_ptr& operator=(pointer_type p) { if (p != ptr_) intrusive_ptr(p).swap(*this); return (*this); }
- inline intrusive_ptr& operator=(std::nullptr_t) { tidy(); return *this; }
-
-private:
- void tidy()
- {
- typename ref_proxy_type::release(ptr_);
- ptr_ = nullptr;
- }
-
-private:
- pointer_type ptr_;
-};
-
-template
-inline bool operator==(intrusive_ptr<_Ty, _ProxyTy> const& lhs, intrusive_ptr<_UTy, _ProxyTy> const& rhs) noexcept
-{
- return lhs.get() == rhs.get();
-}
-
-template
-inline bool operator==(intrusive_ptr<_Ty, _ProxyTy> const& lhs, _Ty* rhs) noexcept
-{
- return lhs.get() == rhs;
-}
-
-template
-inline bool operator==(_Ty* lhs, intrusive_ptr<_Ty, _ProxyTy> const& rhs) noexcept
-{
- return lhs == rhs.get();
-}
-
-template
-inline bool operator==(intrusive_ptr<_Ty, _ProxyTy> const& lhs, std::nullptr_t) noexcept
-{
- return !static_cast(lhs);
-}
-
-template
-inline bool operator==(std::nullptr_t, intrusive_ptr<_Ty, _ProxyTy> const& rhs) noexcept
-{
- return !static_cast(rhs);
-}
-
-template
-inline bool operator!=(intrusive_ptr<_Ty, _ProxyTy> const& lhs, intrusive_ptr<_UTy, _ProxyTy> const& rhs) noexcept
-{
- return !(lhs == rhs);
-}
-
-template
-inline bool operator!=(intrusive_ptr<_Ty, _ProxyTy> const& lhs, _Ty* rhs) noexcept
-{
- return lhs.get() != rhs;
-}
-
-template
-inline bool operator!=(_Ty* lhs, intrusive_ptr<_Ty, _ProxyTy> const& rhs) noexcept
-{
- return lhs != rhs.get();
-}
-
-template
-inline bool operator!=(intrusive_ptr<_Ty, _ProxyTy> const& lhs, std::nullptr_t) noexcept
-{
- return static_cast(lhs);
-}
-
-template
-inline bool operator!=(std::nullptr_t, intrusive_ptr<_Ty, _ProxyTy> const& rhs) noexcept
-{
- return static_cast(rhs);
-}
-
-template
-inline bool operator<(intrusive_ptr<_Ty, _ProxyTy> const& lhs, intrusive_ptr<_UTy, _ProxyTy> const& rhs) noexcept
-{
- return lhs.get() < rhs.get();
-}
-
-// template class cannot specialize std::swap,
-// so implement a swap Function in oc namespace
-template
-inline void swap(intrusive_ptr<_Ty, _ProxyTy>& lhs, intrusive_ptr<_Ty, _ProxyTy>& rhs) noexcept
-{
- lhs.swap(rhs);
-}
-
-
-class intrusive_ref
-{
-public:
- void add_ref()
- {
- ++ref_count_;
- }
-
- void release()
- {
- --ref_count_;
- if (ref_count_ == 0)
- {
- delete this;
- }
- }
-
- int16_t get_ref() const
- {
- return ref_count_;
- }
-
-protected:
- intrusive_ref()
- : ref_count_(0)
- {
- }
-
-private:
- std::atomic ref_count_;
-};
-
-
-class intrusive_ref_proxy
-{
-public:
- static inline void add_ref(intrusive_ref* ptr) { if (ptr) ptr->add_ref(); }
-
- static inline void release(intrusive_ref* ptr) { if (ptr) ptr->release(); }
-};
-
-template<
- typename _Ty,
- typename = typename std::enable_if::value, int>::type>
-using intrusive_ref_ptr = intrusive_ptr<_Ty, intrusive_ref_proxy>;
-
-} // namespace oc
diff --git a/src/3rd-party/OuterC/oc/json.h b/src/3rd-party/OuterC/oc/json.h
deleted file mode 100644
index e61c0d95..00000000
--- a/src/3rd-party/OuterC/oc/json.h
+++ /dev/null
@@ -1,50 +0,0 @@
-// Copyright (c) 2019-2020 OuterC - Nomango
-
-#pragma once
-#include