update boost
This commit is contained in:
@@ -15,10 +15,10 @@
|
||||
#ifndef BOOST_LOG_UTILITY_MANIPULATORS_ADD_VALUE_HPP_INCLUDED_
|
||||
#define BOOST_LOG_UTILITY_MANIPULATORS_ADD_VALUE_HPP_INCLUDED_
|
||||
|
||||
#include <boost/mpl/if.hpp>
|
||||
#include <boost/type_traits/is_scalar.hpp>
|
||||
#include <boost/type_traits/remove_cv.hpp>
|
||||
#include <boost/type_traits/remove_reference.hpp>
|
||||
#include <boost/type_traits/conditional.hpp>
|
||||
#include <boost/log/detail/config.hpp>
|
||||
#include <boost/log/detail/embedded_string_type.hpp>
|
||||
#include <boost/log/attributes/attribute_name.hpp>
|
||||
@@ -61,14 +61,14 @@ private:
|
||||
// To work around this problem we save the value inside the manipulator in this case.
|
||||
typedef typename remove_reference< reference_type >::type& lvalue_reference_type;
|
||||
|
||||
typedef typename mpl::if_<
|
||||
is_scalar< value_type >,
|
||||
typedef typename conditional<
|
||||
is_scalar< value_type >::value,
|
||||
value_type,
|
||||
lvalue_reference_type
|
||||
>::type stored_type;
|
||||
|
||||
typedef typename mpl::if_<
|
||||
is_scalar< value_type >,
|
||||
typedef typename conditional<
|
||||
is_scalar< value_type >::value,
|
||||
value_type,
|
||||
reference_type
|
||||
>::type get_value_result_type;
|
||||
|
||||
@@ -0,0 +1,66 @@
|
||||
/*
|
||||
* Copyright Andrey Semashev 2019.
|
||||
* Distributed under the Boost Software License, Version 1.0.
|
||||
* (See accompanying file LICENSE_1_0.txt or copy at
|
||||
* https://www.boost.org/LICENSE_1_0.txt)
|
||||
*/
|
||||
/*!
|
||||
* \file utility/manipulators/auto_newline.hpp
|
||||
* \author Andrey Semashev
|
||||
* \date 23.06.2019
|
||||
*
|
||||
* The header contains implementation of a stream manipulator for inserting a newline, unless there is already one inserted.
|
||||
*/
|
||||
|
||||
#ifndef BOOST_LOG_UTILITY_MANIPULATORS_AUTO_NEWLINE_HPP_INCLUDED_
|
||||
#define BOOST_LOG_UTILITY_MANIPULATORS_AUTO_NEWLINE_HPP_INCLUDED_
|
||||
|
||||
#include <boost/log/detail/config.hpp>
|
||||
#include <boost/log/utility/formatting_ostream_fwd.hpp>
|
||||
#include <boost/log/detail/header.hpp>
|
||||
|
||||
#ifdef BOOST_HAS_PRAGMA_ONCE
|
||||
#pragma once
|
||||
#endif
|
||||
|
||||
namespace boost {
|
||||
|
||||
BOOST_LOG_OPEN_NAMESPACE
|
||||
|
||||
/*!
|
||||
* Stream manipulator for inserting a newline character, unless the last character
|
||||
* inserted into the stream is already a newline.
|
||||
*/
|
||||
struct auto_newline_manip {}
|
||||
BOOST_INLINE_VARIABLE const auto_newline = {};
|
||||
|
||||
/*!
|
||||
* Stream output operator for the \c auto_newline manipulator
|
||||
*/
|
||||
template< typename CharT, typename TraitsT, typename AllocatorT >
|
||||
inline basic_formatting_ostream< CharT, TraitsT, AllocatorT >& operator<< (basic_formatting_ostream< CharT, TraitsT, AllocatorT >& strm, auto_newline_manip)
|
||||
{
|
||||
typedef basic_formatting_ostream< CharT, TraitsT, AllocatorT > stream_type;
|
||||
typedef typename stream_type::char_type char_type;
|
||||
typedef typename stream_type::string_type string_type;
|
||||
if (BOOST_LIKELY(strm.good()))
|
||||
{
|
||||
string_type* str = strm.rdbuf()->storage();
|
||||
if (BOOST_LIKELY(!!str))
|
||||
{
|
||||
strm.rdbuf()->pubsync();
|
||||
if (str->empty() || *str->rbegin() != static_cast< char_type >('\n'))
|
||||
strm.rdbuf()->push_back(static_cast< char_type >('\n'));
|
||||
}
|
||||
}
|
||||
|
||||
return strm;
|
||||
}
|
||||
|
||||
BOOST_LOG_CLOSE_NAMESPACE // namespace log
|
||||
|
||||
} // namespace boost
|
||||
|
||||
#include <boost/log/detail/footer.hpp>
|
||||
|
||||
#endif // BOOST_LOG_UTILITY_MANIPULATORS_AUTO_NEWLINE_HPP_INCLUDED_
|
||||
@@ -128,7 +128,7 @@ public:
|
||||
template< typename CharT, typename TraitsT >
|
||||
inline std::basic_ostream< CharT, TraitsT >& operator<< (std::basic_ostream< CharT, TraitsT >& strm, dump_manip const& manip)
|
||||
{
|
||||
if (strm.good())
|
||||
if (BOOST_LIKELY(strm.good()))
|
||||
aux::dump_data(manip.get_data(), manip.get_size(), strm);
|
||||
|
||||
return strm;
|
||||
@@ -155,7 +155,7 @@ public:
|
||||
template< typename CharT, typename TraitsT >
|
||||
inline std::basic_ostream< CharT, TraitsT >& operator<< (std::basic_ostream< CharT, TraitsT >& strm, bounded_dump_manip const& manip)
|
||||
{
|
||||
if (strm.good())
|
||||
if (BOOST_LIKELY(strm.good()))
|
||||
{
|
||||
const std::size_t size = manip.get_size(), max_size = manip.get_max_size();
|
||||
if (max_size >= size)
|
||||
|
||||
160
linx64/include/boost/log/utility/manipulators/invoke.hpp
Normal file
160
linx64/include/boost/log/utility/manipulators/invoke.hpp
Normal file
@@ -0,0 +1,160 @@
|
||||
/*
|
||||
* Copyright Andrey Semashev 2022.
|
||||
* Distributed under the Boost Software License, Version 1.0.
|
||||
* (See accompanying file LICENSE_1_0.txt or copy at
|
||||
* https://www.boost.org/LICENSE_1_0.txt)
|
||||
*/
|
||||
/*!
|
||||
* \file utility/manipulators/invoke.hpp
|
||||
* \author Andrey Semashev
|
||||
* \date 27.02.2022
|
||||
*
|
||||
* The header contains implementation of a stream manipulator for invoking a user-defined function.
|
||||
*/
|
||||
|
||||
#ifndef BOOST_LOG_UTILITY_MANIPULATORS_INVOKE_HPP_INCLUDED_
|
||||
#define BOOST_LOG_UTILITY_MANIPULATORS_INVOKE_HPP_INCLUDED_
|
||||
|
||||
#include <cstddef>
|
||||
#include <boost/core/enable_if.hpp>
|
||||
#include <boost/log/detail/config.hpp>
|
||||
#include <boost/type_traits/remove_cv.hpp>
|
||||
#if !defined(BOOST_NO_CXX11_RVALUE_REFERENCES)
|
||||
#include <boost/type_traits/remove_reference.hpp>
|
||||
#endif
|
||||
#include <boost/log/detail/is_ostream.hpp>
|
||||
#include <boost/log/detail/header.hpp>
|
||||
|
||||
#ifdef BOOST_HAS_PRAGMA_ONCE
|
||||
#pragma once
|
||||
#endif
|
||||
|
||||
namespace boost {
|
||||
|
||||
BOOST_LOG_OPEN_NAMESPACE
|
||||
|
||||
/*!
|
||||
* Stream manipulator for invoking a user-defined function as part of stream output.
|
||||
*/
|
||||
template< typename FunctionT >
|
||||
class invoke_manipulator
|
||||
{
|
||||
private:
|
||||
mutable FunctionT m_function;
|
||||
|
||||
public:
|
||||
//! Initializing constructor
|
||||
explicit invoke_manipulator(FunctionT const& func) :
|
||||
m_function(func)
|
||||
{
|
||||
}
|
||||
|
||||
#if !defined(BOOST_NO_CXX11_RVALUE_REFERENCES)
|
||||
//! Initializing constructor
|
||||
explicit invoke_manipulator(FunctionT&& func) :
|
||||
m_function(static_cast< FunctionT&& >(func))
|
||||
{
|
||||
}
|
||||
#endif
|
||||
|
||||
//! The method invokes the saved function with the output stream
|
||||
template< typename StreamT >
|
||||
void output(StreamT& stream) const
|
||||
{
|
||||
m_function(stream);
|
||||
}
|
||||
};
|
||||
|
||||
/*!
|
||||
* Stream output operator for \c invoke_manipulator. Invokes the function saved in the manipulator.
|
||||
*/
|
||||
template< typename StreamT, typename FunctionT >
|
||||
inline typename boost::enable_if_c< log::aux::is_ostream< StreamT >::value, StreamT& >::type operator<< (StreamT& stream, invoke_manipulator< FunctionT > const& manip)
|
||||
{
|
||||
manip.output(stream);
|
||||
return stream;
|
||||
}
|
||||
|
||||
#if !defined(BOOST_LOG_DOXYGEN_PASS)
|
||||
|
||||
#if !defined(BOOST_NO_CXX11_RVALUE_REFERENCES)
|
||||
|
||||
//! Invoke manipulator generator function
|
||||
template< typename FunctionT >
|
||||
inline invoke_manipulator<
|
||||
typename boost::remove_cv<
|
||||
typename boost::remove_reference< FunctionT >::type
|
||||
>::type
|
||||
>
|
||||
invoke_manip(FunctionT&& func)
|
||||
{
|
||||
return invoke_manipulator<
|
||||
typename boost::remove_cv<
|
||||
typename boost::remove_reference< FunctionT >::type
|
||||
>::type
|
||||
>(static_cast< FunctionT&& >(func));
|
||||
}
|
||||
|
||||
#if !defined(BOOST_NO_CXX11_VARIADIC_TEMPLATES) && \
|
||||
!defined(BOOST_NO_CXX14_GENERIC_LAMBDAS) && \
|
||||
!defined(BOOST_NO_CXX14_RETURN_TYPE_DEDUCTION)
|
||||
|
||||
//! Invoke manipulator generator function
|
||||
template< typename FunctionT, typename Arg0, typename... Args >
|
||||
inline auto invoke_manip(FunctionT&& func, Arg0&& arg0, Args&&... args)
|
||||
{
|
||||
return boost::log::invoke_manip
|
||||
(
|
||||
#if !defined(BOOST_LOG_NO_CXX20_PACK_EXPANSION_IN_LAMBDA_INIT_CAPTURE)
|
||||
[func = static_cast< FunctionT&& >(func), arg0 = static_cast< Arg0&& >(arg0), ...args = static_cast< Args&& >(args)](auto& stream) mutable
|
||||
#else
|
||||
[func, arg0, args...](auto& stream) mutable
|
||||
#endif
|
||||
{
|
||||
#if !defined(BOOST_MSVC) || BOOST_MSVC >= 1910
|
||||
static_cast< FunctionT&& >(func)(stream, static_cast< Arg0&& >(arg0), static_cast< Args&& >(args)...);
|
||||
#else
|
||||
// MSVC 19.0 (VS 14.0) ICEs if we use perfect forwarding here
|
||||
func(stream, arg0, args...);
|
||||
#endif
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
#endif // !defined(BOOST_NO_CXX11_VARIADIC_TEMPLATES) ...
|
||||
|
||||
#else // !defined(BOOST_NO_CXX11_RVALUE_REFERENCES)
|
||||
|
||||
//! Invoke manipulator generator function
|
||||
template< typename FunctionT >
|
||||
inline invoke_manipulator< typename boost::remove_cv< FunctionT >::type >
|
||||
invoke_manip(FunctionT const& func)
|
||||
{
|
||||
return invoke_manipulator< typename boost::remove_cv< FunctionT >::type >(func);
|
||||
}
|
||||
|
||||
#endif // !defined(BOOST_NO_CXX11_RVALUE_REFERENCES)
|
||||
|
||||
#else // !defined(BOOST_LOG_DOXYGEN_PASS)
|
||||
|
||||
/*!
|
||||
* Invoke manipulator generator function.
|
||||
*
|
||||
* \param func User-defined function to invoke on output. The function must be callable with a reference to the output stream as the first argument, followed by \a args.
|
||||
* \param args Additional arguments to pass to \a func.
|
||||
* \returns Manipulator to be inserted into the stream.
|
||||
*
|
||||
* \note \a args are only supported since C++14.
|
||||
*/
|
||||
template< typename FunctionT, typename... Args >
|
||||
invoke_manipulator< unspecified > invoke_manip(FunctionT&& func, Args&&... args);
|
||||
|
||||
#endif // !defined(BOOST_LOG_DOXYGEN_PASS)
|
||||
|
||||
BOOST_LOG_CLOSE_NAMESPACE // namespace log
|
||||
|
||||
} // namespace boost
|
||||
|
||||
#include <boost/log/detail/footer.hpp>
|
||||
|
||||
#endif // BOOST_LOG_UTILITY_MANIPULATORS_INVOKE_HPP_INCLUDED_
|
||||
267
linx64/include/boost/log/utility/manipulators/optional.hpp
Normal file
267
linx64/include/boost/log/utility/manipulators/optional.hpp
Normal file
@@ -0,0 +1,267 @@
|
||||
/*
|
||||
* Copyright Andrey Semashev 2020.
|
||||
* Distributed under the Boost Software License, Version 1.0.
|
||||
* (See accompanying file LICENSE_1_0.txt or copy at
|
||||
* https://www.boost.org/LICENSE_1_0.txt)
|
||||
*/
|
||||
/*!
|
||||
* \file utility/manipulators/optional.hpp
|
||||
* \author Andrey Semashev
|
||||
* \date 12.05.2020
|
||||
*
|
||||
* The header contains implementation of a stream manipulator for inserting an optional value.
|
||||
*/
|
||||
|
||||
#ifndef BOOST_LOG_UTILITY_MANIPULATORS_OPTIONAL_HPP_INCLUDED_
|
||||
#define BOOST_LOG_UTILITY_MANIPULATORS_OPTIONAL_HPP_INCLUDED_
|
||||
|
||||
#include <cstddef>
|
||||
#include <boost/core/enable_if.hpp>
|
||||
#include <boost/type_traits/is_array.hpp>
|
||||
#include <boost/type_traits/is_scalar.hpp>
|
||||
#include <boost/type_traits/conditional.hpp>
|
||||
#include <boost/log/detail/config.hpp>
|
||||
#include <boost/log/detail/is_ostream.hpp>
|
||||
#include <boost/log/detail/header.hpp>
|
||||
|
||||
#ifdef BOOST_HAS_PRAGMA_ONCE
|
||||
#pragma once
|
||||
#endif
|
||||
|
||||
namespace boost {
|
||||
|
||||
BOOST_LOG_OPEN_NAMESPACE
|
||||
|
||||
/*!
|
||||
* Stream manipulator for inserting an optional value.
|
||||
*/
|
||||
template< typename OptionalT, typename NoneT >
|
||||
class optional_manipulator
|
||||
{
|
||||
private:
|
||||
typedef typename conditional<
|
||||
is_scalar< OptionalT >::value,
|
||||
OptionalT,
|
||||
OptionalT const&
|
||||
>::type stored_optional_type;
|
||||
|
||||
typedef typename conditional<
|
||||
is_scalar< NoneT >::value,
|
||||
NoneT,
|
||||
NoneT const&
|
||||
>::type stored_none_type;
|
||||
|
||||
private:
|
||||
stored_optional_type m_optional;
|
||||
stored_none_type m_none;
|
||||
|
||||
public:
|
||||
//! Initializing constructor
|
||||
optional_manipulator(stored_optional_type opt, stored_none_type none) BOOST_NOEXCEPT :
|
||||
m_optional(opt),
|
||||
m_none(none)
|
||||
{
|
||||
}
|
||||
|
||||
//! The method outputs the value, if it is present, otherwise outputs the "none" marker
|
||||
template< typename StreamT >
|
||||
void output(StreamT& stream) const
|
||||
{
|
||||
if (!!m_optional)
|
||||
stream << *m_optional;
|
||||
else
|
||||
stream << m_none;
|
||||
}
|
||||
};
|
||||
|
||||
/*!
|
||||
* Stream manipulator for inserting an optional value. Specialization for no "none" marker.
|
||||
*/
|
||||
template< typename OptionalT >
|
||||
class optional_manipulator< OptionalT, void >
|
||||
{
|
||||
private:
|
||||
typedef typename conditional<
|
||||
is_scalar< OptionalT >::value,
|
||||
OptionalT,
|
||||
OptionalT const&
|
||||
>::type stored_optional_type;
|
||||
|
||||
private:
|
||||
stored_optional_type m_optional;
|
||||
|
||||
public:
|
||||
//! Initializing constructor
|
||||
optional_manipulator(stored_optional_type opt) BOOST_NOEXCEPT :
|
||||
m_optional(opt)
|
||||
{
|
||||
}
|
||||
|
||||
//! The method outputs the value, if it is present
|
||||
template< typename StreamT >
|
||||
void output(StreamT& stream) const
|
||||
{
|
||||
if (!!m_optional)
|
||||
stream << *m_optional;
|
||||
}
|
||||
};
|
||||
|
||||
/*!
|
||||
* Stream output operator for \c optional_manipulator. Outputs the optional value or the "none" marker, if one was specified on manipulator construction.
|
||||
*/
|
||||
template< typename StreamT, typename OptionalT, typename NoneT >
|
||||
inline typename boost::enable_if_c< log::aux::is_ostream< StreamT >::value, StreamT& >::type operator<< (StreamT& strm, optional_manipulator< OptionalT, NoneT > const& manip)
|
||||
{
|
||||
manip.output(strm);
|
||||
return strm;
|
||||
}
|
||||
|
||||
/*!
|
||||
* Optional manipulator generator function.
|
||||
*
|
||||
* \param opt Optional value to output. The optional value must support contextual conversion to \c bool and dereferencing, and its dereferencing result must support stream output.
|
||||
* \param none Marker used to indicate when the value is not present. Optional. If not specified, nothing is output if the value is not present.
|
||||
* \returns Manipulator to be inserted into the stream.
|
||||
*
|
||||
* \note Both \a opt and \a none objects must outlive the created manipulator object.
|
||||
*/
|
||||
template< typename OptionalT, typename NoneT >
|
||||
inline typename boost::enable_if_c<
|
||||
is_scalar< OptionalT >::value && is_scalar< NoneT >::value,
|
||||
optional_manipulator< OptionalT, NoneT >
|
||||
>::type optional_manip(OptionalT opt, NoneT none) BOOST_NOEXCEPT
|
||||
{
|
||||
return optional_manipulator< OptionalT, NoneT >(opt, none);
|
||||
}
|
||||
|
||||
/*!
|
||||
* Optional manipulator generator function.
|
||||
*
|
||||
* \param opt Optional value to output. The optional value must support contextual conversion to \c bool and dereferencing, and its dereferencing result must support stream output.
|
||||
* \param none Marker used to indicate when the value is not present. Optional. If not specified, nothing is output if the value is not present.
|
||||
* \returns Manipulator to be inserted into the stream.
|
||||
*
|
||||
* \note Both \a opt and \a none objects must outlive the created manipulator object.
|
||||
*/
|
||||
template< typename OptionalT, typename NoneT >
|
||||
inline typename boost::enable_if_c<
|
||||
is_scalar< OptionalT >::value && !is_scalar< NoneT >::value,
|
||||
optional_manipulator< OptionalT, NoneT >
|
||||
>::type optional_manip(OptionalT opt, NoneT const& none) BOOST_NOEXCEPT
|
||||
{
|
||||
return optional_manipulator< OptionalT, NoneT >(opt, none);
|
||||
}
|
||||
|
||||
/*!
|
||||
* Optional manipulator generator function.
|
||||
*
|
||||
* \param opt Optional value to output. The optional value must support contextual conversion to \c bool and dereferencing, and its dereferencing result must support stream output.
|
||||
* \param none Marker used to indicate when the value is not present. Optional. If not specified, nothing is output if the value is not present.
|
||||
* \returns Manipulator to be inserted into the stream.
|
||||
*
|
||||
* \note Both \a opt and \a none objects must outlive the created manipulator object.
|
||||
*/
|
||||
template< typename OptionalT, typename NoneElementT, std::size_t N >
|
||||
inline typename boost::enable_if_c<
|
||||
is_scalar< OptionalT >::value,
|
||||
optional_manipulator< OptionalT, NoneElementT* >
|
||||
>::type optional_manip(OptionalT opt, NoneElementT (&none)[N]) BOOST_NOEXCEPT
|
||||
{
|
||||
return optional_manipulator< OptionalT, NoneElementT* >(opt, none);
|
||||
}
|
||||
|
||||
/*!
|
||||
* Optional manipulator generator function.
|
||||
*
|
||||
* \param opt Optional value to output. The optional value must support contextual conversion to \c bool and dereferencing, and its dereferencing result must support stream output.
|
||||
* \param none Marker used to indicate when the value is not present. Optional. If not specified, nothing is output if the value is not present.
|
||||
* \returns Manipulator to be inserted into the stream.
|
||||
*
|
||||
* \note Both \a opt and \a none objects must outlive the created manipulator object.
|
||||
*/
|
||||
template< typename OptionalT, typename NoneT >
|
||||
inline typename boost::enable_if_c<
|
||||
!is_scalar< OptionalT >::value && !is_array< OptionalT >::value && is_scalar< NoneT >::value,
|
||||
optional_manipulator< OptionalT, NoneT >
|
||||
>::type optional_manip(OptionalT const& opt, NoneT none) BOOST_NOEXCEPT
|
||||
{
|
||||
return optional_manipulator< OptionalT, NoneT >(opt, none);
|
||||
}
|
||||
|
||||
/*!
|
||||
* Optional manipulator generator function.
|
||||
*
|
||||
* \param opt Optional value to output. The optional value must support contextual conversion to \c bool and dereferencing, and its dereferencing result must support stream output.
|
||||
* \param none Marker used to indicate when the value is not present. Optional. If not specified, nothing is output if the value is not present.
|
||||
* \returns Manipulator to be inserted into the stream.
|
||||
*
|
||||
* \note Both \a opt and \a none objects must outlive the created manipulator object.
|
||||
*/
|
||||
template< typename OptionalT, typename NoneT >
|
||||
inline typename boost::enable_if_c<
|
||||
!is_scalar< OptionalT >::value && !is_array< OptionalT >::value && !is_scalar< NoneT >::value,
|
||||
optional_manipulator< OptionalT, NoneT >
|
||||
>::type optional_manip(OptionalT const& opt, NoneT const& none) BOOST_NOEXCEPT
|
||||
{
|
||||
return optional_manipulator< OptionalT, NoneT >(opt, none);
|
||||
}
|
||||
|
||||
/*!
|
||||
* Optional manipulator generator function.
|
||||
*
|
||||
* \param opt Optional value to output. The optional value must support contextual conversion to \c bool and dereferencing, and its dereferencing result must support stream output.
|
||||
* \param none Marker used to indicate when the value is not present. Optional. If not specified, nothing is output if the value is not present.
|
||||
* \returns Manipulator to be inserted into the stream.
|
||||
*
|
||||
* \note Both \a opt and \a none objects must outlive the created manipulator object.
|
||||
*/
|
||||
template< typename OptionalT, typename NoneElementT, std::size_t N >
|
||||
inline typename boost::enable_if_c<
|
||||
!is_scalar< OptionalT >::value && !is_array< OptionalT >::value,
|
||||
optional_manipulator< OptionalT, NoneElementT* >
|
||||
>::type optional_manip(OptionalT const& opt, NoneElementT (&none)[N]) BOOST_NOEXCEPT
|
||||
{
|
||||
return optional_manipulator< OptionalT, NoneElementT* >(opt, none);
|
||||
}
|
||||
|
||||
/*!
|
||||
* Optional manipulator generator function.
|
||||
*
|
||||
* \param opt Optional value to output. The optional value must support contextual conversion to \c bool and dereferencing, and its dereferencing result must support stream output.
|
||||
* \returns Manipulator to be inserted into the stream.
|
||||
*
|
||||
* \note \a opt object must outlive the created manipulator object.
|
||||
*/
|
||||
template< typename OptionalT >
|
||||
inline typename boost::enable_if_c<
|
||||
is_scalar< OptionalT >::value,
|
||||
optional_manipulator< OptionalT, void >
|
||||
>::type optional_manip(OptionalT opt) BOOST_NOEXCEPT
|
||||
{
|
||||
return optional_manipulator< OptionalT, void >(opt);
|
||||
}
|
||||
|
||||
/*!
|
||||
* Optional manipulator generator function.
|
||||
*
|
||||
* \param opt Optional value to output. The optional value must support contextual conversion to \c bool and dereferencing, and its dereferencing result must support stream output.
|
||||
* \returns Manipulator to be inserted into the stream.
|
||||
*
|
||||
* \note \a opt object must outlive the created manipulator object.
|
||||
*/
|
||||
template< typename OptionalT >
|
||||
inline typename boost::enable_if_c<
|
||||
!is_scalar< OptionalT >::value && !is_array< OptionalT >::value,
|
||||
optional_manipulator< OptionalT, void >
|
||||
>::type optional_manip(OptionalT const& opt) BOOST_NOEXCEPT
|
||||
{
|
||||
return optional_manipulator< OptionalT, void >(opt);
|
||||
}
|
||||
|
||||
BOOST_LOG_CLOSE_NAMESPACE // namespace log
|
||||
|
||||
} // namespace boost
|
||||
|
||||
#include <boost/log/detail/footer.hpp>
|
||||
|
||||
#endif // BOOST_LOG_UTILITY_MANIPULATORS_OPTIONAL_HPP_INCLUDED_
|
||||
195
linx64/include/boost/log/utility/manipulators/range.hpp
Normal file
195
linx64/include/boost/log/utility/manipulators/range.hpp
Normal file
@@ -0,0 +1,195 @@
|
||||
/*
|
||||
* Copyright Andrey Semashev 2020.
|
||||
* Distributed under the Boost Software License, Version 1.0.
|
||||
* (See accompanying file LICENSE_1_0.txt or copy at
|
||||
* https://www.boost.org/LICENSE_1_0.txt)
|
||||
*/
|
||||
/*!
|
||||
* \file utility/manipulators/range.hpp
|
||||
* \author Andrey Semashev
|
||||
* \date 11.05.2020
|
||||
*
|
||||
* The header contains implementation of a stream manipulator for inserting a range of elements, optionally separated with a delimiter.
|
||||
*/
|
||||
|
||||
#ifndef BOOST_LOG_UTILITY_MANIPULATORS_RANGE_HPP_INCLUDED_
|
||||
#define BOOST_LOG_UTILITY_MANIPULATORS_RANGE_HPP_INCLUDED_
|
||||
|
||||
#include <cstddef>
|
||||
#include <boost/range/begin.hpp>
|
||||
#include <boost/range/end.hpp>
|
||||
#include <boost/range/const_iterator.hpp>
|
||||
#include <boost/core/enable_if.hpp>
|
||||
#include <boost/type_traits/is_scalar.hpp>
|
||||
#include <boost/type_traits/conditional.hpp>
|
||||
#include <boost/log/detail/config.hpp>
|
||||
#include <boost/log/detail/is_ostream.hpp>
|
||||
#include <boost/log/detail/header.hpp>
|
||||
|
||||
#ifdef BOOST_HAS_PRAGMA_ONCE
|
||||
#pragma once
|
||||
#endif
|
||||
|
||||
namespace boost {
|
||||
|
||||
BOOST_LOG_OPEN_NAMESPACE
|
||||
|
||||
/*!
|
||||
* Stream manipulator for inserting a range of elements, optionally separated with a delimiter.
|
||||
*/
|
||||
template< typename RangeT, typename DelimiterT >
|
||||
class range_manipulator
|
||||
{
|
||||
private:
|
||||
typedef typename conditional<
|
||||
is_scalar< DelimiterT >::value,
|
||||
DelimiterT,
|
||||
DelimiterT const&
|
||||
>::type stored_delimiter_type;
|
||||
|
||||
private:
|
||||
RangeT const& m_range;
|
||||
stored_delimiter_type m_delimiter;
|
||||
|
||||
public:
|
||||
//! Initializing constructor
|
||||
range_manipulator(RangeT const& range, stored_delimiter_type delimiter) BOOST_NOEXCEPT :
|
||||
m_range(range),
|
||||
m_delimiter(delimiter)
|
||||
{
|
||||
}
|
||||
|
||||
//! The method outputs elements of the range separated with delimiter
|
||||
template< typename StreamT >
|
||||
void output(StreamT& stream) const
|
||||
{
|
||||
typedef typename boost::range_const_iterator< RangeT >::type const_iterator;
|
||||
const_iterator it = boost::begin(m_range);
|
||||
const const_iterator end = boost::end(m_range);
|
||||
if (BOOST_LIKELY(it != end))
|
||||
{
|
||||
stream << *it;
|
||||
|
||||
for (++it; it != end; ++it)
|
||||
{
|
||||
stream << m_delimiter;
|
||||
stream << *it;
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
/*!
|
||||
* Stream manipulator for inserting a range of elements. Specialization for when there is no delimiter.
|
||||
*/
|
||||
template< typename RangeT >
|
||||
class range_manipulator< RangeT, void >
|
||||
{
|
||||
private:
|
||||
RangeT const& m_range;
|
||||
|
||||
public:
|
||||
//! Initializing constructor
|
||||
explicit range_manipulator(RangeT const& range) BOOST_NOEXCEPT :
|
||||
m_range(range)
|
||||
{
|
||||
}
|
||||
|
||||
//! The method outputs elements of the range
|
||||
template< typename StreamT >
|
||||
void output(StreamT& stream) const
|
||||
{
|
||||
typedef typename boost::range_const_iterator< RangeT >::type const_iterator;
|
||||
const_iterator it = boost::begin(m_range);
|
||||
const const_iterator end = boost::end(m_range);
|
||||
for (; it != end; ++it)
|
||||
{
|
||||
stream << *it;
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
/*!
|
||||
* Stream output operator for \c range_manipulator. Outputs every element of the range, separated with a delimiter, if one was specified on manipulator construction.
|
||||
*/
|
||||
template< typename StreamT, typename RangeT, typename DelimiterT >
|
||||
inline typename boost::enable_if_c< log::aux::is_ostream< StreamT >::value, StreamT& >::type operator<< (StreamT& strm, range_manipulator< RangeT, DelimiterT > const& manip)
|
||||
{
|
||||
if (BOOST_LIKELY(strm.good()))
|
||||
manip.output(strm);
|
||||
|
||||
return strm;
|
||||
}
|
||||
|
||||
/*!
|
||||
* Range manipulator generator function.
|
||||
*
|
||||
* \param range Range of elements to output. The range must support begin and end iterators, and its elements must support stream output.
|
||||
* \param delimiter Delimiter to separate elements in the output. Optional. If not specified, elements are output without separation.
|
||||
* \returns Manipulator to be inserted into the stream.
|
||||
*
|
||||
* \note Both \a range and \a delimiter objects must outlive the created manipulator object.
|
||||
*/
|
||||
template< typename RangeT, typename DelimiterT >
|
||||
inline typename boost::enable_if_c<
|
||||
is_scalar< DelimiterT >::value,
|
||||
range_manipulator< RangeT, DelimiterT >
|
||||
>::type range_manip(RangeT const& range, DelimiterT delimiter) BOOST_NOEXCEPT
|
||||
{
|
||||
return range_manipulator< RangeT, DelimiterT >(range, delimiter);
|
||||
}
|
||||
|
||||
/*!
|
||||
* Range manipulator generator function.
|
||||
*
|
||||
* \param range Range of elements to output. The range must support begin and end iterators, and its elements must support stream output.
|
||||
* \param delimiter Delimiter to separate elements in the output. Optional. If not specified, elements are output without separation.
|
||||
* \returns Manipulator to be inserted into the stream.
|
||||
*
|
||||
* \note Both \a range and \a delimiter objects must outlive the created manipulator object.
|
||||
*/
|
||||
template< typename RangeT, typename DelimiterT >
|
||||
inline typename boost::disable_if_c<
|
||||
is_scalar< DelimiterT >::value,
|
||||
range_manipulator< RangeT, DelimiterT >
|
||||
>::type range_manip(RangeT const& range, DelimiterT const& delimiter) BOOST_NOEXCEPT
|
||||
{
|
||||
return range_manipulator< RangeT, DelimiterT >(range, delimiter);
|
||||
}
|
||||
|
||||
/*!
|
||||
* Range manipulator generator function.
|
||||
*
|
||||
* \param range Range of elements to output. The range must support begin and end iterators, and its elements must support stream output.
|
||||
* \param delimiter Delimiter to separate elements in the output. Optional. If not specified, elements are output without separation.
|
||||
* \returns Manipulator to be inserted into the stream.
|
||||
*
|
||||
* \note Both \a range and \a delimiter objects must outlive the created manipulator object.
|
||||
*/
|
||||
template< typename RangeT, typename DelimiterElementT, std::size_t N >
|
||||
inline range_manipulator< RangeT, DelimiterElementT* > range_manip(RangeT const& range, DelimiterElementT (&delimiter)[N]) BOOST_NOEXCEPT
|
||||
{
|
||||
return range_manipulator< RangeT, DelimiterElementT* >(range, delimiter);
|
||||
}
|
||||
|
||||
/*!
|
||||
* Range manipulator generator function.
|
||||
*
|
||||
* \param range Range of elements to output. The range must support begin and end iterators, and its elements must support stream output.
|
||||
* \returns Manipulator to be inserted into the stream.
|
||||
*
|
||||
* \note \a delimiter object must outlive the created manipulator object.
|
||||
*/
|
||||
template< typename RangeT >
|
||||
inline range_manipulator< RangeT, void > range_manip(RangeT const& range) BOOST_NOEXCEPT
|
||||
{
|
||||
return range_manipulator< RangeT, void >(range);
|
||||
}
|
||||
|
||||
BOOST_LOG_CLOSE_NAMESPACE // namespace log
|
||||
|
||||
} // namespace boost
|
||||
|
||||
#include <boost/log/detail/footer.hpp>
|
||||
|
||||
#endif // BOOST_LOG_UTILITY_MANIPULATORS_RANGE_HPP_INCLUDED_
|
||||
228
linx64/include/boost/log/utility/manipulators/tuple.hpp
Normal file
228
linx64/include/boost/log/utility/manipulators/tuple.hpp
Normal file
@@ -0,0 +1,228 @@
|
||||
/*
|
||||
* Copyright Andrey Semashev 2020.
|
||||
* Distributed under the Boost Software License, Version 1.0.
|
||||
* (See accompanying file LICENSE_1_0.txt or copy at
|
||||
* https://www.boost.org/LICENSE_1_0.txt)
|
||||
*/
|
||||
/*!
|
||||
* \file utility/manipulators/tuple.hpp
|
||||
* \author Andrey Semashev
|
||||
* \date 11.05.2020
|
||||
*
|
||||
* The header contains implementation of a stream manipulator for inserting a tuple or any heterogeneous sequence of elements, optionally separated with a delimiter.
|
||||
*/
|
||||
|
||||
#ifndef BOOST_LOG_UTILITY_MANIPULATORS_TUPLE_HPP_INCLUDED_
|
||||
#define BOOST_LOG_UTILITY_MANIPULATORS_TUPLE_HPP_INCLUDED_
|
||||
|
||||
#include <cstddef>
|
||||
#include <boost/core/enable_if.hpp>
|
||||
#include <boost/type_traits/is_scalar.hpp>
|
||||
#include <boost/type_traits/conditional.hpp>
|
||||
#include <boost/type_traits/integral_constant.hpp>
|
||||
#include <boost/fusion/include/fold.hpp>
|
||||
#include <boost/fusion/include/for_each.hpp>
|
||||
#include <boost/log/detail/config.hpp>
|
||||
#include <boost/log/detail/is_ostream.hpp>
|
||||
#include <boost/log/detail/header.hpp>
|
||||
|
||||
#ifdef BOOST_HAS_PRAGMA_ONCE
|
||||
#pragma once
|
||||
#endif
|
||||
|
||||
namespace boost {
|
||||
|
||||
BOOST_LOG_OPEN_NAMESPACE
|
||||
|
||||
/*!
|
||||
* Stream manipulator for inserting a heterogeneous sequence of elements, optionally separated with a delimiter.
|
||||
*/
|
||||
template< typename TupleT, typename DelimiterT >
|
||||
class tuple_manipulator
|
||||
{
|
||||
private:
|
||||
typedef typename conditional<
|
||||
is_scalar< DelimiterT >::value,
|
||||
DelimiterT,
|
||||
DelimiterT const&
|
||||
>::type stored_delimiter_type;
|
||||
|
||||
template< typename StreamT >
|
||||
struct output_visitor
|
||||
{
|
||||
typedef boost::true_type result_type;
|
||||
|
||||
output_visitor(StreamT& stream, stored_delimiter_type delimiter) BOOST_NOEXCEPT :
|
||||
m_stream(stream),
|
||||
m_delimiter(delimiter)
|
||||
{
|
||||
}
|
||||
|
||||
template< typename T >
|
||||
result_type operator() (boost::true_type, T const& elem) const
|
||||
{
|
||||
m_stream << m_delimiter;
|
||||
return operator()(boost::false_type(), elem);
|
||||
}
|
||||
|
||||
template< typename T >
|
||||
result_type operator() (boost::false_type, T const& elem) const
|
||||
{
|
||||
m_stream << elem;
|
||||
return result_type();
|
||||
}
|
||||
|
||||
private:
|
||||
StreamT& m_stream;
|
||||
stored_delimiter_type m_delimiter;
|
||||
};
|
||||
|
||||
private:
|
||||
TupleT const& m_tuple;
|
||||
stored_delimiter_type m_delimiter;
|
||||
|
||||
public:
|
||||
//! Initializing constructor
|
||||
tuple_manipulator(TupleT const& tuple, stored_delimiter_type delimiter) BOOST_NOEXCEPT :
|
||||
m_tuple(tuple),
|
||||
m_delimiter(delimiter)
|
||||
{
|
||||
}
|
||||
|
||||
//! The method outputs elements of the sequence separated with delimiter
|
||||
template< typename StreamT >
|
||||
void output(StreamT& stream) const
|
||||
{
|
||||
boost::fusion::fold(m_tuple, boost::false_type(), output_visitor< StreamT >(stream, m_delimiter));
|
||||
}
|
||||
};
|
||||
|
||||
/*!
|
||||
* Stream manipulator for inserting a heterogeneous sequence of elements. Specialization for when there is no delimiter.
|
||||
*/
|
||||
template< typename TupleT >
|
||||
class tuple_manipulator< TupleT, void >
|
||||
{
|
||||
private:
|
||||
template< typename StreamT >
|
||||
struct output_visitor
|
||||
{
|
||||
typedef void result_type;
|
||||
|
||||
explicit output_visitor(StreamT& stream) BOOST_NOEXCEPT :
|
||||
m_stream(stream)
|
||||
{
|
||||
}
|
||||
|
||||
template< typename T >
|
||||
result_type operator() (T const& elem) const
|
||||
{
|
||||
m_stream << elem;
|
||||
}
|
||||
|
||||
private:
|
||||
StreamT& m_stream;
|
||||
};
|
||||
|
||||
private:
|
||||
TupleT const& m_tuple;
|
||||
|
||||
public:
|
||||
//! Initializing constructor
|
||||
explicit tuple_manipulator(TupleT const& tuple) BOOST_NOEXCEPT :
|
||||
m_tuple(tuple)
|
||||
{
|
||||
}
|
||||
|
||||
//! The method outputs elements of the sequence
|
||||
template< typename StreamT >
|
||||
void output(StreamT& stream) const
|
||||
{
|
||||
boost::fusion::for_each(m_tuple, output_visitor< StreamT >(stream));
|
||||
}
|
||||
};
|
||||
|
||||
/*!
|
||||
* Stream output operator for \c tuple_manipulator. Outputs every element of the sequence, separated with a delimiter, if one was specified on manipulator construction.
|
||||
*/
|
||||
template< typename StreamT, typename TupleT, typename DelimiterT >
|
||||
inline typename boost::enable_if_c< log::aux::is_ostream< StreamT >::value, StreamT& >::type operator<< (StreamT& strm, tuple_manipulator< TupleT, DelimiterT > const& manip)
|
||||
{
|
||||
if (BOOST_LIKELY(strm.good()))
|
||||
manip.output(strm);
|
||||
|
||||
return strm;
|
||||
}
|
||||
|
||||
/*!
|
||||
* Tuple manipulator generator function.
|
||||
*
|
||||
* \param tuple Heterogeneous sequence of elements to output. The sequence must be supported by Boost.Fusion, and its elements must support stream output.
|
||||
* \param delimiter Delimiter to separate elements in the output. Optional. If not specified, elements are output without separation.
|
||||
* \returns Manipulator to be inserted into the stream.
|
||||
*
|
||||
* \note Both \a tuple and \a delimiter objects must outlive the created manipulator object.
|
||||
*/
|
||||
template< typename TupleT, typename DelimiterT >
|
||||
inline typename boost::enable_if_c<
|
||||
is_scalar< DelimiterT >::value,
|
||||
tuple_manipulator< TupleT, DelimiterT >
|
||||
>::type tuple_manip(TupleT const& tuple, DelimiterT delimiter) BOOST_NOEXCEPT
|
||||
{
|
||||
return tuple_manipulator< TupleT, DelimiterT >(tuple, delimiter);
|
||||
}
|
||||
|
||||
/*!
|
||||
* Tuple manipulator generator function.
|
||||
*
|
||||
* \param tuple Heterogeneous sequence of elements to output. The sequence must be supported by Boost.Fusion, and its elements must support stream output.
|
||||
* \param delimiter Delimiter to separate elements in the output. Optional. If not specified, elements are output without separation.
|
||||
* \returns Manipulator to be inserted into the stream.
|
||||
*
|
||||
* \note Both \a tuple and \a delimiter objects must outlive the created manipulator object.
|
||||
*/
|
||||
template< typename TupleT, typename DelimiterT >
|
||||
inline typename boost::disable_if_c<
|
||||
is_scalar< DelimiterT >::value,
|
||||
tuple_manipulator< TupleT, DelimiterT >
|
||||
>::type tuple_manip(TupleT const& tuple, DelimiterT const& delimiter) BOOST_NOEXCEPT
|
||||
{
|
||||
return tuple_manipulator< TupleT, DelimiterT >(tuple, delimiter);
|
||||
}
|
||||
|
||||
/*!
|
||||
* Tuple manipulator generator function.
|
||||
*
|
||||
* \param tuple Heterogeneous sequence of elements to output. The sequence must be supported by Boost.Fusion, and its elements must support stream output.
|
||||
* \param delimiter Delimiter to separate elements in the output. Optional. If not specified, elements are output without separation.
|
||||
* \returns Manipulator to be inserted into the stream.
|
||||
*
|
||||
* \note Both \a tuple and \a delimiter objects must outlive the created manipulator object.
|
||||
*/
|
||||
template< typename TupleT, typename DelimiterElementT, std::size_t N >
|
||||
inline tuple_manipulator< TupleT, DelimiterElementT* > tuple_manip(TupleT const& tuple, DelimiterElementT (&delimiter)[N]) BOOST_NOEXCEPT
|
||||
{
|
||||
return tuple_manipulator< TupleT, DelimiterElementT* >(tuple, delimiter);
|
||||
}
|
||||
|
||||
/*!
|
||||
* Tuple manipulator generator function.
|
||||
*
|
||||
* \param tuple Heterogeneous sequence of elements to output. The sequence must be supported by Boost.Fusion, and its elements must support stream output.
|
||||
* \returns Manipulator to be inserted into the stream.
|
||||
*
|
||||
* \note \a tuple object must outlive the created manipulator object.
|
||||
*/
|
||||
template< typename TupleT >
|
||||
inline tuple_manipulator< TupleT, void > tuple_manip(TupleT const& tuple) BOOST_NOEXCEPT
|
||||
{
|
||||
return tuple_manipulator< TupleT, void >(tuple);
|
||||
}
|
||||
|
||||
BOOST_LOG_CLOSE_NAMESPACE // namespace log
|
||||
|
||||
} // namespace boost
|
||||
|
||||
#include <boost/log/detail/footer.hpp>
|
||||
|
||||
#endif // BOOST_LOG_UTILITY_MANIPULATORS_TUPLE_HPP_INCLUDED_
|
||||
Reference in New Issue
Block a user