the game where you go into mines and start crafting! but for consoles (forked directly from smartcmd's github)
at master 132 lines 3.2 kB view raw
1////////////////////////////////////////////////////////////////////////////// 2// 3// (C) Copyright Ion Gaztanaga 2005-2012. Distributed under the Boost 4// Software License, Version 1.0. (See accompanying file 5// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) 6// 7// See http://www.boost.org/libs/interprocess for documentation. 8// 9////////////////////////////////////////////////////////////////////////////// 10 11#ifndef BOOST_INTERPROCESS_PERMISSIONS_HPP 12#define BOOST_INTERPROCESS_PERMISSIONS_HPP 13 14/// @cond 15 16#if defined (_MSC_VER) && (_MSC_VER >= 1200) 17# pragma once 18#endif 19 20#include <boost/interprocess/detail/config_begin.hpp> 21#include <boost/interprocess/detail/workaround.hpp> 22#include <boost/interprocess/interprocess_fwd.hpp> 23 24#if defined(BOOST_INTERPROCESS_WINDOWS) 25 26#include <boost/interprocess/detail/win32_api.hpp> 27 28#endif 29 30/// @endcond 31 32//!\file 33//!Describes permissions class 34 35namespace boost { 36namespace interprocess { 37 38/// @cond 39 40#if defined(BOOST_INTERPROCESS_WINDOWS) 41 42namespace ipcdetail { 43 44template <int Dummy> 45struct unrestricted_permissions_holder 46{ 47 static winapi::interprocess_all_access_security unrestricted; 48}; 49 50template<int Dummy> 51winapi::interprocess_all_access_security unrestricted_permissions_holder<Dummy>::unrestricted; 52 53} //namespace ipcdetail { 54 55#endif //defined BOOST_INTERPROCESS_WINDOWS 56 57/// @endcond 58 59//!The permissions class represents permissions to be set to shared memory or 60//!files, that can be constructed form usual permission representations: 61//!a SECURITY_ATTRIBUTES pointer in windows or ORed rwx chmod integer in UNIX. 62class permissions 63{ 64 /// @cond 65 66 #if defined(BOOST_INTERPROCESS_WINDOWS) 67 typedef void* os_permissions_type; 68 #else 69 typedef int os_permissions_type; 70 #endif 71 os_permissions_type m_perm; 72 73 /// @endcond 74 75 public: 76 //!Constructs a permissions object from a user provided os-dependent 77 //!permissions. 78 permissions(os_permissions_type type) 79 : m_perm(type) 80 {} 81 82 //!Constructs a default permissions object: 83 //!A null security attributes pointer for windows or 0644 84 //!for UNIX. 85 permissions() 86 { set_default(); } 87 88 //!Sets permissions to default values: 89 //!A null security attributes pointer for windows or 0644 90 //!for UNIX. 91 void set_default() 92 { 93 /// @cond 94 #if defined (BOOST_INTERPROCESS_WINDOWS) 95 m_perm = 0; 96 #else 97 m_perm = 0644; 98 #endif 99 /// @endcond 100 } 101 102 //!Sets permissions to unrestricted access: 103 //!A null DACL for windows or 0666 for UNIX. 104 void set_unrestricted() 105 { 106 /// @cond 107 #if defined (BOOST_INTERPROCESS_WINDOWS) 108 m_perm = &ipcdetail::unrestricted_permissions_holder<0>::unrestricted; 109 #else 110 m_perm = 0666; 111 #endif 112 /// @endcond 113 } 114 115 //!Sets permissions from a user provided os-dependent 116 //!permissions. 117 void set_permissions(os_permissions_type perm) 118 { m_perm = perm; } 119 120 //!Returns stored os-dependent 121 //!permissions 122 os_permissions_type get_permissions() const 123 { return m_perm; } 124}; 125 126} //namespace interprocess { 127} //namespace boost { 128 129#include <boost/interprocess/detail/config_end.hpp> 130 131#endif //BOOST_INTERPROCESS_PERMISSIONS_HPP 132