1// -*- C++ -*-
2//===----------------------------------------------------------------------===//
3//
4// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
5// See https://llvm.org/LICENSE.txt for license information.
6// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
7//
8//===----------------------------------------------------------------------===//
9
10#ifndef _LIBCPP___FILESYSTEM_PERM_OPTIONS_H
11#define _LIBCPP___FILESYSTEM_PERM_OPTIONS_H
12
13#include <__config>
14
15#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
16# pragma GCC system_header
17#endif
18
19#if _LIBCPP_STD_VER >= 17
20
21_LIBCPP_BEGIN_NAMESPACE_FILESYSTEM
22
23enum class perm_options : unsigned char { replace = 1, add = 2, remove = 4, nofollow = 8 };
24
25_LIBCPP_HIDE_FROM_ABI inline constexpr perm_options operator&(perm_options __lhs, perm_options __rhs) {
26 return static_cast<perm_options>(static_cast<unsigned>(__lhs) & static_cast<unsigned>(__rhs));
27}
28
29_LIBCPP_HIDE_FROM_ABI inline constexpr perm_options operator|(perm_options __lhs, perm_options __rhs) {
30 return static_cast<perm_options>(static_cast<unsigned>(__lhs) | static_cast<unsigned>(__rhs));
31}
32
33_LIBCPP_HIDE_FROM_ABI inline constexpr perm_options operator^(perm_options __lhs, perm_options __rhs) {
34 return static_cast<perm_options>(static_cast<unsigned>(__lhs) ^ static_cast<unsigned>(__rhs));
35}
36
37_LIBCPP_HIDE_FROM_ABI inline constexpr perm_options operator~(perm_options __lhs) {
38 return static_cast<perm_options>(~static_cast<unsigned>(__lhs));
39}
40
41_LIBCPP_HIDE_FROM_ABI inline perm_options& operator&=(perm_options& __lhs, perm_options __rhs) {
42 return __lhs = __lhs & __rhs;
43}
44
45_LIBCPP_HIDE_FROM_ABI inline perm_options& operator|=(perm_options& __lhs, perm_options __rhs) {
46 return __lhs = __lhs | __rhs;
47}
48
49_LIBCPP_HIDE_FROM_ABI inline perm_options& operator^=(perm_options& __lhs, perm_options __rhs) {
50 return __lhs = __lhs ^ __rhs;
51}
52
53_LIBCPP_END_NAMESPACE_FILESYSTEM
54
55#endif // _LIBCPP_STD_VER >= 17
56
57#endif // _LIBCPP___FILESYSTEM_PERM_OPTIONS_H
58