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 <__availability> 140eae32dcSDimitry Andric #include <__config> 150eae32dcSDimitry Andric 1681ad6265SDimitry Andric #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) 1781ad6265SDimitry Andric # pragma GCC system_header 1881ad6265SDimitry Andric #endif 1981ad6265SDimitry Andric 20*5f757f3fSDimitry Andric #if _LIBCPP_STD_VER >= 17 210eae32dcSDimitry Andric 220eae32dcSDimitry Andric _LIBCPP_BEGIN_NAMESPACE_FILESYSTEM 230eae32dcSDimitry Andric 24*5f757f3fSDimitry Andric enum class perm_options : unsigned char { 250eae32dcSDimitry Andric replace = 1, 260eae32dcSDimitry Andric add = 2, 270eae32dcSDimitry Andric remove = 4, 280eae32dcSDimitry Andric nofollow = 8 290eae32dcSDimitry Andric }; 300eae32dcSDimitry Andric 31*5f757f3fSDimitry Andric _LIBCPP_HIDE_FROM_ABI 32753f127fSDimitry Andric inline constexpr perm_options operator&(perm_options __lhs, perm_options __rhs) { 33753f127fSDimitry Andric return static_cast<perm_options>(static_cast<unsigned>(__lhs) & 34753f127fSDimitry Andric static_cast<unsigned>(__rhs)); 350eae32dcSDimitry Andric } 360eae32dcSDimitry Andric 37*5f757f3fSDimitry Andric _LIBCPP_HIDE_FROM_ABI 38753f127fSDimitry Andric inline constexpr perm_options operator|(perm_options __lhs, perm_options __rhs) { 39753f127fSDimitry Andric return static_cast<perm_options>(static_cast<unsigned>(__lhs) | 40753f127fSDimitry Andric static_cast<unsigned>(__rhs)); 410eae32dcSDimitry Andric } 420eae32dcSDimitry Andric 43*5f757f3fSDimitry Andric _LIBCPP_HIDE_FROM_ABI 44753f127fSDimitry Andric inline constexpr perm_options operator^(perm_options __lhs, perm_options __rhs) { 45753f127fSDimitry Andric return static_cast<perm_options>(static_cast<unsigned>(__lhs) ^ 46753f127fSDimitry Andric static_cast<unsigned>(__rhs)); 470eae32dcSDimitry Andric } 480eae32dcSDimitry Andric 49*5f757f3fSDimitry Andric _LIBCPP_HIDE_FROM_ABI 50753f127fSDimitry Andric inline constexpr perm_options operator~(perm_options __lhs) { 51753f127fSDimitry Andric return static_cast<perm_options>(~static_cast<unsigned>(__lhs)); 520eae32dcSDimitry Andric } 530eae32dcSDimitry Andric 54*5f757f3fSDimitry Andric _LIBCPP_HIDE_FROM_ABI 55753f127fSDimitry Andric inline perm_options& operator&=(perm_options& __lhs, perm_options __rhs) { 56753f127fSDimitry Andric return __lhs = __lhs & __rhs; 570eae32dcSDimitry Andric } 580eae32dcSDimitry Andric 59*5f757f3fSDimitry Andric _LIBCPP_HIDE_FROM_ABI 60753f127fSDimitry Andric inline perm_options& operator|=(perm_options& __lhs, perm_options __rhs) { 61753f127fSDimitry Andric return __lhs = __lhs | __rhs; 620eae32dcSDimitry Andric } 630eae32dcSDimitry Andric 64*5f757f3fSDimitry Andric _LIBCPP_HIDE_FROM_ABI 65753f127fSDimitry Andric inline perm_options& operator^=(perm_options& __lhs, perm_options __rhs) { 66753f127fSDimitry Andric return __lhs = __lhs ^ __rhs; 670eae32dcSDimitry Andric } 680eae32dcSDimitry Andric 690eae32dcSDimitry Andric _LIBCPP_END_NAMESPACE_FILESYSTEM 700eae32dcSDimitry Andric 71*5f757f3fSDimitry Andric #endif // _LIBCPP_STD_VER >= 17 720eae32dcSDimitry Andric 730eae32dcSDimitry Andric #endif // _LIBCPP___FILESYSTEM_PERM_OPTIONS_H 74