From 138d3f4d3d6e2aaf5ba34f89af15ef85ea074357 Mon Sep 17 00:00:00 2001 From: chai Date: Mon, 8 Nov 2021 09:23:38 +0800 Subject: *misc --- Runtime/Lua/LuaBind/signal/bind.h | 510 -------------------------------------- 1 file changed, 510 deletions(-) delete mode 100644 Runtime/Lua/LuaBind/signal/bind.h (limited to 'Runtime/Lua/LuaBind/signal/bind.h') diff --git a/Runtime/Lua/LuaBind/signal/bind.h b/Runtime/Lua/LuaBind/signal/bind.h deleted file mode 100644 index e29896b..0000000 --- a/Runtime/Lua/LuaBind/signal/bind.h +++ /dev/null @@ -1,510 +0,0 @@ -// Aseprite Base Library -// Copyright (c) 2001-2013 David Capello -// -// This file is released under the terms of the MIT license. -// Read LICENSE.txt for more information. - -#ifndef BASE_BIND_H_INCLUDED -#define BASE_BIND_H_INCLUDED -#pragma once - -// BindAdapter0_fun -template -class BindAdapter0_fun -{ - F f; -public: - BindAdapter0_fun(const F& f) : f(f) { } - - R operator()() { return f(); } - - template - R operator()(const A1& a1) { return f(); } - - template - R operator()(const A1& a1, const A2& a2) { return f(); } - - template - R operator()(const A1& a1, const A2& a2, const A3& a3) { return f(); } - - template - R operator()(const A1& a1, const A2& a2, const A3& a3, const A4& a4) { return f(); } -}; - -template -class BindAdapter0_fun -{ - F f; -public: - BindAdapter0_fun(const F& f) : f(f) { } - - void operator()() { f(); } - - template - void operator()(const A1& a1) { f(); } - - template - void operator()(const A1& a1, const A2& a2) { f(); } - - template - void operator()(const A1& a1, const A2& a2, const A3& a3) { f(); } - - template - void operator()(const A1& a1, const A2& a2, const A3& a3, const A4& a4) { f(); } -}; - -template -BindAdapter0_fun -Bind(const F& f) -{ - return BindAdapter0_fun(f); -} - -// BindAdapter0_mem -template -class BindAdapter0_mem -{ - R (T::*m)(); - T* t; -public: - template - BindAdapter0_mem(R (T::*m)(), T2* t) : m(m), t(t) { } - - R operator()() { return (t->*m)(); } - - template - R operator()(const A1& a1) { return (t->*m)(); } - - template - R operator()(const A1& a1, const A2& a2) { return (t->*m)(); } - - template - R operator()(const A1& a1, const A2& a2, const A3& a3) { return (t->*m)(); } - - template - R operator()(const A1& a1, const A2& a2, const A3& a3, const A4& a4) { return (t->*m)(); } -}; - -template -class BindAdapter0_mem -{ - void (T::*m)(); - T* t; -public: - template - BindAdapter0_mem(void (T::*m)(), T2* t) : m(m), t(t) { } - - void operator()() { (t->*m)(); } - - template - void operator()(const A1& a1) { (t->*m)(); } - - template - void operator()(const A1& a1, const A2& a2) { (t->*m)(); } - - template - void operator()(const A1& a1, const A2& a2, const A3& a3) { (t->*m)(); } - - template - void operator()(const A1& a1, const A2& a2, const A3& a3, const A4& a4) { (t->*m)(); } -}; - -template -BindAdapter0_mem -Bind(R (T::*m)(), T2* t) -{ - return BindAdapter0_mem(m, t); -} - -// BindAdapter1_fun -template -class BindAdapter1_fun -{ - F f; - X1 x1; -public: - BindAdapter1_fun(const F& f, X1 x1) : f(f), x1(x1) { } - - R operator()() { return f(x1); } - - template - R operator()(const A1& a1) { return f(x1); } - - template - R operator()(const A1& a1, const A2& a2) { return f(x1); } - - template - R operator()(const A1& a1, const A2& a2, const A3& a3) { return f(x1); } - - template - R operator()(const A1& a1, const A2& a2, const A3& a3, const A4& a4) { return f(x1); } -}; - -template -class BindAdapter1_fun -{ - F f; - X1 x1; -public: - BindAdapter1_fun(const F& f, X1 x1) : f(f), x1(x1) { } - - void operator()() { f(x1); } - - template - void operator()(const A1& a1) { f(x1); } - - template - void operator()(const A1& a1, const A2& a2) { f(x1); } - - template - void operator()(const A1& a1, const A2& a2, const A3& a3) { f(x1); } - - template - void operator()(const A1& a1, const A2& a2, const A3& a3, const A4& a4) { f(x1); } -}; - -template -BindAdapter1_fun -Bind(const F& f, X1 x1) -{ - return BindAdapter1_fun(f, x1); -} - -// BindAdapter1_mem -template -class BindAdapter1_mem -{ - R (T::*m)(B1); - T* t; - X1 x1; -public: - template - BindAdapter1_mem(R (T::*m)(B1), T2* t, X1 x1) : m(m), t(t), x1(x1) { } - - R operator()() { return (t->*m)(x1); } - - template - R operator()(const A1& a1) { return (t->*m)(x1); } - - template - R operator()(const A1& a1, const A2& a2) { return (t->*m)(x1); } - - template - R operator()(const A1& a1, const A2& a2, const A3& a3) { return (t->*m)(x1); } - - template - R operator()(const A1& a1, const A2& a2, const A3& a3, const A4& a4) { return (t->*m)(x1); } -}; - -template -class BindAdapter1_mem -{ - void (T::*m)(B1); - T* t; - X1 x1; -public: - template - BindAdapter1_mem(void (T::*m)(B1), T2* t, X1 x1) : m(m), t(t), x1(x1) { } - - void operator()() { (t->*m)(x1); } - - template - void operator()(const A1& a1) { (t->*m)(x1); } - - template - void operator()(const A1& a1, const A2& a2) { (t->*m)(x1); } - - template - void operator()(const A1& a1, const A2& a2, const A3& a3) { (t->*m)(x1); } - - template - void operator()(const A1& a1, const A2& a2, const A3& a3, const A4& a4) { (t->*m)(x1); } -}; - -template -BindAdapter1_mem -Bind(R (T::*m)(B1), T2* t, X1 x1) -{ - return BindAdapter1_mem(m, t, x1); -} - -// BindAdapter2_fun -template -class BindAdapter2_fun -{ - F f; - X1 x1; - X2 x2; -public: - BindAdapter2_fun(const F& f, X1 x1, X2 x2) : f(f), x1(x1), x2(x2) { } - - R operator()() { return f(x1, x2); } - - template - R operator()(const A1& a1) { return f(x1, x2); } - - template - R operator()(const A1& a1, const A2& a2) { return f(x1, x2); } - - template - R operator()(const A1& a1, const A2& a2, const A3& a3) { return f(x1, x2); } - - template - R operator()(const A1& a1, const A2& a2, const A3& a3, const A4& a4) { return f(x1, x2); } -}; - -template -class BindAdapter2_fun -{ - F f; - X1 x1; - X2 x2; -public: - BindAdapter2_fun(const F& f, X1 x1, X2 x2) : f(f), x1(x1), x2(x2) { } - - void operator()() { f(x1, x2); } - - template - void operator()(const A1& a1) { f(x1, x2); } - - template - void operator()(const A1& a1, const A2& a2) { f(x1, x2); } - - template - void operator()(const A1& a1, const A2& a2, const A3& a3) { f(x1, x2); } - - template - void operator()(const A1& a1, const A2& a2, const A3& a3, const A4& a4) { f(x1, x2); } -}; - -template -BindAdapter2_fun -Bind(const F& f, X1 x1, X2 x2) -{ - return BindAdapter2_fun(f, x1, x2); -} - -// BindAdapter2_mem -template -class BindAdapter2_mem -{ - R (T::*m)(B1, B2); - T* t; - X1 x1; - X2 x2; -public: - template - BindAdapter2_mem(R (T::*m)(B1, B2), T2* t, X1 x1, X2 x2) : m(m), t(t), x1(x1), x2(x2) { } - - R operator()() { return (t->*m)(x1, x2); } - - template - R operator()(const A1& a1) { return (t->*m)(x1, x2); } - - template - R operator()(const A1& a1, const A2& a2) { return (t->*m)(x1, x2); } - - template - R operator()(const A1& a1, const A2& a2, const A3& a3) { return (t->*m)(x1, x2); } - - template - R operator()(const A1& a1, const A2& a2, const A3& a3, const A4& a4) { return (t->*m)(x1, x2); } -}; - -template -class BindAdapter2_mem -{ - void (T::*m)(B1, B2); - T* t; - X1 x1; - X2 x2; -public: - template - BindAdapter2_mem(void (T::*m)(B1, B2), T2* t, X1 x1, X2 x2) : m(m), t(t), x1(x1), x2(x2) { } - - void operator()() { (t->*m)(x1, x2); } - - template - void operator()(const A1& a1) { (t->*m)(x1, x2); } - - template - void operator()(const A1& a1, const A2& a2) { (t->*m)(x1, x2); } - - template - void operator()(const A1& a1, const A2& a2, const A3& a3) { (t->*m)(x1, x2); } - - template - void operator()(const A1& a1, const A2& a2, const A3& a3, const A4& a4) { (t->*m)(x1, x2); } -}; - -template -BindAdapter2_mem -Bind(R (T::*m)(B1, B2), T2* t, X1 x1, X2 x2) -{ - return BindAdapter2_mem(m, t, x1, x2); -} - -// BindAdapter3_fun -template -class BindAdapter3_fun -{ - F f; - X1 x1; - X2 x2; - X3 x3; -public: - BindAdapter3_fun(const F& f, X1 x1, X2 x2, X3 x3) : f(f), x1(x1), x2(x2), x3(x3) { } - - R operator()() { return f(x1, x2, x3); } - - template - R operator()(const A1& a1) { return f(x1, x2, x3); } - - template - R operator()(const A1& a1, const A2& a2) { return f(x1, x2, x3); } - - template - R operator()(const A1& a1, const A2& a2, const A3& a3) { return f(x1, x2, x3); } - - template - R operator()(const A1& a1, const A2& a2, const A3& a3, const A4& a4) { return f(x1, x2, x3); } -}; - -template -class BindAdapter3_fun -{ - F f; - X1 x1; - X2 x2; - X3 x3; -public: - BindAdapter3_fun(const F& f, X1 x1, X2 x2, X3 x3) : f(f), x1(x1), x2(x2), x3(x3) { } - - void operator()() { f(x1, x2, x3); } - - template - void operator()(const A1& a1) { f(x1, x2, x3); } - - template - void operator()(const A1& a1, const A2& a2) { f(x1, x2, x3); } - - template - void operator()(const A1& a1, const A2& a2, const A3& a3) { f(x1, x2, x3); } - - template - void operator()(const A1& a1, const A2& a2, const A3& a3, const A4& a4) { f(x1, x2, x3); } -}; - -template -BindAdapter3_fun -Bind(const F& f, X1 x1, X2 x2, X3 x3) -{ - return BindAdapter3_fun(f, x1, x2, x3); -} - -// BindAdapter3_mem -template -class BindAdapter3_mem -{ - R (T::*m)(B1, B2, B3); - T* t; - X1 x1; - X2 x2; - X3 x3; -public: - template - BindAdapter3_mem(R (T::*m)(B1, B2, B3), T2* t, X1 x1, X2 x2, X3 x3) : m(m), t(t), x1(x1), x2(x2), x3(x3) { } - - R operator()() { return (t->*m)(x1, x2, x3); } - - template - R operator()(const A1& a1) { return (t->*m)(x1, x2, x3); } - - template - R operator()(const A1& a1, const A2& a2) { return (t->*m)(x1, x2, x3); } - - template - R operator()(const A1& a1, const A2& a2, const A3& a3) { return (t->*m)(x1, x2, x3); } - - template - R operator()(const A1& a1, const A2& a2, const A3& a3, const A4& a4) { return (t->*m)(x1, x2, x3); } -}; - -template -class BindAdapter3_mem -{ - void (T::*m)(B1, B2, B3); - T* t; - X1 x1; - X2 x2; - X3 x3; -public: - template - BindAdapter3_mem(void (T::*m)(B1, B2, B3), T2* t, X1 x1, X2 x2) : m(m), t(t), x1(x1), x2(x2) { } - - void operator()() { (t->*m)(x1, x2, x3); } - - template - void operator()(const A1& a1) { (t->*m)(x1, x2, x3); } - - template - void operator()(const A1& a1, const A2& a2) { (t->*m)(x1, x2, x3); } - - template - void operator()(const A1& a1, const A2& a2, const A3& a3) { (t->*m)(x1, x2, x3); } - - template - void operator()(const A1& a1, const A2& a2, const A3& a3, const A4& a4) { (t->*m)(x1, x2, x3); } -}; - -template -BindAdapter3_mem -Bind(R (T::*m)(B1, B2, B3), T2* t, X1 x1, X2 x2) -{ - return BindAdapter3_mem(m, t, x1, x2); -} - -// Helper class to holds references as pointers (to avoid copying the -// original object). -template -class RefWrapper -{ - T* ptr; -public: - RefWrapper(T& ref) : ptr(&ref) { } - operator T&() const { return *ptr; } -}; - -// Creates RefWrappers, useful to wrap arguments that have to be -// passed as a reference when you use Bind. -template -RefWrapper Ref(T& ref) -{ - return RefWrapper(ref); -} - -#endif -- cgit v1.1-26-g67d0