file_status.h 1.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172
  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. #ifndef _LIBCPP___FILESYSTEM_FILE_STATUS_H
  10. #define _LIBCPP___FILESYSTEM_FILE_STATUS_H
  11. #include <__availability>
  12. #include <__config>
  13. #include <__filesystem/file_type.h>
  14. #include <__filesystem/perms.h>
  15. #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
  16. # pragma GCC system_header
  17. #endif
  18. #ifndef _LIBCPP_CXX03_LANG
  19. _LIBCPP_BEGIN_NAMESPACE_FILESYSTEM
  20. _LIBCPP_AVAILABILITY_FILESYSTEM_PUSH
  21. class _LIBCPP_TYPE_VIS file_status {
  22. public:
  23. // constructors
  24. _LIBCPP_INLINE_VISIBILITY
  25. file_status() noexcept : file_status(file_type::none) {}
  26. _LIBCPP_INLINE_VISIBILITY
  27. explicit file_status(file_type __ft, perms __prms = perms::unknown) noexcept
  28. : __ft_(__ft),
  29. __prms_(__prms) {}
  30. file_status(const file_status&) noexcept = default;
  31. file_status(file_status&&) noexcept = default;
  32. _LIBCPP_INLINE_VISIBILITY
  33. ~file_status() {}
  34. file_status& operator=(const file_status&) noexcept = default;
  35. file_status& operator=(file_status&&) noexcept = default;
  36. // observers
  37. _LIBCPP_INLINE_VISIBILITY
  38. file_type type() const noexcept { return __ft_; }
  39. _LIBCPP_INLINE_VISIBILITY
  40. perms permissions() const noexcept { return __prms_; }
  41. // modifiers
  42. _LIBCPP_INLINE_VISIBILITY
  43. void type(file_type __ft) noexcept { __ft_ = __ft; }
  44. _LIBCPP_INLINE_VISIBILITY
  45. void permissions(perms __p) noexcept { __prms_ = __p; }
  46. private:
  47. file_type __ft_;
  48. perms __prms_;
  49. };
  50. _LIBCPP_AVAILABILITY_FILESYSTEM_POP
  51. _LIBCPP_END_NAMESPACE_FILESYSTEM
  52. #endif // _LIBCPP_CXX03_LANG
  53. #endif // _LIBCPP___FILESYSTEM_FILE_STATUS_H