Remove dependency on Boost.Preprocessor library.
This commit is contained in:
parent
906f4f968b
commit
be45dc87d8
@ -204,6 +204,7 @@ nobase_include_HEADERS = \
|
||||
asio/detail/timer_scheduler.hpp \
|
||||
asio/detail/tss_ptr.hpp \
|
||||
asio/detail/type_traits.hpp \
|
||||
asio/detail/variadic_templates.hpp \
|
||||
asio/detail/wait_handler.hpp \
|
||||
asio/detail/wait_op.hpp \
|
||||
asio/detail/weak_ptr.hpp \
|
||||
|
@ -26,14 +26,7 @@
|
||||
|
||||
#if !defined(ASIO_HAS_VARIADIC_TEMPLATES)
|
||||
|
||||
# include <boost/preprocessor/arithmetic/inc.hpp>
|
||||
# include <boost/preprocessor/repetition/enum_binary_params.hpp>
|
||||
# include <boost/preprocessor/repetition/enum_params.hpp>
|
||||
# include <boost/preprocessor/repetition/repeat_from_to.hpp>
|
||||
|
||||
# if !defined(ASIO_SOCKET_IOSTREAM_MAX_ARITY)
|
||||
# define ASIO_SOCKET_IOSTREAM_MAX_ARITY 5
|
||||
# endif // !defined(ASIO_SOCKET_IOSTREAM_MAX_ARITY)
|
||||
# include "asio/detail/variadic_templates.hpp"
|
||||
|
||||
// A macro that should expand to:
|
||||
// template <typename T1, ..., typename Tn>
|
||||
@ -48,16 +41,16 @@
|
||||
// }
|
||||
// This macro should only persist within this file.
|
||||
|
||||
# define ASIO_PRIVATE_CTR_DEF(z, n, data) \
|
||||
template <BOOST_PP_ENUM_PARAMS(n, typename T)> \
|
||||
explicit basic_socket_iostream(BOOST_PP_ENUM_BINARY_PARAMS(n, T, x)) \
|
||||
# define ASIO_PRIVATE_CTR_DEF(n) \
|
||||
template <ASIO_VARIADIC_TPARAMS(n)> \
|
||||
explicit basic_socket_iostream(ASIO_VARIADIC_PARAMS(n)) \
|
||||
: std::basic_iostream<char>( \
|
||||
&this->detail::socket_iostream_base< \
|
||||
Protocol, StreamSocketService, Time, \
|
||||
TimeTraits, TimerService>::streambuf_) \
|
||||
{ \
|
||||
this->setf(std::ios_base::unitbuf); \
|
||||
if (rdbuf()->connect(BOOST_PP_ENUM_PARAMS(n, x)) == 0) \
|
||||
if (rdbuf()->connect(ASIO_VARIADIC_ARGS(n)) == 0) \
|
||||
this->setstate(std::ios_base::failbit); \
|
||||
} \
|
||||
/**/
|
||||
@ -71,11 +64,11 @@
|
||||
// }
|
||||
// This macro should only persist within this file.
|
||||
|
||||
# define ASIO_PRIVATE_CONNECT_DEF(z, n, data) \
|
||||
template <BOOST_PP_ENUM_PARAMS(n, typename T)> \
|
||||
void connect(BOOST_PP_ENUM_BINARY_PARAMS(n, T, x)) \
|
||||
# define ASIO_PRIVATE_CONNECT_DEF(n) \
|
||||
template <ASIO_VARIADIC_TPARAMS(n)> \
|
||||
void connect(ASIO_VARIADIC_PARAMS(n)) \
|
||||
{ \
|
||||
if (rdbuf()->connect(BOOST_PP_ENUM_PARAMS(n, x)) == 0) \
|
||||
if (rdbuf()->connect(ASIO_VARIADIC_ARGS(n)) == 0) \
|
||||
this->setstate(std::ios_base::failbit); \
|
||||
} \
|
||||
/**/
|
||||
@ -174,9 +167,7 @@ public:
|
||||
this->setstate(std::ios_base::failbit);
|
||||
}
|
||||
#else
|
||||
BOOST_PP_REPEAT_FROM_TO(
|
||||
1, BOOST_PP_INC(ASIO_SOCKET_IOSTREAM_MAX_ARITY),
|
||||
ASIO_PRIVATE_CTR_DEF, _ )
|
||||
ASIO_VARIADIC_GENERATE(ASIO_PRIVATE_CTR_DEF)
|
||||
#endif
|
||||
|
||||
#if defined(GENERATING_DOCUMENTATION)
|
||||
@ -196,9 +187,7 @@ public:
|
||||
this->setstate(std::ios_base::failbit);
|
||||
}
|
||||
#else
|
||||
BOOST_PP_REPEAT_FROM_TO(
|
||||
1, BOOST_PP_INC(ASIO_SOCKET_IOSTREAM_MAX_ARITY),
|
||||
ASIO_PRIVATE_CONNECT_DEF, _ )
|
||||
ASIO_VARIADIC_GENERATE(ASIO_PRIVATE_CONNECT_DEF)
|
||||
#endif
|
||||
|
||||
/// Close the connection.
|
||||
|
@ -35,14 +35,7 @@
|
||||
|
||||
#if !defined(ASIO_HAS_VARIADIC_TEMPLATES)
|
||||
|
||||
# include <boost/preprocessor/arithmetic/inc.hpp>
|
||||
# include <boost/preprocessor/repetition/enum_binary_params.hpp>
|
||||
# include <boost/preprocessor/repetition/enum_params.hpp>
|
||||
# include <boost/preprocessor/repetition/repeat_from_to.hpp>
|
||||
|
||||
# if !defined(ASIO_SOCKET_STREAMBUF_MAX_ARITY)
|
||||
# define ASIO_SOCKET_STREAMBUF_MAX_ARITY 5
|
||||
# endif // !defined(ASIO_SOCKET_STREAMBUF_MAX_ARITY)
|
||||
# include "asio/detail/variadic_templates.hpp"
|
||||
|
||||
// A macro that should expand to:
|
||||
// template <typename T1, ..., typename Tn>
|
||||
@ -60,17 +53,16 @@
|
||||
// }
|
||||
// This macro should only persist within this file.
|
||||
|
||||
# define ASIO_PRIVATE_CONNECT_DEF( z, n, data ) \
|
||||
template <BOOST_PP_ENUM_PARAMS(n, typename T)> \
|
||||
# define ASIO_PRIVATE_CONNECT_DEF(n) \
|
||||
template <ASIO_VARIADIC_TPARAMS(n)> \
|
||||
basic_socket_streambuf<Protocol, StreamSocketService, \
|
||||
Time, TimeTraits, TimerService>* connect( \
|
||||
BOOST_PP_ENUM_BINARY_PARAMS(n, T, x)) \
|
||||
Time, TimeTraits, TimerService>* connect(ASIO_VARIADIC_PARAMS(n)) \
|
||||
{ \
|
||||
init_buffers(); \
|
||||
this->basic_socket<Protocol, StreamSocketService>::close(ec_); \
|
||||
typedef typename Protocol::resolver resolver_type; \
|
||||
typedef typename resolver_type::query resolver_query; \
|
||||
resolver_query query(BOOST_PP_ENUM_PARAMS(n, x)); \
|
||||
resolver_query query(ASIO_VARIADIC_ARGS(n)); \
|
||||
resolve_and_connect(query); \
|
||||
return !ec_ ? this : 0; \
|
||||
} \
|
||||
@ -215,9 +207,7 @@ public:
|
||||
return !ec_ ? this : 0;
|
||||
}
|
||||
#else
|
||||
BOOST_PP_REPEAT_FROM_TO(
|
||||
1, BOOST_PP_INC(ASIO_SOCKET_STREAMBUF_MAX_ARITY),
|
||||
ASIO_PRIVATE_CONNECT_DEF, _ )
|
||||
ASIO_VARIADIC_GENERATE(ASIO_PRIVATE_CONNECT_DEF)
|
||||
#endif
|
||||
|
||||
/// Close the connection.
|
||||
|
63
asio/include/asio/detail/variadic_templates.hpp
Normal file
63
asio/include/asio/detail/variadic_templates.hpp
Normal file
@ -0,0 +1,63 @@
|
||||
//
|
||||
// detail/variadic_templates.hpp
|
||||
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
//
|
||||
// Copyright (c) 2003-2013 Christopher M. Kohlhoff (chris at kohlhoff dot com)
|
||||
//
|
||||
// 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 ASIO_DETAIL_VARIADIC_TEMPLATES_HPP
|
||||
#define ASIO_DETAIL_VARIADIC_TEMPLATES_HPP
|
||||
|
||||
#if defined(_MSC_VER) && (_MSC_VER >= 1200)
|
||||
# pragma once
|
||||
#endif // defined(_MSC_VER) && (_MSC_VER >= 1200)
|
||||
|
||||
#include "asio/detail/config.hpp"
|
||||
|
||||
#if !defined(ASIO_HAS_VARIADIC_TEMPLATES)
|
||||
|
||||
# define ASIO_VARIADIC_TPARAMS(n) ASIO_VARIADIC_TPARAMS_##n
|
||||
|
||||
# define ASIO_VARIADIC_TPARAMS_1 \
|
||||
typename T1
|
||||
# define ASIO_VARIADIC_TPARAMS_2 \
|
||||
typename T1, typename T2
|
||||
# define ASIO_VARIADIC_TPARAMS_3 \
|
||||
typename T1, typename T2, typename T3
|
||||
# define ASIO_VARIADIC_TPARAMS_4 \
|
||||
typename T1, typename T2, typename T3, typename T4
|
||||
# define ASIO_VARIADIC_TPARAMS_5 \
|
||||
typename T1, typename T2, typename T3, typename T4, typename T5
|
||||
|
||||
# define ASIO_VARIADIC_TARGS(n) ASIO_VARIADIC_TARGS_##n
|
||||
|
||||
# define ASIO_VARIADIC_TARGS_1 x1
|
||||
# define ASIO_VARIADIC_TARGS_2 x1, x2
|
||||
# define ASIO_VARIADIC_TARGS_3 x1, x2, x3
|
||||
# define ASIO_VARIADIC_TARGS_4 x1, x2, x3, x4
|
||||
# define ASIO_VARIADIC_TARGS_5 x1, x2, x3, x4, x5
|
||||
|
||||
# define ASIO_VARIADIC_PARAMS(n) ASIO_VARIADIC_PARAMS_##n
|
||||
|
||||
# define ASIO_VARIADIC_PARAMS_1 T1 x1
|
||||
# define ASIO_VARIADIC_PARAMS_2 T1 x1, T2 x2
|
||||
# define ASIO_VARIADIC_PARAMS_3 T1 x1, T2 x2, T3 x3
|
||||
# define ASIO_VARIADIC_PARAMS_4 T1 x1, T2 x2, T3 x3, T4 x4
|
||||
# define ASIO_VARIADIC_PARAMS_5 T1 x1, T2 x2, T3 x3, T4 x4, T5 x5
|
||||
|
||||
# define ASIO_VARIADIC_ARGS(n) ASIO_VARIADIC_ARGS_##n
|
||||
|
||||
# define ASIO_VARIADIC_ARGS_1 x1
|
||||
# define ASIO_VARIADIC_ARGS_2 x1, x2
|
||||
# define ASIO_VARIADIC_ARGS_3 x1, x2, x3
|
||||
# define ASIO_VARIADIC_ARGS_4 x1, x2, x3, x4
|
||||
# define ASIO_VARIADIC_ARGS_5 x1, x2, x3, x4, x5
|
||||
|
||||
# define ASIO_VARIADIC_GENERATE(m) m(1) m(2) m(3) m(4) m(5)
|
||||
|
||||
#endif // !defined(ASIO_HAS_VARIADIC_TEMPLATES)
|
||||
|
||||
#endif // ASIO_DETAIL_VARIADIC_TEMPLATES_HPP
|
Loading…
Reference in New Issue
Block a user