From bd3fe0cac583739bc0d7c4b5c8f301bb350abca0 Mon Sep 17 00:00:00 2001 From: Andy Belle-Isle Date: Fri, 30 Aug 2019 00:19:31 -0400 Subject: Renamed lib to deps so github will ignore it for language stats --- lib/sol2/include/sol/property.hpp | 149 -------------------------------------- 1 file changed, 149 deletions(-) delete mode 100644 lib/sol2/include/sol/property.hpp (limited to 'lib/sol2/include/sol/property.hpp') diff --git a/lib/sol2/include/sol/property.hpp b/lib/sol2/include/sol/property.hpp deleted file mode 100644 index cc7b77f..0000000 --- a/lib/sol2/include/sol/property.hpp +++ /dev/null @@ -1,149 +0,0 @@ -// sol3 - -// The MIT License (MIT) - -// Copyright (c) 2013-2019 Rapptz, ThePhD and contributors - -// 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. - -#ifndef SOL_PROPERTY_HPP -#define SOL_PROPERTY_HPP - -#include "types.hpp" -#include "ebco.hpp" -#include -#include - -namespace sol { - namespace detail { - struct no_prop {}; - } - - template - struct property_wrapper : detail::ebco, detail::ebco { - private: - using read_base_t = detail::ebco; - using write_base_t = detail::ebco; - - public: - template - property_wrapper(Rx&& r, Wx&& w) - : read_base_t(std::forward(r)), write_base_t(std::forward(w)) { - } - - W& write() { - return write_base_t::value(); - } - - const W& write() const { - return write_base_t::value(); - } - - R& read() { - return read_base_t::value(); - } - - const R& read() const { - return read_base_t::value(); - } - }; - - template - inline decltype(auto) property(F&& f, G&& g) { - typedef lua_bind_traits> left_traits; - typedef lua_bind_traits> right_traits; - if constexpr (left_traits::free_arity < right_traits::free_arity) { - return property_wrapper, std::decay_t>(std::forward(f), std::forward(g)); - } - else { - return property_wrapper, std::decay_t>(std::forward(g), std::forward(f)); - } - } - - template - inline decltype(auto) property(F&& f) { - typedef lua_bind_traits> left_traits; - if constexpr (left_traits::free_arity < 2) { - return property_wrapper, detail::no_prop>(std::forward(f), detail::no_prop()); - } - else { - return property_wrapper>(detail::no_prop(), std::forward(f)); - } - } - - template - inline decltype(auto) readonly_property(F&& f) { - return property_wrapper, detail::no_prop>(std::forward(f), detail::no_prop()); - } - - template - inline decltype(auto) writeonly_property(F&& f) { - return property_wrapper>(detail::no_prop(), std::forward(f)); - } - - template - struct readonly_wrapper : detail::ebco { - private: - using base_t = detail::ebco; - - public: - using base_t::base_t; - - operator T&() { - return base_t::value(); - } - operator const T&() const { - return base_t::value(); - } - }; - - // Allow someone to make a member variable readonly (const) - template - inline auto readonly(R T::*v) { - return readonly_wrapper>(v); - } - - template - struct var_wrapper : detail::ebco { - private: - using base_t = detail::ebco; - - public: - using base_t::base_t; - }; - - template - inline auto var(V&& v) { - typedef std::decay_t T; - return var_wrapper(std::forward(v)); - } - - namespace meta { - template - struct is_member_object : std::is_member_object_pointer {}; - - template - struct is_member_object> : std::true_type {}; - - template - inline constexpr bool is_member_object_v = is_member_object::value; - } // namespace meta - -} // namespace sol - -#endif // SOL_PROPERTY_HPP -- cgit v1.2.3