File indexing completed on 2025-01-18 09:39:18
0001
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012
0013
0014
0015 #ifndef BOOST_LOG_ATTRIBUTES_CONSTANT_HPP_INCLUDED_
0016 #define BOOST_LOG_ATTRIBUTES_CONSTANT_HPP_INCLUDED_
0017
0018 #include <boost/move/core.hpp>
0019 #include <boost/move/utility_core.hpp>
0020 #include <boost/type_traits/remove_reference.hpp>
0021 #include <boost/type_traits/is_nothrow_move_constructible.hpp>
0022 #include <boost/log/detail/config.hpp>
0023 #include <boost/log/detail/embedded_string_type.hpp>
0024 #include <boost/log/attributes/attribute.hpp>
0025 #include <boost/log/attributes/attribute_cast.hpp>
0026 #include <boost/log/attributes/attribute_value_impl.hpp>
0027 #include <boost/log/detail/header.hpp>
0028
0029 #ifdef BOOST_HAS_PRAGMA_ONCE
0030 #pragma once
0031 #endif
0032
0033 namespace boost {
0034
0035 BOOST_LOG_OPEN_NAMESPACE
0036
0037 namespace attributes {
0038
0039
0040
0041
0042
0043
0044
0045
0046 template< typename T >
0047 class constant :
0048 public attribute
0049 {
0050 public:
0051
0052 typedef T value_type;
0053
0054 protected:
0055
0056 class BOOST_SYMBOL_VISIBLE impl :
0057 public attribute_value_impl< value_type >
0058 {
0059
0060 typedef attribute_value_impl< value_type > base_type;
0061
0062 public:
0063
0064
0065
0066 explicit impl(value_type const& value) : base_type(value) {}
0067
0068
0069
0070 explicit impl(BOOST_RV_REF(value_type) value) BOOST_NOEXCEPT_IF(boost::is_nothrow_move_constructible< value_type >::value) :
0071 base_type(boost::move(value))
0072 {
0073 }
0074 };
0075
0076 public:
0077
0078
0079
0080 explicit constant(value_type const& value) : attribute(new impl(value)) {}
0081
0082
0083
0084 explicit constant(BOOST_RV_REF(value_type) value) : attribute(new impl(boost::move(value))) {}
0085
0086
0087
0088 explicit constant(cast_source const& source) : attribute(source.as< impl >())
0089 {
0090 }
0091
0092
0093
0094
0095 value_type const& get() const
0096 {
0097 return static_cast< impl* >(this->get_impl())->get();
0098 }
0099 };
0100
0101
0102
0103
0104
0105 template< typename T >
0106 inline constant<
0107 typename boost::log::aux::make_embedded_string_type<
0108 typename remove_reference< T >::type
0109 >::type
0110 > make_constant(BOOST_FWD_REF(T) val)
0111 {
0112 typedef typename boost::log::aux::make_embedded_string_type<
0113 typename remove_reference< T >::type
0114 >::type value_type;
0115 return constant< value_type >(boost::forward< T >(val));
0116 }
0117
0118 }
0119
0120 BOOST_LOG_CLOSE_NAMESPACE
0121
0122 }
0123
0124 #include <boost/log/detail/footer.hpp>
0125
0126 #endif