xref: /freebsd/contrib/llvm-project/libcxx/include/__filesystem/directory_options.h (revision 18054d0220cfc8df9c9568c437bd6fbb59d53c3c)
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_DIRECTORY_OPTIONS_H
11 #define _LIBCPP___FILESYSTEM_DIRECTORY_OPTIONS_H
12 
13 #include <__availability>
14 #include <__config>
15 
16 #ifndef _LIBCPP_CXX03_LANG
17 
18 _LIBCPP_BEGIN_NAMESPACE_FILESYSTEM
19 
20 _LIBCPP_AVAILABILITY_FILESYSTEM_PUSH
21 
22 enum class _LIBCPP_ENUM_VIS directory_options : unsigned char {
23   none = 0,
24   follow_directory_symlink = 1,
25   skip_permission_denied = 2
26 };
27 
28 _LIBCPP_INLINE_VISIBILITY
29 inline constexpr directory_options operator&(directory_options _LHS,
30                                              directory_options _RHS) {
31   return static_cast<directory_options>(static_cast<unsigned char>(_LHS) &
32                                         static_cast<unsigned char>(_RHS));
33 }
34 
35 _LIBCPP_INLINE_VISIBILITY
36 inline constexpr directory_options operator|(directory_options _LHS,
37                                              directory_options _RHS) {
38   return static_cast<directory_options>(static_cast<unsigned char>(_LHS) |
39                                         static_cast<unsigned char>(_RHS));
40 }
41 
42 _LIBCPP_INLINE_VISIBILITY
43 inline constexpr directory_options operator^(directory_options _LHS,
44                                              directory_options _RHS) {
45   return static_cast<directory_options>(static_cast<unsigned char>(_LHS) ^
46                                         static_cast<unsigned char>(_RHS));
47 }
48 
49 _LIBCPP_INLINE_VISIBILITY
50 inline constexpr directory_options operator~(directory_options _LHS) {
51   return static_cast<directory_options>(~static_cast<unsigned char>(_LHS));
52 }
53 
54 _LIBCPP_INLINE_VISIBILITY
55 inline directory_options& operator&=(directory_options& _LHS,
56                                      directory_options _RHS) {
57   return _LHS = _LHS & _RHS;
58 }
59 
60 _LIBCPP_INLINE_VISIBILITY
61 inline directory_options& operator|=(directory_options& _LHS,
62                                      directory_options _RHS) {
63   return _LHS = _LHS | _RHS;
64 }
65 
66 _LIBCPP_INLINE_VISIBILITY
67 inline directory_options& operator^=(directory_options& _LHS,
68                                      directory_options _RHS) {
69   return _LHS = _LHS ^ _RHS;
70 }
71 
72 _LIBCPP_AVAILABILITY_FILESYSTEM_POP
73 
74 _LIBCPP_END_NAMESPACE_FILESYSTEM
75 
76 #endif // _LIBCPP_CXX03_LANG
77 
78 #endif // _LIBCPP___FILESYSTEM_DIRECTORY_OPTIONS_H
79