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_ATTRIBUTE_HPP_INCLUDED_
0016 #define BOOST_LOG_ATTRIBUTES_ATTRIBUTE_HPP_INCLUDED_
0017
0018 #include <new>
0019 #include <boost/move/core.hpp>
0020 #include <boost/smart_ptr/intrusive_ptr.hpp>
0021 #include <boost/smart_ptr/intrusive_ref_counter.hpp>
0022 #include <boost/core/explicit_operator_bool.hpp>
0023 #include <boost/log/detail/config.hpp>
0024 #include <boost/log/detail/header.hpp>
0025
0026 #ifdef BOOST_HAS_PRAGMA_ONCE
0027 #pragma once
0028 #endif
0029
0030 namespace boost {
0031
0032 BOOST_LOG_OPEN_NAMESPACE
0033
0034 #ifndef BOOST_LOG_DOXYGEN_PASS
0035
0036 class attribute_value;
0037
0038 namespace aux {
0039
0040
0041 class attribute_set_reference_proxy;
0042
0043 }
0044
0045 #endif
0046
0047
0048
0049
0050
0051
0052
0053
0054
0055
0056
0057
0058
0059 class attribute
0060 {
0061 BOOST_COPYABLE_AND_MOVABLE(attribute)
0062
0063 public:
0064
0065
0066
0067
0068
0069 struct BOOST_LOG_NO_VTABLE BOOST_SYMBOL_VISIBLE impl :
0070 public boost::intrusive_ref_counter< impl >
0071 {
0072
0073
0074
0075 virtual ~impl() {}
0076
0077
0078
0079
0080
0081 virtual attribute_value get_value() = 0;
0082
0083 BOOST_LOG_API static void* operator new (std::size_t size);
0084 BOOST_LOG_API static void operator delete (void* p, std::size_t size) BOOST_NOEXCEPT;
0085 };
0086
0087 private:
0088
0089 intrusive_ptr< impl > m_pImpl;
0090
0091 public:
0092
0093
0094
0095
0096 BOOST_DEFAULTED_FUNCTION(attribute(), {})
0097
0098
0099
0100
0101 attribute(attribute const& that) BOOST_NOEXCEPT : m_pImpl(that.m_pImpl) {}
0102
0103
0104
0105
0106 attribute(BOOST_RV_REF(attribute) that) BOOST_NOEXCEPT { m_pImpl.swap(that.m_pImpl); }
0107
0108
0109
0110
0111
0112
0113 explicit attribute(intrusive_ptr< impl > p) BOOST_NOEXCEPT { m_pImpl.swap(p); }
0114
0115
0116
0117
0118 attribute& operator= (BOOST_COPY_ASSIGN_REF(attribute) that) BOOST_NOEXCEPT
0119 {
0120 m_pImpl = that.m_pImpl;
0121 return *this;
0122 }
0123
0124
0125
0126
0127 attribute& operator= (BOOST_RV_REF(attribute) that) BOOST_NOEXCEPT
0128 {
0129 m_pImpl.swap(that.m_pImpl);
0130 return *this;
0131 }
0132
0133 #ifndef BOOST_LOG_DOXYGEN_PASS
0134 attribute& operator= (aux::attribute_set_reference_proxy const& that) BOOST_NOEXCEPT;
0135 #endif
0136
0137
0138
0139
0140 BOOST_EXPLICIT_OPERATOR_BOOL_NOEXCEPT()
0141
0142
0143
0144
0145 bool operator! () const BOOST_NOEXCEPT { return !m_pImpl; }
0146
0147
0148
0149
0150
0151 attribute_value get_value() const;
0152
0153
0154
0155
0156 void swap(attribute& that) BOOST_NOEXCEPT { m_pImpl.swap(that.m_pImpl); }
0157
0158 protected:
0159
0160
0161
0162 impl* get_impl() const BOOST_NOEXCEPT { return m_pImpl.get(); }
0163
0164
0165
0166
0167
0168 void set_impl(intrusive_ptr< impl > p) BOOST_NOEXCEPT { m_pImpl.swap(p); }
0169
0170 template< typename T >
0171 friend T attribute_cast(attribute const&);
0172 };
0173
0174
0175
0176
0177 inline void swap(attribute& left, attribute& right) BOOST_NOEXCEPT
0178 {
0179 left.swap(right);
0180 }
0181
0182 BOOST_LOG_CLOSE_NAMESPACE
0183
0184 }
0185
0186 #include <boost/log/detail/footer.hpp>
0187 #if defined(BOOST_LOG_ATTRIBUTES_ATTRIBUTE_VALUE_HPP_INCLUDED_)
0188 #include <boost/log/detail/attribute_get_value_impl.hpp>
0189 #endif
0190
0191 #endif