xref: /freebsd/contrib/llvm-project/libcxx/include/__filesystem/directory_options.h (revision 1db9f3b21e39176dd5b67cf8ac378633b172463e)
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 #if _LIBCPP_STD_VER >= 17
21 
22 _LIBCPP_BEGIN_NAMESPACE_FILESYSTEM
23 
24 enum class directory_options : unsigned char { none = 0, follow_directory_symlink = 1, skip_permission_denied = 2 };
25 
26 _LIBCPP_HIDE_FROM_ABI inline constexpr directory_options operator&(directory_options __lhs, directory_options __rhs) {
27   return static_cast<directory_options>(static_cast<unsigned char>(__lhs) & static_cast<unsigned char>(__rhs));
28 }
29 
30 _LIBCPP_HIDE_FROM_ABI inline constexpr directory_options operator|(directory_options __lhs, directory_options __rhs) {
31   return static_cast<directory_options>(static_cast<unsigned char>(__lhs) | static_cast<unsigned char>(__rhs));
32 }
33 
34 _LIBCPP_HIDE_FROM_ABI inline constexpr directory_options operator^(directory_options __lhs, directory_options __rhs) {
35   return static_cast<directory_options>(static_cast<unsigned char>(__lhs) ^ static_cast<unsigned char>(__rhs));
36 }
37 
38 _LIBCPP_HIDE_FROM_ABI inline constexpr directory_options operator~(directory_options __lhs) {
39   return static_cast<directory_options>(~static_cast<unsigned char>(__lhs));
40 }
41 
42 _LIBCPP_HIDE_FROM_ABI inline directory_options& operator&=(directory_options& __lhs, directory_options __rhs) {
43   return __lhs = __lhs & __rhs;
44 }
45 
46 _LIBCPP_HIDE_FROM_ABI inline directory_options& operator|=(directory_options& __lhs, directory_options __rhs) {
47   return __lhs = __lhs | __rhs;
48 }
49 
50 _LIBCPP_HIDE_FROM_ABI inline directory_options& operator^=(directory_options& __lhs, directory_options __rhs) {
51   return __lhs = __lhs ^ __rhs;
52 }
53 
54 _LIBCPP_END_NAMESPACE_FILESYSTEM
55 
56 #endif // _LIBCPP_STD_VER >= 17
57 
58 #endif // _LIBCPP___FILESYSTEM_DIRECTORY_OPTIONS_H
59