xref: /freebsd/contrib/llvm-project/libcxx/include/__filesystem/perm_options.h (revision 0fca6ea1d4eea4c934cfff25ac9ee8ad6fe95583)
10eae32dcSDimitry Andric // -*- C++ -*-
20eae32dcSDimitry Andric //===----------------------------------------------------------------------===//
30eae32dcSDimitry Andric //
40eae32dcSDimitry Andric // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
50eae32dcSDimitry Andric // See https://llvm.org/LICENSE.txt for license information.
60eae32dcSDimitry Andric // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
70eae32dcSDimitry Andric //
80eae32dcSDimitry Andric //===----------------------------------------------------------------------===//
90eae32dcSDimitry Andric 
100eae32dcSDimitry Andric #ifndef _LIBCPP___FILESYSTEM_PERM_OPTIONS_H
110eae32dcSDimitry Andric #define _LIBCPP___FILESYSTEM_PERM_OPTIONS_H
120eae32dcSDimitry Andric 
130eae32dcSDimitry Andric #include <__config>
140eae32dcSDimitry Andric 
1581ad6265SDimitry Andric #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
1681ad6265SDimitry Andric #  pragma GCC system_header
1781ad6265SDimitry Andric #endif
1881ad6265SDimitry Andric 
195f757f3fSDimitry Andric #if _LIBCPP_STD_VER >= 17
200eae32dcSDimitry Andric 
210eae32dcSDimitry Andric _LIBCPP_BEGIN_NAMESPACE_FILESYSTEM
220eae32dcSDimitry Andric 
23*cb14a3feSDimitry Andric enum class perm_options : unsigned char { replace = 1, add = 2, remove = 4, nofollow = 8 };
240eae32dcSDimitry Andric 
25*cb14a3feSDimitry Andric _LIBCPP_HIDE_FROM_ABI inline constexpr perm_options operator&(perm_options __lhs, perm_options __rhs) {
26*cb14a3feSDimitry Andric   return static_cast<perm_options>(static_cast<unsigned>(__lhs) & static_cast<unsigned>(__rhs));
270eae32dcSDimitry Andric }
280eae32dcSDimitry Andric 
29*cb14a3feSDimitry Andric _LIBCPP_HIDE_FROM_ABI inline constexpr perm_options operator|(perm_options __lhs, perm_options __rhs) {
30*cb14a3feSDimitry Andric   return static_cast<perm_options>(static_cast<unsigned>(__lhs) | static_cast<unsigned>(__rhs));
310eae32dcSDimitry Andric }
320eae32dcSDimitry Andric 
33*cb14a3feSDimitry Andric _LIBCPP_HIDE_FROM_ABI inline constexpr perm_options operator^(perm_options __lhs, perm_options __rhs) {
34*cb14a3feSDimitry Andric   return static_cast<perm_options>(static_cast<unsigned>(__lhs) ^ static_cast<unsigned>(__rhs));
350eae32dcSDimitry Andric }
360eae32dcSDimitry Andric 
37*cb14a3feSDimitry Andric _LIBCPP_HIDE_FROM_ABI inline constexpr perm_options operator~(perm_options __lhs) {
38753f127fSDimitry Andric   return static_cast<perm_options>(~static_cast<unsigned>(__lhs));
390eae32dcSDimitry Andric }
400eae32dcSDimitry Andric 
41*cb14a3feSDimitry Andric _LIBCPP_HIDE_FROM_ABI inline perm_options& operator&=(perm_options& __lhs, perm_options __rhs) {
42753f127fSDimitry Andric   return __lhs = __lhs & __rhs;
430eae32dcSDimitry Andric }
440eae32dcSDimitry Andric 
45*cb14a3feSDimitry Andric _LIBCPP_HIDE_FROM_ABI inline perm_options& operator|=(perm_options& __lhs, perm_options __rhs) {
46753f127fSDimitry Andric   return __lhs = __lhs | __rhs;
470eae32dcSDimitry Andric }
480eae32dcSDimitry Andric 
49*cb14a3feSDimitry Andric _LIBCPP_HIDE_FROM_ABI inline perm_options& operator^=(perm_options& __lhs, perm_options __rhs) {
50753f127fSDimitry Andric   return __lhs = __lhs ^ __rhs;
510eae32dcSDimitry Andric }
520eae32dcSDimitry Andric 
530eae32dcSDimitry Andric _LIBCPP_END_NAMESPACE_FILESYSTEM
540eae32dcSDimitry Andric 
555f757f3fSDimitry Andric #endif // _LIBCPP_STD_VER >= 17
560eae32dcSDimitry Andric 
570eae32dcSDimitry Andric #endif // _LIBCPP___FILESYSTEM_PERM_OPTIONS_H
58