123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191 |
- #ifndef BOOST_LOG_ATTRIBUTES_ATTRIBUTE_HPP_INCLUDED_
- #define BOOST_LOG_ATTRIBUTES_ATTRIBUTE_HPP_INCLUDED_
- #include <new>
- #include <boost/move/core.hpp>
- #include <boost/smart_ptr/intrusive_ptr.hpp>
- #include <boost/smart_ptr/intrusive_ref_counter.hpp>
- #include <boost/core/explicit_operator_bool.hpp>
- #include <boost/log/detail/config.hpp>
- #include <boost/log/detail/header.hpp>
- #ifdef BOOST_HAS_PRAGMA_ONCE
- #pragma once
- #endif
- namespace boost {
- BOOST_LOG_OPEN_NAMESPACE
- #ifndef BOOST_LOG_DOXYGEN_PASS
- class attribute_value;
- namespace aux {
- class attribute_set_reference_proxy;
- }
- #endif
- class attribute
- {
- BOOST_COPYABLE_AND_MOVABLE(attribute)
- public:
-
- struct BOOST_LOG_NO_VTABLE BOOST_SYMBOL_VISIBLE impl :
- public boost::intrusive_ref_counter< impl >
- {
-
- virtual ~impl() {}
-
- virtual attribute_value get_value() = 0;
- BOOST_LOG_API static void* operator new (std::size_t size);
- BOOST_LOG_API static void operator delete (void* p, std::size_t size) BOOST_NOEXCEPT;
- };
- private:
-
- intrusive_ptr< impl > m_pImpl;
- public:
-
- BOOST_DEFAULTED_FUNCTION(attribute(), {})
-
- attribute(attribute const& that) BOOST_NOEXCEPT : m_pImpl(that.m_pImpl) {}
-
- attribute(BOOST_RV_REF(attribute) that) BOOST_NOEXCEPT { m_pImpl.swap(that.m_pImpl); }
-
- explicit attribute(intrusive_ptr< impl > p) BOOST_NOEXCEPT { m_pImpl.swap(p); }
-
- attribute& operator= (BOOST_COPY_ASSIGN_REF(attribute) that) BOOST_NOEXCEPT
- {
- m_pImpl = that.m_pImpl;
- return *this;
- }
-
- attribute& operator= (BOOST_RV_REF(attribute) that) BOOST_NOEXCEPT
- {
- m_pImpl.swap(that.m_pImpl);
- return *this;
- }
- #ifndef BOOST_LOG_DOXYGEN_PASS
- attribute& operator= (aux::attribute_set_reference_proxy const& that) BOOST_NOEXCEPT;
- #endif
-
- BOOST_EXPLICIT_OPERATOR_BOOL_NOEXCEPT()
-
- bool operator! () const BOOST_NOEXCEPT { return !m_pImpl; }
-
- attribute_value get_value() const;
-
- void swap(attribute& that) BOOST_NOEXCEPT { m_pImpl.swap(that.m_pImpl); }
- protected:
-
- impl* get_impl() const BOOST_NOEXCEPT { return m_pImpl.get(); }
-
- void set_impl(intrusive_ptr< impl > p) BOOST_NOEXCEPT { m_pImpl.swap(p); }
- template< typename T >
- friend T attribute_cast(attribute const&);
- };
- inline void swap(attribute& left, attribute& right) BOOST_NOEXCEPT
- {
- left.swap(right);
- }
- BOOST_LOG_CLOSE_NAMESPACE
- }
- #include <boost/log/detail/footer.hpp>
- #if defined(BOOST_LOG_ATTRIBUTES_ATTRIBUTE_VALUE_HPP_INCLUDED_)
- #include <boost/log/detail/attribute_get_value_impl.hpp>
- #endif
- #endif
|