Path: blob/main/contrib/llvm-project/libcxx/include/__filesystem/perms.h
35262 views
// -*- C++ -*-1//===----------------------------------------------------------------------===//2//3// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.4// See https://llvm.org/LICENSE.txt for license information.5// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception6//7//===----------------------------------------------------------------------===//89#ifndef _LIBCPP___FILESYSTEM_PERMS_H10#define _LIBCPP___FILESYSTEM_PERMS_H1112#include <__config>1314#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)15# pragma GCC system_header16#endif1718#if _LIBCPP_STD_VER >= 171920_LIBCPP_BEGIN_NAMESPACE_FILESYSTEM2122// On Windows, these permission bits map to one single readonly flag per23// file, and the executable bit is always returned as set. When setting24// permissions, as long as the write bit is set for either owner, group or25// others, the readonly flag is cleared.26enum class perms : unsigned {27none = 0,2829owner_read = 0400,30owner_write = 0200,31owner_exec = 0100,32owner_all = 0700,3334group_read = 040,35group_write = 020,36group_exec = 010,37group_all = 070,3839others_read = 04,40others_write = 02,41others_exec = 01,42others_all = 07,4344all = 0777,4546set_uid = 04000,47set_gid = 02000,48sticky_bit = 01000,49mask = 07777,50unknown = 0xFFFF,51};5253_LIBCPP_HIDE_FROM_ABI inline constexpr perms operator&(perms __lhs, perms __rhs) {54return static_cast<perms>(static_cast<unsigned>(__lhs) & static_cast<unsigned>(__rhs));55}5657_LIBCPP_HIDE_FROM_ABI inline constexpr perms operator|(perms __lhs, perms __rhs) {58return static_cast<perms>(static_cast<unsigned>(__lhs) | static_cast<unsigned>(__rhs));59}6061_LIBCPP_HIDE_FROM_ABI inline constexpr perms operator^(perms __lhs, perms __rhs) {62return static_cast<perms>(static_cast<unsigned>(__lhs) ^ static_cast<unsigned>(__rhs));63}6465_LIBCPP_HIDE_FROM_ABI inline constexpr perms operator~(perms __lhs) {66return static_cast<perms>(~static_cast<unsigned>(__lhs));67}6869_LIBCPP_HIDE_FROM_ABI inline perms& operator&=(perms& __lhs, perms __rhs) { return __lhs = __lhs & __rhs; }7071_LIBCPP_HIDE_FROM_ABI inline perms& operator|=(perms& __lhs, perms __rhs) { return __lhs = __lhs | __rhs; }7273_LIBCPP_HIDE_FROM_ABI inline perms& operator^=(perms& __lhs, perms __rhs) { return __lhs = __lhs ^ __rhs; }7475_LIBCPP_END_NAMESPACE_FILESYSTEM7677#endif // _LIBCPP_STD_VER >= 177879#endif // _LIBCPP___FILESYSTEM_PERMS_H808182