123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219 |
- #ifndef BOOST_LOG_UTILITY_PERMISSIONS_HPP_INCLUDED_
- #define BOOST_LOG_UTILITY_PERMISSIONS_HPP_INCLUDED_
- #include <boost/log/detail/config.hpp>
- #include <boost/log/detail/header.hpp>
- #ifdef BOOST_HAS_PRAGMA_ONCE
- #pragma once
- #endif
- #ifdef BOOST_WINDOWS
- extern "C" {
- struct _SECURITY_ATTRIBUTES;
- }
- #endif
- namespace boost {
- #ifdef BOOST_WINDOWS
- #if defined(BOOST_GCC) && BOOST_GCC >= 40600
- #pragma GCC diagnostic push
- #pragma GCC diagnostic ignored "-Wattributes"
- #endif
- namespace winapi {
- struct BOOST_LOG_MAY_ALIAS _SECURITY_ATTRIBUTES;
- }
- #if defined(BOOST_GCC) && BOOST_GCC >= 40600
- #pragma GCC diagnostic pop
- #endif
- #endif
- namespace interprocess {
- class permissions;
- }
- BOOST_LOG_OPEN_NAMESPACE
- class permissions
- {
- public:
- #if defined(BOOST_LOG_DOXYGEN_PASS)
-
- typedef implementation_defined native_type;
- #elif defined(BOOST_WINDOWS)
- typedef ::_SECURITY_ATTRIBUTES* native_type;
- #else
-
- typedef unsigned int native_type;
- #endif
- #if !defined(BOOST_LOG_DOXYGEN_PASS)
- private:
- native_type m_perms;
- #endif
- public:
-
- permissions() BOOST_NOEXCEPT
- {
- set_default();
- }
-
- permissions(permissions const& that) BOOST_NOEXCEPT : m_perms(that.m_perms)
- {
- }
-
- permissions& operator=(permissions const& that) BOOST_NOEXCEPT
- {
- m_perms = that.m_perms;
- return *this;
- }
-
- permissions(native_type perms) BOOST_NOEXCEPT : m_perms(perms)
- {
- }
- #ifdef BOOST_WINDOWS
- permissions(boost::winapi::_SECURITY_ATTRIBUTES* perms) BOOST_NOEXCEPT : m_perms(reinterpret_cast< native_type >(perms))
- {
- }
- #endif
-
- BOOST_LOG_API permissions(boost::interprocess::permissions const& perms) BOOST_NOEXCEPT;
- #if !defined(BOOST_NO_CXX11_RVALUE_REFERENCES)
-
- permissions(permissions&& that) BOOST_NOEXCEPT : m_perms(that.m_perms)
- {
- that.set_default();
- }
-
- permissions& operator=(permissions&& that) BOOST_NOEXCEPT
- {
- m_perms = that.m_perms;
- that.set_default();
- return *this;
- }
- #endif
-
- void set_native(native_type perms) BOOST_NOEXCEPT
- {
- m_perms = perms;
- }
-
- native_type get_native() const BOOST_NOEXCEPT
- {
- return m_perms;
- }
-
- void set_default() BOOST_NOEXCEPT
- {
- #if defined(BOOST_WINDOWS)
- m_perms = 0;
- #else
- m_perms = 0644;
- #endif
- }
-
- void set_unrestricted()
- {
- #if defined(BOOST_WINDOWS)
- m_perms = get_unrestricted_security_attributes();
- #else
- m_perms = 0666;
- #endif
- }
-
- void swap(permissions& that) BOOST_NOEXCEPT
- {
- native_type perms = m_perms;
- m_perms = that.m_perms;
- that.m_perms = perms;
- }
-
- friend void swap(permissions& a, permissions& b) BOOST_NOEXCEPT
- {
- a.swap(b);
- }
- #if !defined(BOOST_LOG_DOXYGEN_PASS) && defined(BOOST_WINDOWS)
- private:
- static BOOST_LOG_API native_type get_unrestricted_security_attributes();
- #endif
- };
- BOOST_LOG_CLOSE_NAMESPACE
- }
- #include <boost/log/detail/footer.hpp>
- #endif
|