/usr/include/boost/log/attributes/attribute.hpp is in libboost1.54-dev 1.54.0-4ubuntu3.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 | /*
* Copyright Andrey Semashev 2007 - 2013.
* Distributed under the Boost Software License, Version 1.0.
* (See accompanying file LICENSE_1_0.txt or copy at
* http://www.boost.org/LICENSE_1_0.txt)
*/
/*!
* \file attribute.hpp
* \author Andrey Semashev
* \date 15.04.2007
*
* The header contains attribute interface definition.
*/
#ifndef BOOST_LOG_ATTRIBUTES_ATTRIBUTE_HPP_INCLUDED_
#define BOOST_LOG_ATTRIBUTES_ATTRIBUTE_HPP_INCLUDED_
#include <new>
#include <boost/intrusive_ptr.hpp>
#include <boost/move/core.hpp>
#include <boost/log/detail/config.hpp>
#include <boost/log/utility/intrusive_ref_counter.hpp>
#include <boost/log/utility/explicit_operator_bool.hpp>
#include <boost/log/detail/header.hpp>
#ifdef BOOST_LOG_HAS_PRAGMA_ONCE
#pragma once
#endif
namespace boost {
BOOST_LOG_OPEN_NAMESPACE
#ifndef BOOST_LOG_DOXYGEN_PASS
class attribute_value;
namespace aux {
//! Reference proxy object to implement \c operator[]
class attribute_set_reference_proxy;
} // namespace aux
#endif // BOOST_LOG_DOXYGEN_PASS
/*!
* \brief A base class for an attribute value factory
*
* Every attribute is represented with a factory that is basically an attribute value generator.
* The sole purpose of an attribute is to return an actual value when requested. A simplest attribute
* can always return the same value that it stores internally, but more complex ones can
* perform a considerable amount of work to return a value, and the returned values may differ
* each time requested.
*
* A word about thread safety. An attribute should be prepared to be requested a value from
* multiple threads concurrently.
*/
class attribute
{
BOOST_COPYABLE_AND_MOVABLE(attribute)
public:
/*!
* \brief A base class for an attribute value factory
*
* All attributes must derive their implementation from this class.
*/
struct BOOST_LOG_NO_VTABLE BOOST_LOG_VISIBLE impl :
public intrusive_ref_counter
{
/*!
* \return The actual attribute value. It shall not return empty values (exceptions
* shall be used to indicate errors).
*/
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:
//! Pointer to the attribute factory implementation
intrusive_ptr< impl > m_pImpl;
public:
/*!
* Default constructor. Creates an empty attribute value factory, which is not usable until
* \c set_impl is called.
*/
BOOST_LOG_DEFAULTED_FUNCTION(attribute(), {})
/*!
* Copy constructor
*/
attribute(attribute const& that) BOOST_NOEXCEPT : m_pImpl(that.m_pImpl) {}
/*!
* Move constructor
*/
attribute(BOOST_RV_REF(attribute) that) BOOST_NOEXCEPT { m_pImpl.swap(that.m_pImpl); }
/*!
* Initializing constructor
*
* \param p Pointer to the implementation. Must not be \c NULL.
*/
explicit attribute(intrusive_ptr< impl > p) BOOST_NOEXCEPT { m_pImpl.swap(p); }
/*!
* Copy assignment
*/
attribute& operator= (BOOST_COPY_ASSIGN_REF(attribute) that) BOOST_NOEXCEPT
{
m_pImpl = that.m_pImpl;
return *this;
}
/*!
* Move assignment
*/
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
/*!
* Verifies that the factory is not in empty state
*/
BOOST_LOG_EXPLICIT_OPERATOR_BOOL()
/*!
* Verifies that the factory is in empty state
*/
bool operator! () const BOOST_NOEXCEPT { return !m_pImpl; }
/*!
* \return The actual attribute value. It shall not return empty values (exceptions
* shall be used to indicate errors).
*/
attribute_value get_value() const;
/*!
* The method swaps two factories (i.e. their implementations).
*/
void swap(attribute& that) BOOST_NOEXCEPT { m_pImpl.swap(that.m_pImpl); }
protected:
/*!
* \returns The pointer to the implementation
*/
impl* get_impl() const BOOST_NOEXCEPT { return m_pImpl.get(); }
/*!
* Sets the pointer to the factory implementation.
*
* \param p Pointer to the implementation. Must not be \c NULL.
*/
void set_impl(intrusive_ptr< impl > p) BOOST_NOEXCEPT { m_pImpl.swap(p); }
template< typename T >
friend T attribute_cast(attribute const&);
};
/*!
* The function swaps two attribute value factories
*/
inline void swap(attribute& left, attribute& right) BOOST_NOEXCEPT
{
left.swap(right);
}
BOOST_LOG_CLOSE_NAMESPACE // namespace log
} // namespace boost
#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 // BOOST_LOG_ATTRIBUTES_ATTRIBUTE_HPP_INCLUDED_
|