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 <__config>
14
15#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
16# pragma GCC system_header
17#endif
18
19#if _LIBCPP_STD_VER >= 17
20
21_LIBCPP_BEGIN_NAMESPACE_FILESYSTEM
22
23enum class directory_options : unsigned char { none = 0, follow_directory_symlink = 1, skip_permission_denied = 2 };
24
25[[nodiscard]] _LIBCPP_HIDE_FROM_ABI inline constexpr directory_options
26operator&(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[[nodiscard]] _LIBCPP_HIDE_FROM_ABI inline constexpr directory_options
31operator|(directory_options __lhs, directory_options __rhs) {
32 return static_cast<directory_options>(static_cast<unsigned char>(__lhs) | static_cast<unsigned char>(__rhs));
33}
34
35[[nodiscard]] _LIBCPP_HIDE_FROM_ABI inline constexpr directory_options
36operator^(directory_options __lhs, directory_options __rhs) {
37 return static_cast<directory_options>(static_cast<unsigned char>(__lhs) ^ static_cast<unsigned char>(__rhs));
38}
39
40[[nodiscard]] _LIBCPP_HIDE_FROM_ABI inline constexpr directory_options operator~(directory_options __lhs) {
41 return static_cast<directory_options>(~static_cast<unsigned char>(__lhs));
42}
43
44_LIBCPP_HIDE_FROM_ABI inline directory_options& operator&=(directory_options& __lhs, directory_options __rhs) {
45 return __lhs = __lhs & __rhs;
46}
47
48_LIBCPP_HIDE_FROM_ABI inline directory_options& operator|=(directory_options& __lhs, directory_options __rhs) {
49 return __lhs = __lhs | __rhs;
50}
51
52_LIBCPP_HIDE_FROM_ABI inline directory_options& operator^=(directory_options& __lhs, directory_options __rhs) {
53 return __lhs = __lhs ^ __rhs;
54}
55
56_LIBCPP_END_NAMESPACE_FILESYSTEM
57
58#endif // _LIBCPP_STD_VER >= 17
59
60#endif // _LIBCPP___FILESYSTEM_DIRECTORY_OPTIONS_H
61