⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 defaults_gen.hpp

📁 CGAL is a collaborative effort of several sites in Europe and Israel. The goal is to make the most i
💻 HPP
📖 第 1 页 / 共 2 页
字号:
/////////////////////////////////////////////////////////////////////////////////// Copyright David Abrahams 2002, Joel de Guzman, 2002.// Distributed under the Boost Software License, Version 1.0. (See// accompanying file LICENSE_1_0.txt or copy at// http://www.boost.org/LICENSE_1_0.txt)/////////////////////////////////////////////////////////////////////////////////#ifndef DEFAULTS_GEN_JDG20020807_HPP#define DEFAULTS_GEN_JDG20020807_HPP#include <boost/python/detail/preprocessor.hpp>#include <boost/preprocessor/repeat.hpp>#include <boost/preprocessor/repeat_from_to.hpp>#include <boost/preprocessor/enum.hpp>#include <boost/preprocessor/enum_params.hpp>#include <boost/preprocessor/repetition/enum_binary_params.hpp>#include <boost/preprocessor/tuple.hpp>#include <boost/preprocessor/cat.hpp>#include <boost/preprocessor/arithmetic/sub.hpp>#include <boost/preprocessor/stringize.hpp>#include <boost/preprocessor/inc.hpp>#include <boost/preprocessor/empty.hpp>#include <boost/preprocessor/comma_if.hpp>#include <boost/config.hpp>#include <boost/mpl/begin_end.hpp>#include <boost/mpl/next.hpp>#include <boost/mpl/deref.hpp>#include <cstddef>namespace boost { namespace python {namespace detail{  // overloads_base is used as a base class for all function  // stubs. This class holds the doc_string of the stubs.  struct overloads_base  {      overloads_base(char const* doc_)          : m_doc(doc_) {}      overloads_base(char const* doc_, detail::keyword_range const& kw)          : m_doc(doc_), m_keywords(kw) {}      char const* doc_string() const      {          return m_doc;      }      detail::keyword_range const& keywords() const      {          return m_keywords;      }   private:      char const* m_doc;      detail::keyword_range m_keywords;  };  // overloads_proxy is generated by the overloads_common operator[] (see  // below). This class holds a user defined call policies of the stubs.  template <class CallPoliciesT, class OverloadsT>  struct overloads_proxy      : public overloads_base  {      typedef typename OverloadsT::non_void_return_type   non_void_return_type;      typedef typename OverloadsT::void_return_type       void_return_type;      overloads_proxy(          CallPoliciesT const& policies_          , char const* doc          , keyword_range const& kw          )          : overloads_base(doc, kw)            , policies(policies_)      {}      CallPoliciesT      call_policies() const      {          return policies;      }      CallPoliciesT policies;  };  // overloads_common is our default function stubs base class. This  // class returns the default_call_policies in its call_policies()  // member function.  It can generate a overloads_proxy however through  // its operator[]  template <class DerivedT>  struct overloads_common      : public overloads_base  {      overloads_common(char const* doc)          : overloads_base(doc) {}      overloads_common(char const* doc, keyword_range const& kw)          : overloads_base(doc, kw) {}      default_call_policies      call_policies() const      {          return default_call_policies();      }      template <class CallPoliciesT>      overloads_proxy<CallPoliciesT, DerivedT>      operator[](CallPoliciesT const& policies) const      {          return overloads_proxy<CallPoliciesT, DerivedT>(              policies, this->doc_string(), this->keywords());      }  };}}} // namespace boost::python::detail#define BOOST_PYTHON_TYPEDEF_GEN(z, index, data)                                \    typedef typename ::boost::mpl::next<BOOST_PP_CAT(iter, index)>::type        \        BOOST_PP_CAT(iter, BOOST_PP_INC(index));                                \    typedef typename ::boost::mpl::deref<BOOST_PP_CAT(iter, index)>::type       \        BOOST_PP_CAT(T, index);#define BOOST_PYTHON_FUNC_WRAPPER_GEN(z, index, data)                   \    static RT BOOST_PP_CAT(func_,                                       \        BOOST_PP_SUB_D(1, index, BOOST_PP_TUPLE_ELEM(3, 1, data))) (    \        BOOST_PP_ENUM_BINARY_PARAMS_Z(                                  \            1, index, T, arg))                                          \    {                                                                   \        BOOST_PP_TUPLE_ELEM(3, 2, data)                                 \        BOOST_PP_TUPLE_ELEM(3, 0, data)(                                \            BOOST_PP_ENUM_PARAMS(                                       \                index,                                                  \                arg));                                                  \    }#define BOOST_PYTHON_GEN_FUNCTION(fname, fstubs_name, n_args, n_dflts, ret)     \    struct fstubs_name                                                          \    {                                                                           \        BOOST_STATIC_CONSTANT(int, n_funcs = BOOST_PP_INC(n_dflts));            \        BOOST_STATIC_CONSTANT(int, max_args = n_funcs);                         \                                                                                \        template <typename SigT>                                                \        struct gen                                                              \        {                                                                       \            typedef typename ::boost::mpl::begin<SigT>::type rt_iter;           \            typedef typename ::boost::mpl::deref<rt_iter>::type RT;             \            typedef typename ::boost::mpl::next<rt_iter>::type iter0;           \                                                                                \            BOOST_PP_REPEAT_2ND(                                                \                n_args,                                                         \                BOOST_PYTHON_TYPEDEF_GEN,                                       \                0)                                                              \                                                                                \            BOOST_PP_REPEAT_FROM_TO_2(                                          \                BOOST_PP_SUB_D(1, n_args, n_dflts),                             \                BOOST_PP_INC(n_args),                                           \                BOOST_PYTHON_FUNC_WRAPPER_GEN,                                  \                (fname, BOOST_PP_SUB_D(1, n_args, n_dflts), ret))               \        };                                                                      \    };                                                                          \///////////////////////////////////////////////////////////////////////////////#define BOOST_PYTHON_MEM_FUNC_WRAPPER_GEN(z, index, data)                       \    static RT BOOST_PP_CAT(func_,                                               \        BOOST_PP_SUB_D(1, index, BOOST_PP_TUPLE_ELEM(3, 1, data))) (            \            ClassT obj BOOST_PP_COMMA_IF(index)                                 \            BOOST_PP_ENUM_BINARY_PARAMS_Z(1, index, T, arg)                     \        )                                                                       \    {                                                                           \        BOOST_PP_TUPLE_ELEM(3, 2, data) obj.BOOST_PP_TUPLE_ELEM(3, 0, data)(    \            BOOST_PP_ENUM_PARAMS(index, arg)                                    \        );                                                                      \    }#define BOOST_PYTHON_GEN_MEM_FUNCTION(fname, fstubs_name, n_args, n_dflts, ret) \    struct fstubs_name                                                          \    {                                                                           \        BOOST_STATIC_CONSTANT(int, n_funcs = BOOST_PP_INC(n_dflts));            \        BOOST_STATIC_CONSTANT(int, max_args = n_funcs + 1);                     \                                                                                \        template <typename SigT>                                                \        struct gen                                                              \        {                                                                       \            typedef typename ::boost::mpl::begin<SigT>::type rt_iter;           \            typedef typename ::boost::mpl::deref<rt_iter>::type RT;             \                                                                                \            typedef typename ::boost::mpl::next<rt_iter>::type class_iter;      \            typedef typename ::boost::mpl::deref<class_iter>::type ClassT;      \            typedef typename ::boost::mpl::next<class_iter>::type iter0;        \                                                                                \            BOOST_PP_REPEAT_2ND(                                                \                n_args,                                                         \                BOOST_PYTHON_TYPEDEF_GEN,                                       \

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -