xref: /freebsd/contrib/llvm-project/libcxx/include/__filesystem/file_status.h (revision 924226fba12cc9a228c73b956e1b7fa24c60b055)
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_FILE_STATUS_H
11 #define _LIBCPP___FILESYSTEM_FILE_STATUS_H
12 
13 #include <__availability>
14 #include <__config>
15 #include <__filesystem/file_type.h>
16 #include <__filesystem/perms.h>
17 
18 #ifndef _LIBCPP_CXX03_LANG
19 
20 _LIBCPP_BEGIN_NAMESPACE_FILESYSTEM
21 
22 _LIBCPP_AVAILABILITY_FILESYSTEM_PUSH
23 
24 class _LIBCPP_TYPE_VIS file_status {
25 public:
26   // constructors
27   _LIBCPP_INLINE_VISIBILITY
28   file_status() noexcept : file_status(file_type::none) {}
29   _LIBCPP_INLINE_VISIBILITY
30   explicit file_status(file_type __ft, perms __prms = perms::unknown) noexcept
31       : __ft_(__ft),
32         __prms_(__prms) {}
33 
34   file_status(const file_status&) noexcept = default;
35   file_status(file_status&&) noexcept = default;
36 
37   _LIBCPP_INLINE_VISIBILITY
38   ~file_status() {}
39 
40   file_status& operator=(const file_status&) noexcept = default;
41   file_status& operator=(file_status&&) noexcept = default;
42 
43   // observers
44   _LIBCPP_INLINE_VISIBILITY
45   file_type type() const noexcept { return __ft_; }
46 
47   _LIBCPP_INLINE_VISIBILITY
48   perms permissions() const noexcept { return __prms_; }
49 
50   // modifiers
51   _LIBCPP_INLINE_VISIBILITY
52   void type(file_type __ft) noexcept { __ft_ = __ft; }
53 
54   _LIBCPP_INLINE_VISIBILITY
55   void permissions(perms __p) noexcept { __prms_ = __p; }
56 
57 private:
58   file_type __ft_;
59   perms __prms_;
60 };
61 
62 _LIBCPP_AVAILABILITY_FILESYSTEM_POP
63 
64 _LIBCPP_END_NAMESPACE_FILESYSTEM
65 
66 #endif // _LIBCPP_CXX03_LANG
67 
68 #endif // _LIBCPP___FILESYSTEM_FILE_STATUS_H
69