1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374 |
- #ifndef BOOST_LOG_ATTRIBUTES_ATTRIBUTE_CAST_HPP_INCLUDED_
- #define BOOST_LOG_ATTRIBUTES_ATTRIBUTE_CAST_HPP_INCLUDED_
- #include <boost/log/detail/config.hpp>
- #include <boost/log/attributes/attribute.hpp>
- #include <boost/log/detail/header.hpp>
- #ifdef BOOST_HAS_PRAGMA_ONCE
- #pragma once
- #endif
- namespace boost {
- BOOST_LOG_OPEN_NAMESPACE
- namespace attributes {
- class cast_source
- {
- private:
- attribute::impl* m_pImpl;
- public:
-
- explicit cast_source(attribute::impl* p) : m_pImpl(p)
- {
- }
-
- template< typename T >
- T* as() const { return dynamic_cast< T* >(m_pImpl); }
- };
- }
- template< typename T >
- inline T attribute_cast(attribute const& attr)
- {
- return T(attributes::cast_source(attr.get_impl()));
- }
- BOOST_LOG_CLOSE_NAMESPACE
- }
- #include <boost/log/detail/footer.hpp>
- #endif
|