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_CAST_HPP_INCLUDED_
0016 #define BOOST_LOG_ATTRIBUTES_ATTRIBUTE_CAST_HPP_INCLUDED_
0017
0018 #include <boost/log/detail/config.hpp>
0019 #include <boost/log/attributes/attribute.hpp>
0020 #include <boost/log/detail/header.hpp>
0021
0022 #ifdef BOOST_HAS_PRAGMA_ONCE
0023 #pragma once
0024 #endif
0025
0026 namespace boost {
0027
0028 BOOST_LOG_OPEN_NAMESPACE
0029
0030 namespace attributes {
0031
0032
0033
0034
0035 class cast_source
0036 {
0037 private:
0038 attribute::impl* m_pImpl;
0039
0040 public:
0041
0042
0043
0044 explicit cast_source(attribute::impl* p) : m_pImpl(p)
0045 {
0046 }
0047
0048
0049
0050
0051
0052
0053 template< typename T >
0054 T* as() const { return dynamic_cast< T* >(m_pImpl); }
0055 };
0056
0057 }
0058
0059
0060
0061
0062 template< typename T >
0063 inline T attribute_cast(attribute const& attr)
0064 {
0065 return T(attributes::cast_source(attr.get_impl()));
0066 }
0067
0068 BOOST_LOG_CLOSE_NAMESPACE
0069
0070 }
0071
0072 #include <boost/log/detail/footer.hpp>
0073
0074 #endif