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