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