xref: /freebsd-src/contrib/llvm-project/libcxx/include/__filesystem/perm_options.h (revision 0eae32dcef82f6f06de6419a0d623d7def0cc8f6)
1*0eae32dcSDimitry Andric // -*- C++ -*-
2*0eae32dcSDimitry Andric //===----------------------------------------------------------------------===//
3*0eae32dcSDimitry Andric //
4*0eae32dcSDimitry Andric // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
5*0eae32dcSDimitry Andric // See https://llvm.org/LICENSE.txt for license information.
6*0eae32dcSDimitry Andric // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
7*0eae32dcSDimitry Andric //
8*0eae32dcSDimitry Andric //===----------------------------------------------------------------------===//
9*0eae32dcSDimitry Andric 
10*0eae32dcSDimitry Andric #ifndef _LIBCPP___FILESYSTEM_PERM_OPTIONS_H
11*0eae32dcSDimitry Andric #define _LIBCPP___FILESYSTEM_PERM_OPTIONS_H
12*0eae32dcSDimitry Andric 
13*0eae32dcSDimitry Andric #include <__availability>
14*0eae32dcSDimitry Andric #include <__config>
15*0eae32dcSDimitry Andric 
16*0eae32dcSDimitry Andric #ifndef _LIBCPP_CXX03_LANG
17*0eae32dcSDimitry Andric 
18*0eae32dcSDimitry Andric _LIBCPP_BEGIN_NAMESPACE_FILESYSTEM
19*0eae32dcSDimitry Andric 
20*0eae32dcSDimitry Andric _LIBCPP_AVAILABILITY_FILESYSTEM_PUSH
21*0eae32dcSDimitry Andric 
22*0eae32dcSDimitry Andric enum class _LIBCPP_ENUM_VIS perm_options : unsigned char {
23*0eae32dcSDimitry Andric   replace = 1,
24*0eae32dcSDimitry Andric   add = 2,
25*0eae32dcSDimitry Andric   remove = 4,
26*0eae32dcSDimitry Andric   nofollow = 8
27*0eae32dcSDimitry Andric };
28*0eae32dcSDimitry Andric 
29*0eae32dcSDimitry Andric _LIBCPP_INLINE_VISIBILITY
30*0eae32dcSDimitry Andric inline constexpr perm_options operator&(perm_options _LHS, perm_options _RHS) {
31*0eae32dcSDimitry Andric   return static_cast<perm_options>(static_cast<unsigned>(_LHS) &
32*0eae32dcSDimitry Andric                                    static_cast<unsigned>(_RHS));
33*0eae32dcSDimitry Andric }
34*0eae32dcSDimitry Andric 
35*0eae32dcSDimitry Andric _LIBCPP_INLINE_VISIBILITY
36*0eae32dcSDimitry Andric inline constexpr perm_options operator|(perm_options _LHS, perm_options _RHS) {
37*0eae32dcSDimitry Andric   return static_cast<perm_options>(static_cast<unsigned>(_LHS) |
38*0eae32dcSDimitry Andric                                    static_cast<unsigned>(_RHS));
39*0eae32dcSDimitry Andric }
40*0eae32dcSDimitry Andric 
41*0eae32dcSDimitry Andric _LIBCPP_INLINE_VISIBILITY
42*0eae32dcSDimitry Andric inline constexpr perm_options operator^(perm_options _LHS, perm_options _RHS) {
43*0eae32dcSDimitry Andric   return static_cast<perm_options>(static_cast<unsigned>(_LHS) ^
44*0eae32dcSDimitry Andric                                    static_cast<unsigned>(_RHS));
45*0eae32dcSDimitry Andric }
46*0eae32dcSDimitry Andric 
47*0eae32dcSDimitry Andric _LIBCPP_INLINE_VISIBILITY
48*0eae32dcSDimitry Andric inline constexpr perm_options operator~(perm_options _LHS) {
49*0eae32dcSDimitry Andric   return static_cast<perm_options>(~static_cast<unsigned>(_LHS));
50*0eae32dcSDimitry Andric }
51*0eae32dcSDimitry Andric 
52*0eae32dcSDimitry Andric _LIBCPP_INLINE_VISIBILITY
53*0eae32dcSDimitry Andric inline perm_options& operator&=(perm_options& _LHS, perm_options _RHS) {
54*0eae32dcSDimitry Andric   return _LHS = _LHS & _RHS;
55*0eae32dcSDimitry Andric }
56*0eae32dcSDimitry Andric 
57*0eae32dcSDimitry Andric _LIBCPP_INLINE_VISIBILITY
58*0eae32dcSDimitry Andric inline perm_options& operator|=(perm_options& _LHS, perm_options _RHS) {
59*0eae32dcSDimitry Andric   return _LHS = _LHS | _RHS;
60*0eae32dcSDimitry Andric }
61*0eae32dcSDimitry Andric 
62*0eae32dcSDimitry Andric _LIBCPP_INLINE_VISIBILITY
63*0eae32dcSDimitry Andric inline perm_options& operator^=(perm_options& _LHS, perm_options _RHS) {
64*0eae32dcSDimitry Andric   return _LHS = _LHS ^ _RHS;
65*0eae32dcSDimitry Andric }
66*0eae32dcSDimitry Andric 
67*0eae32dcSDimitry Andric _LIBCPP_AVAILABILITY_FILESYSTEM_POP
68*0eae32dcSDimitry Andric 
69*0eae32dcSDimitry Andric _LIBCPP_END_NAMESPACE_FILESYSTEM
70*0eae32dcSDimitry Andric 
71*0eae32dcSDimitry Andric #endif // _LIBCPP_CXX03_LANG
72*0eae32dcSDimitry Andric 
73*0eae32dcSDimitry Andric #endif // _LIBCPP___FILESYSTEM_PERM_OPTIONS_H
74