mirror of
https://github.com/jart/cosmopolitan.git
synced 2025-06-27 14:58:30 +00:00
Release Cosmopolitan v3.6.0
This release is an atomic upgrade to GCC 14.1.0 with C23 and C++23
This commit is contained in:
parent
62ace3623a
commit
5660ec4741
1585 changed files with 117353 additions and 271644 deletions
61
third_party/libcxx/__filesystem/copy_options.h
vendored
61
third_party/libcxx/__filesystem/copy_options.h
vendored
|
@ -10,75 +10,60 @@
|
|||
#ifndef _LIBCPP___FILESYSTEM_COPY_OPTIONS_H
|
||||
#define _LIBCPP___FILESYSTEM_COPY_OPTIONS_H
|
||||
|
||||
#include <__availability>
|
||||
#include <__config>
|
||||
|
||||
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
|
||||
# pragma GCC system_header
|
||||
#endif
|
||||
|
||||
#ifndef _LIBCPP_CXX03_LANG
|
||||
#if _LIBCPP_STD_VER >= 17
|
||||
|
||||
_LIBCPP_BEGIN_NAMESPACE_FILESYSTEM
|
||||
|
||||
_LIBCPP_AVAILABILITY_FILESYSTEM_PUSH
|
||||
|
||||
enum class _LIBCPP_ENUM_VIS copy_options : unsigned short {
|
||||
none = 0,
|
||||
skip_existing = 1,
|
||||
overwrite_existing = 2,
|
||||
update_existing = 4,
|
||||
recursive = 8,
|
||||
copy_symlinks = 16,
|
||||
skip_symlinks = 32,
|
||||
directories_only = 64,
|
||||
create_symlinks = 128,
|
||||
create_hard_links = 256,
|
||||
enum class copy_options : unsigned short {
|
||||
none = 0,
|
||||
skip_existing = 1,
|
||||
overwrite_existing = 2,
|
||||
update_existing = 4,
|
||||
recursive = 8,
|
||||
copy_symlinks = 16,
|
||||
skip_symlinks = 32,
|
||||
directories_only = 64,
|
||||
create_symlinks = 128,
|
||||
create_hard_links = 256,
|
||||
__in_recursive_copy = 512,
|
||||
};
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
inline constexpr copy_options operator&(copy_options __lhs, copy_options __rhs) {
|
||||
return static_cast<copy_options>(static_cast<unsigned short>(__lhs) &
|
||||
static_cast<unsigned short>(__rhs));
|
||||
_LIBCPP_HIDE_FROM_ABI inline constexpr copy_options operator&(copy_options __lhs, copy_options __rhs) {
|
||||
return static_cast<copy_options>(static_cast<unsigned short>(__lhs) & static_cast<unsigned short>(__rhs));
|
||||
}
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
inline constexpr copy_options operator|(copy_options __lhs, copy_options __rhs) {
|
||||
return static_cast<copy_options>(static_cast<unsigned short>(__lhs) |
|
||||
static_cast<unsigned short>(__rhs));
|
||||
_LIBCPP_HIDE_FROM_ABI inline constexpr copy_options operator|(copy_options __lhs, copy_options __rhs) {
|
||||
return static_cast<copy_options>(static_cast<unsigned short>(__lhs) | static_cast<unsigned short>(__rhs));
|
||||
}
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
inline constexpr copy_options operator^(copy_options __lhs, copy_options __rhs) {
|
||||
return static_cast<copy_options>(static_cast<unsigned short>(__lhs) ^
|
||||
static_cast<unsigned short>(__rhs));
|
||||
_LIBCPP_HIDE_FROM_ABI inline constexpr copy_options operator^(copy_options __lhs, copy_options __rhs) {
|
||||
return static_cast<copy_options>(static_cast<unsigned short>(__lhs) ^ static_cast<unsigned short>(__rhs));
|
||||
}
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
inline constexpr copy_options operator~(copy_options __lhs) {
|
||||
_LIBCPP_HIDE_FROM_ABI inline constexpr copy_options operator~(copy_options __lhs) {
|
||||
return static_cast<copy_options>(~static_cast<unsigned short>(__lhs));
|
||||
}
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
inline copy_options& operator&=(copy_options& __lhs, copy_options __rhs) {
|
||||
_LIBCPP_HIDE_FROM_ABI inline copy_options& operator&=(copy_options& __lhs, copy_options __rhs) {
|
||||
return __lhs = __lhs & __rhs;
|
||||
}
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
inline copy_options& operator|=(copy_options& __lhs, copy_options __rhs) {
|
||||
_LIBCPP_HIDE_FROM_ABI inline copy_options& operator|=(copy_options& __lhs, copy_options __rhs) {
|
||||
return __lhs = __lhs | __rhs;
|
||||
}
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
inline copy_options& operator^=(copy_options& __lhs, copy_options __rhs) {
|
||||
_LIBCPP_HIDE_FROM_ABI inline copy_options& operator^=(copy_options& __lhs, copy_options __rhs) {
|
||||
return __lhs = __lhs ^ __rhs;
|
||||
}
|
||||
|
||||
_LIBCPP_AVAILABILITY_FILESYSTEM_POP
|
||||
|
||||
_LIBCPP_END_NAMESPACE_FILESYSTEM
|
||||
|
||||
#endif // _LIBCPP_CXX03_LANG
|
||||
#endif // _LIBCPP_STD_VER >= 17
|
||||
|
||||
#endif // _LIBCPP___FILESYSTEM_COPY_OPTIONS_H
|
||||
|
|
287
third_party/libcxx/__filesystem/directory_entry.h
vendored
287
third_party/libcxx/__filesystem/directory_entry.h
vendored
|
@ -10,7 +10,6 @@
|
|||
#ifndef _LIBCPP___FILESYSTEM_DIRECTORY_ENTRY_H
|
||||
#define _LIBCPP___FILESYSTEM_DIRECTORY_ENTRY_H
|
||||
|
||||
#include <__availability>
|
||||
#include <__chrono/time_point.h>
|
||||
#include <__compare/ordering.h>
|
||||
#include <__config>
|
||||
|
@ -26,7 +25,6 @@
|
|||
#include <__utility/move.h>
|
||||
#include <__utility/unreachable.h>
|
||||
#include <cstdint>
|
||||
#include <iosfwd>
|
||||
|
||||
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
|
||||
# pragma GCC system_header
|
||||
|
@ -35,231 +33,160 @@
|
|||
_LIBCPP_PUSH_MACROS
|
||||
#include <__undef_macros>
|
||||
|
||||
#ifndef _LIBCPP_CXX03_LANG
|
||||
#if _LIBCPP_STD_VER >= 17 && !defined(_LIBCPP_HAS_NO_FILESYSTEM)
|
||||
|
||||
_LIBCPP_BEGIN_NAMESPACE_FILESYSTEM
|
||||
|
||||
_LIBCPP_AVAILABILITY_FILESYSTEM_PUSH
|
||||
|
||||
_LIBCPP_AVAILABILITY_FILESYSTEM_LIBRARY_PUSH
|
||||
|
||||
class directory_entry {
|
||||
typedef _VSTD_FS::path _Path;
|
||||
typedef filesystem::path _Path;
|
||||
|
||||
public:
|
||||
// constructors and destructors
|
||||
_LIBCPP_HIDE_FROM_ABI directory_entry() noexcept = default;
|
||||
_LIBCPP_HIDE_FROM_ABI directory_entry(directory_entry const&) = default;
|
||||
_LIBCPP_HIDE_FROM_ABI directory_entry() noexcept = default;
|
||||
_LIBCPP_HIDE_FROM_ABI directory_entry(directory_entry const&) = default;
|
||||
_LIBCPP_HIDE_FROM_ABI directory_entry(directory_entry&&) noexcept = default;
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
explicit directory_entry(_Path const& __p) : __p_(__p) {
|
||||
_LIBCPP_HIDE_FROM_ABI explicit directory_entry(_Path const& __p) : __p_(__p) {
|
||||
error_code __ec;
|
||||
__refresh(&__ec);
|
||||
}
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
directory_entry(_Path const& __p, error_code& __ec) : __p_(__p) {
|
||||
__refresh(&__ec);
|
||||
}
|
||||
_LIBCPP_HIDE_FROM_ABI directory_entry(_Path const& __p, error_code& __ec) : __p_(__p) { __refresh(&__ec); }
|
||||
|
||||
_LIBCPP_HIDE_FROM_ABI ~directory_entry() {}
|
||||
|
||||
_LIBCPP_HIDE_FROM_ABI directory_entry& operator=(directory_entry const&) = default;
|
||||
_LIBCPP_HIDE_FROM_ABI directory_entry& operator=(directory_entry const&) = default;
|
||||
_LIBCPP_HIDE_FROM_ABI directory_entry& operator=(directory_entry&&) noexcept = default;
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
void assign(_Path const& __p) {
|
||||
_LIBCPP_HIDE_FROM_ABI void assign(_Path const& __p) {
|
||||
__p_ = __p;
|
||||
error_code __ec;
|
||||
__refresh(&__ec);
|
||||
}
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
void assign(_Path const& __p, error_code& __ec) {
|
||||
_LIBCPP_HIDE_FROM_ABI void assign(_Path const& __p, error_code& __ec) {
|
||||
__p_ = __p;
|
||||
__refresh(&__ec);
|
||||
}
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
void replace_filename(_Path const& __p) {
|
||||
_LIBCPP_HIDE_FROM_ABI void replace_filename(_Path const& __p) {
|
||||
__p_.replace_filename(__p);
|
||||
error_code __ec;
|
||||
__refresh(&__ec);
|
||||
}
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
void replace_filename(_Path const& __p, error_code& __ec) {
|
||||
_LIBCPP_HIDE_FROM_ABI void replace_filename(_Path const& __p, error_code& __ec) {
|
||||
__p_ = __p_.parent_path() / __p;
|
||||
__refresh(&__ec);
|
||||
}
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
void refresh() { __refresh(); }
|
||||
_LIBCPP_HIDE_FROM_ABI void refresh() { __refresh(); }
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
void refresh(error_code& __ec) noexcept { __refresh(&__ec); }
|
||||
_LIBCPP_HIDE_FROM_ABI void refresh(error_code& __ec) noexcept { __refresh(&__ec); }
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
_Path const& path() const noexcept { return __p_; }
|
||||
_LIBCPP_HIDE_FROM_ABI _Path const& path() const noexcept { return __p_; }
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
operator const _Path&() const noexcept { return __p_; }
|
||||
_LIBCPP_HIDE_FROM_ABI operator const _Path&() const noexcept { return __p_; }
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
bool exists() const { return _VSTD_FS::exists(file_status{__get_ft()}); }
|
||||
_LIBCPP_HIDE_FROM_ABI bool exists() const { return filesystem::exists(file_status{__get_ft()}); }
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
bool exists(error_code& __ec) const noexcept {
|
||||
return _VSTD_FS::exists(file_status{__get_ft(&__ec)});
|
||||
_LIBCPP_HIDE_FROM_ABI bool exists(error_code& __ec) const noexcept {
|
||||
return filesystem::exists(file_status{__get_ft(&__ec)});
|
||||
}
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
bool is_block_file() const { return __get_ft() == file_type::block; }
|
||||
_LIBCPP_HIDE_FROM_ABI bool is_block_file() const { return __get_ft() == file_type::block; }
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
bool is_block_file(error_code& __ec) const noexcept {
|
||||
_LIBCPP_HIDE_FROM_ABI bool is_block_file(error_code& __ec) const noexcept {
|
||||
return __get_ft(&__ec) == file_type::block;
|
||||
}
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
bool is_character_file() const { return __get_ft() == file_type::character; }
|
||||
_LIBCPP_HIDE_FROM_ABI bool is_character_file() const { return __get_ft() == file_type::character; }
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
bool is_character_file(error_code& __ec) const noexcept {
|
||||
_LIBCPP_HIDE_FROM_ABI bool is_character_file(error_code& __ec) const noexcept {
|
||||
return __get_ft(&__ec) == file_type::character;
|
||||
}
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
bool is_directory() const { return __get_ft() == file_type::directory; }
|
||||
_LIBCPP_HIDE_FROM_ABI bool is_directory() const { return __get_ft() == file_type::directory; }
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
bool is_directory(error_code& __ec) const noexcept {
|
||||
_LIBCPP_HIDE_FROM_ABI bool is_directory(error_code& __ec) const noexcept {
|
||||
return __get_ft(&__ec) == file_type::directory;
|
||||
}
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
bool is_fifo() const { return __get_ft() == file_type::fifo; }
|
||||
_LIBCPP_HIDE_FROM_ABI bool is_fifo() const { return __get_ft() == file_type::fifo; }
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
bool is_fifo(error_code& __ec) const noexcept {
|
||||
return __get_ft(&__ec) == file_type::fifo;
|
||||
_LIBCPP_HIDE_FROM_ABI bool is_fifo(error_code& __ec) const noexcept { return __get_ft(&__ec) == file_type::fifo; }
|
||||
|
||||
_LIBCPP_HIDE_FROM_ABI bool is_other() const { return filesystem::is_other(file_status{__get_ft()}); }
|
||||
|
||||
_LIBCPP_HIDE_FROM_ABI bool is_other(error_code& __ec) const noexcept {
|
||||
return filesystem::is_other(file_status{__get_ft(&__ec)});
|
||||
}
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
bool is_other() const { return _VSTD_FS::is_other(file_status{__get_ft()}); }
|
||||
_LIBCPP_HIDE_FROM_ABI bool is_regular_file() const { return __get_ft() == file_type::regular; }
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
bool is_other(error_code& __ec) const noexcept {
|
||||
return _VSTD_FS::is_other(file_status{__get_ft(&__ec)});
|
||||
}
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
bool is_regular_file() const { return __get_ft() == file_type::regular; }
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
bool is_regular_file(error_code& __ec) const noexcept {
|
||||
_LIBCPP_HIDE_FROM_ABI bool is_regular_file(error_code& __ec) const noexcept {
|
||||
return __get_ft(&__ec) == file_type::regular;
|
||||
}
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
bool is_socket() const { return __get_ft() == file_type::socket; }
|
||||
_LIBCPP_HIDE_FROM_ABI bool is_socket() const { return __get_ft() == file_type::socket; }
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
bool is_socket(error_code& __ec) const noexcept {
|
||||
return __get_ft(&__ec) == file_type::socket;
|
||||
}
|
||||
_LIBCPP_HIDE_FROM_ABI bool is_socket(error_code& __ec) const noexcept { return __get_ft(&__ec) == file_type::socket; }
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
bool is_symlink() const { return __get_sym_ft() == file_type::symlink; }
|
||||
_LIBCPP_HIDE_FROM_ABI bool is_symlink() const { return __get_sym_ft() == file_type::symlink; }
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
bool is_symlink(error_code& __ec) const noexcept {
|
||||
_LIBCPP_HIDE_FROM_ABI bool is_symlink(error_code& __ec) const noexcept {
|
||||
return __get_sym_ft(&__ec) == file_type::symlink;
|
||||
}
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
uintmax_t file_size() const { return __get_size(); }
|
||||
_LIBCPP_HIDE_FROM_ABI uintmax_t file_size() const { return __get_size(); }
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
uintmax_t file_size(error_code& __ec) const noexcept {
|
||||
return __get_size(&__ec);
|
||||
}
|
||||
_LIBCPP_HIDE_FROM_ABI uintmax_t file_size(error_code& __ec) const noexcept { return __get_size(&__ec); }
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
uintmax_t hard_link_count() const { return __get_nlink(); }
|
||||
_LIBCPP_HIDE_FROM_ABI uintmax_t hard_link_count() const { return __get_nlink(); }
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
uintmax_t hard_link_count(error_code& __ec) const noexcept {
|
||||
return __get_nlink(&__ec);
|
||||
}
|
||||
_LIBCPP_HIDE_FROM_ABI uintmax_t hard_link_count(error_code& __ec) const noexcept { return __get_nlink(&__ec); }
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
file_time_type last_write_time() const { return __get_write_time(); }
|
||||
_LIBCPP_HIDE_FROM_ABI file_time_type last_write_time() const { return __get_write_time(); }
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
file_time_type last_write_time(error_code& __ec) const noexcept {
|
||||
_LIBCPP_HIDE_FROM_ABI file_time_type last_write_time(error_code& __ec) const noexcept {
|
||||
return __get_write_time(&__ec);
|
||||
}
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
file_status status() const { return __get_status(); }
|
||||
_LIBCPP_HIDE_FROM_ABI file_status status() const { return __get_status(); }
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
file_status status(error_code& __ec) const noexcept {
|
||||
return __get_status(&__ec);
|
||||
}
|
||||
_LIBCPP_HIDE_FROM_ABI file_status status(error_code& __ec) const noexcept { return __get_status(&__ec); }
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
file_status symlink_status() const { return __get_symlink_status(); }
|
||||
_LIBCPP_HIDE_FROM_ABI file_status symlink_status() const { return __get_symlink_status(); }
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
file_status symlink_status(error_code& __ec) const noexcept {
|
||||
_LIBCPP_HIDE_FROM_ABI file_status symlink_status(error_code& __ec) const noexcept {
|
||||
return __get_symlink_status(&__ec);
|
||||
}
|
||||
|
||||
_LIBCPP_HIDE_FROM_ABI bool operator==(directory_entry const& __rhs) const noexcept { return __p_ == __rhs.__p_; }
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
bool operator==(directory_entry const& __rhs) const noexcept {
|
||||
return __p_ == __rhs.__p_;
|
||||
}
|
||||
# if _LIBCPP_STD_VER <= 17
|
||||
_LIBCPP_HIDE_FROM_ABI bool operator!=(directory_entry const& __rhs) const noexcept { return __p_ != __rhs.__p_; }
|
||||
|
||||
#if _LIBCPP_STD_VER <= 17
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
bool operator!=(directory_entry const& __rhs) const noexcept {
|
||||
return __p_ != __rhs.__p_;
|
||||
}
|
||||
_LIBCPP_HIDE_FROM_ABI bool operator<(directory_entry const& __rhs) const noexcept { return __p_ < __rhs.__p_; }
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
bool operator<(directory_entry const& __rhs) const noexcept {
|
||||
return __p_ < __rhs.__p_;
|
||||
}
|
||||
_LIBCPP_HIDE_FROM_ABI bool operator<=(directory_entry const& __rhs) const noexcept { return __p_ <= __rhs.__p_; }
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
bool operator<=(directory_entry const& __rhs) const noexcept {
|
||||
return __p_ <= __rhs.__p_;
|
||||
}
|
||||
_LIBCPP_HIDE_FROM_ABI bool operator>(directory_entry const& __rhs) const noexcept { return __p_ > __rhs.__p_; }
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
bool operator>(directory_entry const& __rhs) const noexcept {
|
||||
return __p_ > __rhs.__p_;
|
||||
}
|
||||
_LIBCPP_HIDE_FROM_ABI bool operator>=(directory_entry const& __rhs) const noexcept { return __p_ >= __rhs.__p_; }
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
bool operator>=(directory_entry const& __rhs) const noexcept {
|
||||
return __p_ >= __rhs.__p_;
|
||||
}
|
||||
# else // _LIBCPP_STD_VER <= 17
|
||||
|
||||
#else // _LIBCPP_STD_VER <= 17
|
||||
|
||||
_LIBCPP_HIDE_FROM_ABI
|
||||
strong_ordering operator<=>(const directory_entry& __rhs) const noexcept {
|
||||
_LIBCPP_HIDE_FROM_ABI strong_ordering operator<=>(const directory_entry& __rhs) const noexcept {
|
||||
return __p_ <=> __rhs.__p_;
|
||||
}
|
||||
|
||||
#endif // _LIBCPP_STD_VER <= 17
|
||||
# endif // _LIBCPP_STD_VER <= 17
|
||||
|
||||
template <class _CharT, class _Traits>
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
friend basic_ostream<_CharT, _Traits>& operator<<(basic_ostream<_CharT, _Traits>& __os, const directory_entry& __d) {
|
||||
_LIBCPP_HIDE_FROM_ABI friend basic_ostream<_CharT, _Traits>&
|
||||
operator<<(basic_ostream<_CharT, _Traits>& __os, const directory_entry& __d) {
|
||||
return __os << __d.path();
|
||||
}
|
||||
|
||||
|
@ -286,23 +213,20 @@ private:
|
|||
file_type __type_;
|
||||
_CacheType __cache_type_;
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
__cached_data() noexcept { __reset(); }
|
||||
_LIBCPP_HIDE_FROM_ABI __cached_data() noexcept { __reset(); }
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
void __reset() {
|
||||
_LIBCPP_HIDE_FROM_ABI void __reset() {
|
||||
__cache_type_ = _Empty;
|
||||
__type_ = file_type::none;
|
||||
__type_ = file_type::none;
|
||||
__sym_perms_ = __non_sym_perms_ = perms::unknown;
|
||||
__size_ = __nlink_ = uintmax_t(-1);
|
||||
__write_time_ = file_time_type::min();
|
||||
__write_time_ = file_time_type::min();
|
||||
}
|
||||
};
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
static __cached_data __create_iter_result(file_type __ft) {
|
||||
_LIBCPP_HIDE_FROM_ABI static __cached_data __create_iter_result(file_type __ft) {
|
||||
__cached_data __data;
|
||||
__data.__type_ = __ft;
|
||||
__data.__type_ = __ft;
|
||||
__data.__cache_type_ = [&]() {
|
||||
switch (__ft) {
|
||||
case file_type::none:
|
||||
|
@ -316,17 +240,14 @@ private:
|
|||
return __data;
|
||||
}
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
void __assign_iter_entry(_Path&& __p, __cached_data __dt) {
|
||||
__p_ = _VSTD::move(__p);
|
||||
_LIBCPP_HIDE_FROM_ABI void __assign_iter_entry(_Path&& __p, __cached_data __dt) {
|
||||
__p_ = std::move(__p);
|
||||
__data_ = __dt;
|
||||
}
|
||||
|
||||
_LIBCPP_FUNC_VIS
|
||||
error_code __do_refresh() noexcept;
|
||||
_LIBCPP_EXPORTED_FROM_ABI error_code __do_refresh() noexcept;
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
static bool __is_dne_error(error_code const& __ec) {
|
||||
_LIBCPP_HIDE_FROM_ABI static bool __is_dne_error(error_code const& __ec) {
|
||||
if (!__ec)
|
||||
return true;
|
||||
switch (static_cast<errc>(__ec.value())) {
|
||||
|
@ -338,9 +259,8 @@ private:
|
|||
}
|
||||
}
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
void __handle_error(const char* __msg, error_code* __dest_ec,
|
||||
error_code const& __ec, bool __allow_dne = false) const {
|
||||
_LIBCPP_HIDE_FROM_ABI void
|
||||
__handle_error(const char* __msg, error_code* __dest_ec, error_code const& __ec, bool __allow_dne = false) const {
|
||||
if (__dest_ec) {
|
||||
*__dest_ec = __ec;
|
||||
return;
|
||||
|
@ -349,14 +269,14 @@ private:
|
|||
__throw_filesystem_error(__msg, __p_, __ec);
|
||||
}
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
void __refresh(error_code* __ec = nullptr) {
|
||||
__handle_error("in directory_entry::refresh", __ec, __do_refresh(),
|
||||
_LIBCPP_HIDE_FROM_ABI void __refresh(error_code* __ec = nullptr) {
|
||||
__handle_error("in directory_entry::refresh",
|
||||
__ec,
|
||||
__do_refresh(),
|
||||
/*allow_dne*/ true);
|
||||
}
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
file_type __get_sym_ft(error_code* __ec = nullptr) const {
|
||||
_LIBCPP_HIDE_FROM_ABI file_type __get_sym_ft(error_code* __ec = nullptr) const {
|
||||
switch (__data_.__cache_type_) {
|
||||
case _Empty:
|
||||
return __symlink_status(__p_, __ec).type();
|
||||
|
@ -369,7 +289,7 @@ private:
|
|||
case _IterNonSymlink:
|
||||
case _RefreshNonSymlink:
|
||||
file_status __st(__data_.__type_);
|
||||
if (__ec && !_VSTD_FS::exists(__st))
|
||||
if (__ec && !filesystem::exists(__st))
|
||||
*__ec = make_error_code(errc::no_such_file_or_directory);
|
||||
else if (__ec)
|
||||
__ec->clear();
|
||||
|
@ -378,8 +298,7 @@ private:
|
|||
__libcpp_unreachable();
|
||||
}
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
file_type __get_ft(error_code* __ec = nullptr) const {
|
||||
_LIBCPP_HIDE_FROM_ABI file_type __get_ft(error_code* __ec = nullptr) const {
|
||||
switch (__data_.__cache_type_) {
|
||||
case _Empty:
|
||||
case _IterSymlink:
|
||||
|
@ -389,7 +308,7 @@ private:
|
|||
case _RefreshNonSymlink:
|
||||
case _RefreshSymlink: {
|
||||
file_status __st(__data_.__type_);
|
||||
if (__ec && !_VSTD_FS::exists(__st))
|
||||
if (__ec && !filesystem::exists(__st))
|
||||
*__ec = make_error_code(errc::no_such_file_or_directory);
|
||||
else if (__ec)
|
||||
__ec->clear();
|
||||
|
@ -399,8 +318,7 @@ private:
|
|||
__libcpp_unreachable();
|
||||
}
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
file_status __get_status(error_code* __ec = nullptr) const {
|
||||
_LIBCPP_HIDE_FROM_ABI file_status __get_status(error_code* __ec = nullptr) const {
|
||||
switch (__data_.__cache_type_) {
|
||||
case _Empty:
|
||||
case _IterNonSymlink:
|
||||
|
@ -414,8 +332,7 @@ private:
|
|||
__libcpp_unreachable();
|
||||
}
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
file_status __get_symlink_status(error_code* __ec = nullptr) const {
|
||||
_LIBCPP_HIDE_FROM_ABI file_status __get_symlink_status(error_code* __ec = nullptr) const {
|
||||
switch (__data_.__cache_type_) {
|
||||
case _Empty:
|
||||
case _IterNonSymlink:
|
||||
|
@ -430,24 +347,21 @@ private:
|
|||
__libcpp_unreachable();
|
||||
}
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
uintmax_t __get_size(error_code* __ec = nullptr) const {
|
||||
_LIBCPP_HIDE_FROM_ABI uintmax_t __get_size(error_code* __ec = nullptr) const {
|
||||
switch (__data_.__cache_type_) {
|
||||
case _Empty:
|
||||
case _IterNonSymlink:
|
||||
case _IterSymlink:
|
||||
case _RefreshSymlinkUnresolved:
|
||||
return _VSTD_FS::__file_size(__p_, __ec);
|
||||
return filesystem::__file_size(__p_, __ec);
|
||||
case _RefreshSymlink:
|
||||
case _RefreshNonSymlink: {
|
||||
error_code __m_ec;
|
||||
file_status __st(__get_ft(&__m_ec));
|
||||
__handle_error("in directory_entry::file_size", __ec, __m_ec);
|
||||
if (_VSTD_FS::exists(__st) && !_VSTD_FS::is_regular_file(__st)) {
|
||||
errc __err_kind = _VSTD_FS::is_directory(__st) ? errc::is_a_directory
|
||||
: errc::not_supported;
|
||||
__handle_error("in directory_entry::file_size", __ec,
|
||||
make_error_code(__err_kind));
|
||||
if (filesystem::exists(__st) && !filesystem::is_regular_file(__st)) {
|
||||
errc __err_kind = filesystem::is_directory(__st) ? errc::is_a_directory : errc::not_supported;
|
||||
__handle_error("in directory_entry::file_size", __ec, make_error_code(__err_kind));
|
||||
}
|
||||
return __data_.__size_;
|
||||
}
|
||||
|
@ -455,14 +369,13 @@ private:
|
|||
__libcpp_unreachable();
|
||||
}
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
uintmax_t __get_nlink(error_code* __ec = nullptr) const {
|
||||
_LIBCPP_HIDE_FROM_ABI uintmax_t __get_nlink(error_code* __ec = nullptr) const {
|
||||
switch (__data_.__cache_type_) {
|
||||
case _Empty:
|
||||
case _IterNonSymlink:
|
||||
case _IterSymlink:
|
||||
case _RefreshSymlinkUnresolved:
|
||||
return _VSTD_FS::__hard_link_count(__p_, __ec);
|
||||
return filesystem::__hard_link_count(__p_, __ec);
|
||||
case _RefreshSymlink:
|
||||
case _RefreshNonSymlink: {
|
||||
error_code __m_ec;
|
||||
|
@ -474,23 +387,20 @@ private:
|
|||
__libcpp_unreachable();
|
||||
}
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
file_time_type __get_write_time(error_code* __ec = nullptr) const {
|
||||
_LIBCPP_HIDE_FROM_ABI file_time_type __get_write_time(error_code* __ec = nullptr) const {
|
||||
switch (__data_.__cache_type_) {
|
||||
case _Empty:
|
||||
case _IterNonSymlink:
|
||||
case _IterSymlink:
|
||||
case _RefreshSymlinkUnresolved:
|
||||
return _VSTD_FS::__last_write_time(__p_, __ec);
|
||||
return filesystem::__last_write_time(__p_, __ec);
|
||||
case _RefreshSymlink:
|
||||
case _RefreshNonSymlink: {
|
||||
error_code __m_ec;
|
||||
file_status __st(__get_ft(&__m_ec));
|
||||
__handle_error("in directory_entry::last_write_time", __ec, __m_ec);
|
||||
if (_VSTD_FS::exists(__st) &&
|
||||
__data_.__write_time_ == file_time_type::min())
|
||||
__handle_error("in directory_entry::last_write_time", __ec,
|
||||
make_error_code(errc::value_too_large));
|
||||
if (filesystem::exists(__st) && __data_.__write_time_ == file_time_type::min())
|
||||
__handle_error("in directory_entry::last_write_time", __ec, make_error_code(errc::value_too_large));
|
||||
return __data_.__write_time_;
|
||||
}
|
||||
}
|
||||
|
@ -504,24 +414,21 @@ private:
|
|||
|
||||
class __dir_element_proxy {
|
||||
public:
|
||||
inline _LIBCPP_INLINE_VISIBILITY directory_entry operator*() {
|
||||
return _VSTD::move(__elem_);
|
||||
}
|
||||
inline _LIBCPP_HIDE_FROM_ABI directory_entry operator*() { return std::move(__elem_); }
|
||||
|
||||
private:
|
||||
friend class directory_iterator;
|
||||
friend class recursive_directory_iterator;
|
||||
_LIBCPP_HIDE_FROM_ABI explicit __dir_element_proxy(directory_entry const& __e) : __elem_(__e) {}
|
||||
_LIBCPP_HIDE_FROM_ABI __dir_element_proxy(__dir_element_proxy&& __o)
|
||||
: __elem_(_VSTD::move(__o.__elem_)) {}
|
||||
_LIBCPP_HIDE_FROM_ABI __dir_element_proxy(__dir_element_proxy&& __o) : __elem_(std::move(__o.__elem_)) {}
|
||||
directory_entry __elem_;
|
||||
};
|
||||
|
||||
_LIBCPP_AVAILABILITY_FILESYSTEM_POP
|
||||
_LIBCPP_AVAILABILITY_FILESYSTEM_LIBRARY_POP
|
||||
|
||||
_LIBCPP_END_NAMESPACE_FILESYSTEM
|
||||
|
||||
#endif // _LIBCPP_CXX03_LANG
|
||||
#endif // _LIBCPP_STD_VER >= 17 && !defined(_LIBCPP_HAS_NO_FILESYSTEM)
|
||||
|
||||
_LIBCPP_POP_MACROS
|
||||
|
||||
|
|
109
third_party/libcxx/__filesystem/directory_iterator.h
vendored
109
third_party/libcxx/__filesystem/directory_iterator.h
vendored
|
@ -11,11 +11,11 @@
|
|||
#define _LIBCPP___FILESYSTEM_DIRECTORY_ITERATOR_H
|
||||
|
||||
#include <__assert>
|
||||
#include <__availability>
|
||||
#include <__config>
|
||||
#include <__filesystem/directory_entry.h>
|
||||
#include <__filesystem/directory_options.h>
|
||||
#include <__filesystem/path.h>
|
||||
#include <__iterator/default_sentinel.h>
|
||||
#include <__iterator/iterator_traits.h>
|
||||
#include <__memory/shared_ptr.h>
|
||||
#include <__ranges/enable_borrowed_range.h>
|
||||
|
@ -28,11 +28,14 @@
|
|||
# pragma GCC system_header
|
||||
#endif
|
||||
|
||||
#ifndef _LIBCPP_CXX03_LANG
|
||||
_LIBCPP_PUSH_MACROS
|
||||
#include <__undef_macros>
|
||||
|
||||
#if _LIBCPP_STD_VER >= 17 && !defined(_LIBCPP_HAS_NO_FILESYSTEM)
|
||||
|
||||
_LIBCPP_BEGIN_NAMESPACE_FILESYSTEM
|
||||
|
||||
_LIBCPP_AVAILABILITY_FILESYSTEM_PUSH
|
||||
_LIBCPP_AVAILABILITY_FILESYSTEM_LIBRARY_PUSH
|
||||
|
||||
class _LIBCPP_HIDDEN __dir_stream;
|
||||
class directory_iterator {
|
||||
|
@ -44,123 +47,105 @@ public:
|
|||
typedef input_iterator_tag iterator_category;
|
||||
|
||||
public:
|
||||
//ctor & dtor
|
||||
_LIBCPP_HIDE_FROM_ABI
|
||||
directory_iterator() noexcept {}
|
||||
// ctor & dtor
|
||||
_LIBCPP_HIDE_FROM_ABI directory_iterator() noexcept {}
|
||||
|
||||
_LIBCPP_HIDE_FROM_ABI
|
||||
explicit directory_iterator(const path& __p)
|
||||
: directory_iterator(__p, nullptr) {}
|
||||
_LIBCPP_HIDE_FROM_ABI explicit directory_iterator(const path& __p) : directory_iterator(__p, nullptr) {}
|
||||
|
||||
_LIBCPP_HIDE_FROM_ABI
|
||||
directory_iterator(const path& __p, directory_options __opts)
|
||||
_LIBCPP_HIDE_FROM_ABI directory_iterator(const path& __p, directory_options __opts)
|
||||
: directory_iterator(__p, nullptr, __opts) {}
|
||||
|
||||
_LIBCPP_HIDE_FROM_ABI
|
||||
directory_iterator(const path& __p, error_code& __ec)
|
||||
: directory_iterator(__p, &__ec) {}
|
||||
_LIBCPP_HIDE_FROM_ABI directory_iterator(const path& __p, error_code& __ec) : directory_iterator(__p, &__ec) {}
|
||||
|
||||
_LIBCPP_HIDE_FROM_ABI
|
||||
directory_iterator(const path& __p, directory_options __opts,
|
||||
error_code& __ec)
|
||||
_LIBCPP_HIDE_FROM_ABI directory_iterator(const path& __p, directory_options __opts, error_code& __ec)
|
||||
: directory_iterator(__p, &__ec, __opts) {}
|
||||
|
||||
_LIBCPP_HIDE_FROM_ABI directory_iterator(const directory_iterator&) = default;
|
||||
_LIBCPP_HIDE_FROM_ABI directory_iterator(directory_iterator&&) = default;
|
||||
_LIBCPP_HIDE_FROM_ABI directory_iterator(const directory_iterator&) = default;
|
||||
_LIBCPP_HIDE_FROM_ABI directory_iterator(directory_iterator&&) = default;
|
||||
_LIBCPP_HIDE_FROM_ABI directory_iterator& operator=(const directory_iterator&) = default;
|
||||
|
||||
_LIBCPP_HIDE_FROM_ABI
|
||||
directory_iterator& operator=(directory_iterator&& __o) noexcept {
|
||||
_LIBCPP_HIDE_FROM_ABI directory_iterator& operator=(directory_iterator&& __o) noexcept {
|
||||
// non-default implementation provided to support self-move assign.
|
||||
if (this != &__o) {
|
||||
__imp_ = _VSTD::move(__o.__imp_);
|
||||
__imp_ = std::move(__o.__imp_);
|
||||
}
|
||||
return *this;
|
||||
}
|
||||
|
||||
_LIBCPP_HIDE_FROM_ABI ~directory_iterator() = default;
|
||||
|
||||
_LIBCPP_HIDE_FROM_ABI
|
||||
const directory_entry& operator*() const {
|
||||
_LIBCPP_ASSERT(__imp_, "The end iterator cannot be dereferenced");
|
||||
_LIBCPP_HIDE_FROM_ABI const directory_entry& operator*() const {
|
||||
// Note: this check duplicates a check in `__dereference()`.
|
||||
_LIBCPP_ASSERT_NON_NULL(__imp_, "The end iterator cannot be dereferenced");
|
||||
return __dereference();
|
||||
}
|
||||
|
||||
_LIBCPP_HIDE_FROM_ABI
|
||||
const directory_entry* operator->() const { return &**this; }
|
||||
_LIBCPP_HIDE_FROM_ABI const directory_entry* operator->() const { return &**this; }
|
||||
|
||||
_LIBCPP_HIDE_FROM_ABI
|
||||
directory_iterator& operator++() { return __increment(); }
|
||||
_LIBCPP_HIDE_FROM_ABI directory_iterator& operator++() { return __increment(); }
|
||||
|
||||
_LIBCPP_HIDE_FROM_ABI
|
||||
__dir_element_proxy operator++(int) {
|
||||
_LIBCPP_HIDE_FROM_ABI __dir_element_proxy operator++(int) {
|
||||
__dir_element_proxy __p(**this);
|
||||
__increment();
|
||||
return __p;
|
||||
}
|
||||
|
||||
_LIBCPP_HIDE_FROM_ABI
|
||||
directory_iterator& increment(error_code& __ec) { return __increment(&__ec); }
|
||||
_LIBCPP_HIDE_FROM_ABI directory_iterator& increment(error_code& __ec) { return __increment(&__ec); }
|
||||
|
||||
# if _LIBCPP_STD_VER >= 20
|
||||
|
||||
_LIBCPP_HIDE_FROM_ABI bool operator==(default_sentinel_t) const noexcept { return *this == directory_iterator(); }
|
||||
|
||||
# endif
|
||||
|
||||
private:
|
||||
inline _LIBCPP_HIDE_FROM_ABI friend bool
|
||||
operator==(const directory_iterator& __lhs,
|
||||
const directory_iterator& __rhs) noexcept;
|
||||
operator==(const directory_iterator& __lhs, const directory_iterator& __rhs) noexcept;
|
||||
|
||||
// construct the dir_stream
|
||||
_LIBCPP_FUNC_VIS
|
||||
directory_iterator(const path&, error_code*,
|
||||
directory_options = directory_options::none);
|
||||
_LIBCPP_EXPORTED_FROM_ABI directory_iterator(const path&, error_code*, directory_options = directory_options::none);
|
||||
|
||||
_LIBCPP_FUNC_VIS
|
||||
directory_iterator& __increment(error_code* __ec = nullptr);
|
||||
_LIBCPP_EXPORTED_FROM_ABI directory_iterator& __increment(error_code* __ec = nullptr);
|
||||
|
||||
_LIBCPP_FUNC_VIS
|
||||
const directory_entry& __dereference() const;
|
||||
_LIBCPP_EXPORTED_FROM_ABI const directory_entry& __dereference() const;
|
||||
|
||||
private:
|
||||
shared_ptr<__dir_stream> __imp_;
|
||||
};
|
||||
|
||||
inline _LIBCPP_HIDE_FROM_ABI bool
|
||||
operator==(const directory_iterator& __lhs,
|
||||
const directory_iterator& __rhs) noexcept {
|
||||
operator==(const directory_iterator& __lhs, const directory_iterator& __rhs) noexcept {
|
||||
return __lhs.__imp_ == __rhs.__imp_;
|
||||
}
|
||||
|
||||
inline _LIBCPP_HIDE_FROM_ABI bool
|
||||
operator!=(const directory_iterator& __lhs,
|
||||
const directory_iterator& __rhs) noexcept {
|
||||
operator!=(const directory_iterator& __lhs, const directory_iterator& __rhs) noexcept {
|
||||
return !(__lhs == __rhs);
|
||||
}
|
||||
|
||||
// enable directory_iterator range-based for statements
|
||||
inline _LIBCPP_HIDE_FROM_ABI directory_iterator
|
||||
begin(directory_iterator __iter) noexcept {
|
||||
return __iter;
|
||||
}
|
||||
inline _LIBCPP_HIDE_FROM_ABI directory_iterator begin(directory_iterator __iter) noexcept { return __iter; }
|
||||
|
||||
inline _LIBCPP_HIDE_FROM_ABI directory_iterator
|
||||
end(directory_iterator) noexcept {
|
||||
return directory_iterator();
|
||||
}
|
||||
inline _LIBCPP_HIDE_FROM_ABI directory_iterator end(directory_iterator) noexcept { return directory_iterator(); }
|
||||
|
||||
_LIBCPP_AVAILABILITY_FILESYSTEM_POP
|
||||
_LIBCPP_AVAILABILITY_FILESYSTEM_LIBRARY_POP
|
||||
|
||||
_LIBCPP_END_NAMESPACE_FILESYSTEM
|
||||
|
||||
#if _LIBCPP_STD_VER >= 20
|
||||
# if _LIBCPP_STD_VER >= 20
|
||||
|
||||
template <>
|
||||
_LIBCPP_AVAILABILITY_FILESYSTEM
|
||||
inline constexpr bool _VSTD::ranges::enable_borrowed_range<_VSTD_FS::directory_iterator> = true;
|
||||
_LIBCPP_AVAILABILITY_FILESYSTEM_LIBRARY inline constexpr bool
|
||||
std::ranges::enable_borrowed_range<std::filesystem::directory_iterator> = true;
|
||||
|
||||
template <>
|
||||
_LIBCPP_AVAILABILITY_FILESYSTEM
|
||||
inline constexpr bool _VSTD::ranges::enable_view<_VSTD_FS::directory_iterator> = true;
|
||||
_LIBCPP_AVAILABILITY_FILESYSTEM_LIBRARY inline constexpr bool
|
||||
std::ranges::enable_view<std::filesystem::directory_iterator> = true;
|
||||
|
||||
#endif // _LIBCPP_STD_VER >= 20
|
||||
# endif // _LIBCPP_STD_VER >= 20
|
||||
|
||||
#endif // _LIBCPP_CXX03_LANG
|
||||
#endif // _LIBCPP_STD_VER >= 17 && !defined(_LIBCPP_HAS_NO_FILESYSTEM)
|
||||
|
||||
_LIBCPP_POP_MACROS
|
||||
|
||||
#endif // _LIBCPP___FILESYSTEM_DIRECTORY_ITERATOR_H
|
||||
|
|
|
@ -10,73 +10,48 @@
|
|||
#ifndef _LIBCPP___FILESYSTEM_DIRECTORY_OPTIONS_H
|
||||
#define _LIBCPP___FILESYSTEM_DIRECTORY_OPTIONS_H
|
||||
|
||||
#include <__availability>
|
||||
#include <__config>
|
||||
|
||||
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
|
||||
# pragma GCC system_header
|
||||
#endif
|
||||
|
||||
#ifndef _LIBCPP_CXX03_LANG
|
||||
#if _LIBCPP_STD_VER >= 17
|
||||
|
||||
_LIBCPP_BEGIN_NAMESPACE_FILESYSTEM
|
||||
|
||||
_LIBCPP_AVAILABILITY_FILESYSTEM_PUSH
|
||||
enum class directory_options : unsigned char { none = 0, follow_directory_symlink = 1, skip_permission_denied = 2 };
|
||||
|
||||
enum class _LIBCPP_ENUM_VIS directory_options : unsigned char {
|
||||
none = 0,
|
||||
follow_directory_symlink = 1,
|
||||
skip_permission_denied = 2
|
||||
};
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
inline constexpr directory_options operator&(directory_options __lhs,
|
||||
directory_options __rhs) {
|
||||
return static_cast<directory_options>(static_cast<unsigned char>(__lhs) &
|
||||
static_cast<unsigned char>(__rhs));
|
||||
_LIBCPP_HIDE_FROM_ABI inline constexpr directory_options operator&(directory_options __lhs, directory_options __rhs) {
|
||||
return static_cast<directory_options>(static_cast<unsigned char>(__lhs) & static_cast<unsigned char>(__rhs));
|
||||
}
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
inline constexpr directory_options operator|(directory_options __lhs,
|
||||
directory_options __rhs) {
|
||||
return static_cast<directory_options>(static_cast<unsigned char>(__lhs) |
|
||||
static_cast<unsigned char>(__rhs));
|
||||
_LIBCPP_HIDE_FROM_ABI inline constexpr directory_options operator|(directory_options __lhs, directory_options __rhs) {
|
||||
return static_cast<directory_options>(static_cast<unsigned char>(__lhs) | static_cast<unsigned char>(__rhs));
|
||||
}
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
inline constexpr directory_options operator^(directory_options __lhs,
|
||||
directory_options __rhs) {
|
||||
return static_cast<directory_options>(static_cast<unsigned char>(__lhs) ^
|
||||
static_cast<unsigned char>(__rhs));
|
||||
_LIBCPP_HIDE_FROM_ABI inline constexpr directory_options operator^(directory_options __lhs, directory_options __rhs) {
|
||||
return static_cast<directory_options>(static_cast<unsigned char>(__lhs) ^ static_cast<unsigned char>(__rhs));
|
||||
}
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
inline constexpr directory_options operator~(directory_options __lhs) {
|
||||
_LIBCPP_HIDE_FROM_ABI inline constexpr directory_options operator~(directory_options __lhs) {
|
||||
return static_cast<directory_options>(~static_cast<unsigned char>(__lhs));
|
||||
}
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
inline directory_options& operator&=(directory_options& __lhs,
|
||||
directory_options __rhs) {
|
||||
_LIBCPP_HIDE_FROM_ABI inline directory_options& operator&=(directory_options& __lhs, directory_options __rhs) {
|
||||
return __lhs = __lhs & __rhs;
|
||||
}
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
inline directory_options& operator|=(directory_options& __lhs,
|
||||
directory_options __rhs) {
|
||||
_LIBCPP_HIDE_FROM_ABI inline directory_options& operator|=(directory_options& __lhs, directory_options __rhs) {
|
||||
return __lhs = __lhs | __rhs;
|
||||
}
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
inline directory_options& operator^=(directory_options& __lhs,
|
||||
directory_options __rhs) {
|
||||
_LIBCPP_HIDE_FROM_ABI inline directory_options& operator^=(directory_options& __lhs, directory_options __rhs) {
|
||||
return __lhs = __lhs ^ __rhs;
|
||||
}
|
||||
|
||||
_LIBCPP_AVAILABILITY_FILESYSTEM_POP
|
||||
|
||||
_LIBCPP_END_NAMESPACE_FILESYSTEM
|
||||
|
||||
#endif // _LIBCPP_CXX03_LANG
|
||||
#endif // _LIBCPP_STD_VER >= 17
|
||||
|
||||
#endif // _LIBCPP___FILESYSTEM_DIRECTORY_OPTIONS_H
|
||||
|
|
47
third_party/libcxx/__filesystem/file_status.h
vendored
47
third_party/libcxx/__filesystem/file_status.h
vendored
|
@ -10,7 +10,6 @@
|
|||
#ifndef _LIBCPP___FILESYSTEM_FILE_STATUS_H
|
||||
#define _LIBCPP___FILESYSTEM_FILE_STATUS_H
|
||||
|
||||
#include <__availability>
|
||||
#include <__config>
|
||||
#include <__filesystem/file_type.h>
|
||||
#include <__filesystem/perms.h>
|
||||
|
@ -19,54 +18,50 @@
|
|||
# pragma GCC system_header
|
||||
#endif
|
||||
|
||||
#ifndef _LIBCPP_CXX03_LANG
|
||||
#if _LIBCPP_STD_VER >= 17
|
||||
|
||||
_LIBCPP_BEGIN_NAMESPACE_FILESYSTEM
|
||||
|
||||
_LIBCPP_AVAILABILITY_FILESYSTEM_PUSH
|
||||
|
||||
class _LIBCPP_TYPE_VIS file_status {
|
||||
class _LIBCPP_EXPORTED_FROM_ABI file_status {
|
||||
public:
|
||||
// constructors
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
file_status() noexcept : file_status(file_type::none) {}
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
explicit file_status(file_type __ft, perms __prms = perms::unknown) noexcept
|
||||
: __ft_(__ft),
|
||||
__prms_(__prms) {}
|
||||
_LIBCPP_HIDE_FROM_ABI file_status() noexcept : file_status(file_type::none) {}
|
||||
_LIBCPP_HIDE_FROM_ABI explicit file_status(file_type __ft, perms __prms = perms::unknown) noexcept
|
||||
: __ft_(__ft), __prms_(__prms) {}
|
||||
|
||||
_LIBCPP_HIDE_FROM_ABI file_status(const file_status&) noexcept = default;
|
||||
_LIBCPP_HIDE_FROM_ABI file_status(file_status&&) noexcept = default;
|
||||
_LIBCPP_HIDE_FROM_ABI file_status(file_status&&) noexcept = default;
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
~file_status() {}
|
||||
_LIBCPP_HIDE_FROM_ABI ~file_status() {}
|
||||
|
||||
_LIBCPP_HIDE_FROM_ABI file_status& operator=(const file_status&) noexcept = default;
|
||||
_LIBCPP_HIDE_FROM_ABI file_status& operator=(file_status&&) noexcept = default;
|
||||
_LIBCPP_HIDE_FROM_ABI file_status& operator=(file_status&&) noexcept = default;
|
||||
|
||||
// observers
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
file_type type() const noexcept { return __ft_; }
|
||||
_LIBCPP_HIDE_FROM_ABI file_type type() const noexcept { return __ft_; }
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
perms permissions() const noexcept { return __prms_; }
|
||||
_LIBCPP_HIDE_FROM_ABI perms permissions() const noexcept { return __prms_; }
|
||||
|
||||
// modifiers
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
void type(file_type __ft) noexcept { __ft_ = __ft; }
|
||||
_LIBCPP_HIDE_FROM_ABI void type(file_type __ft) noexcept { __ft_ = __ft; }
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
void permissions(perms __p) noexcept { __prms_ = __p; }
|
||||
_LIBCPP_HIDE_FROM_ABI void permissions(perms __p) noexcept { __prms_ = __p; }
|
||||
|
||||
# if _LIBCPP_STD_VER >= 20
|
||||
|
||||
_LIBCPP_HIDE_FROM_ABI friend bool operator==(const file_status& __lhs, const file_status& __rhs) noexcept {
|
||||
return __lhs.type() == __rhs.type() && __lhs.permissions() == __rhs.permissions();
|
||||
}
|
||||
|
||||
# endif
|
||||
|
||||
private:
|
||||
file_type __ft_;
|
||||
perms __prms_;
|
||||
};
|
||||
|
||||
_LIBCPP_AVAILABILITY_FILESYSTEM_POP
|
||||
|
||||
_LIBCPP_END_NAMESPACE_FILESYSTEM
|
||||
|
||||
#endif // _LIBCPP_CXX03_LANG
|
||||
#endif // _LIBCPP_STD_VER >= 17
|
||||
|
||||
#endif // _LIBCPP___FILESYSTEM_FILE_STATUS_H
|
||||
|
|
|
@ -10,7 +10,6 @@
|
|||
#ifndef _LIBCPP___FILESYSTEM_FILE_TIME_TYPE_H
|
||||
#define _LIBCPP___FILESYSTEM_FILE_TIME_TYPE_H
|
||||
|
||||
#include <__availability>
|
||||
#include <__chrono/file_clock.h>
|
||||
#include <__chrono/time_point.h>
|
||||
#include <__config>
|
||||
|
@ -19,7 +18,7 @@
|
|||
# pragma GCC system_header
|
||||
#endif
|
||||
|
||||
#ifndef _LIBCPP_CXX03_LANG
|
||||
#if _LIBCPP_STD_VER >= 17
|
||||
|
||||
_LIBCPP_BEGIN_NAMESPACE_FILESYSTEM
|
||||
|
||||
|
@ -27,6 +26,6 @@ typedef chrono::time_point<_FilesystemClock> file_time_type;
|
|||
|
||||
_LIBCPP_END_NAMESPACE_FILESYSTEM
|
||||
|
||||
#endif // _LIBCPP_CXX03_LANG
|
||||
#endif // _LIBCPP_STD_VER >= 17
|
||||
|
||||
#endif // _LIBCPP___FILESYSTEM_FILE_TIME_TYPE_H
|
||||
|
|
21
third_party/libcxx/__filesystem/file_type.h
vendored
21
third_party/libcxx/__filesystem/file_type.h
vendored
|
@ -10,34 +10,33 @@
|
|||
#ifndef _LIBCPP___FILESYSTEM_FILE_TYPE_H
|
||||
#define _LIBCPP___FILESYSTEM_FILE_TYPE_H
|
||||
|
||||
#include <__availability>
|
||||
#include <__config>
|
||||
|
||||
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
|
||||
# pragma GCC system_header
|
||||
#endif
|
||||
|
||||
#ifndef _LIBCPP_CXX03_LANG
|
||||
#if _LIBCPP_STD_VER >= 17
|
||||
|
||||
_LIBCPP_BEGIN_NAMESPACE_FILESYSTEM
|
||||
|
||||
// On Windows, the library never identifies files as block, character, fifo
|
||||
// or socket.
|
||||
enum class _LIBCPP_ENUM_VIS file_type : signed char {
|
||||
none = 0,
|
||||
enum class file_type : signed char {
|
||||
none = 0,
|
||||
not_found = -1,
|
||||
regular = 1,
|
||||
regular = 1,
|
||||
directory = 2,
|
||||
symlink = 3,
|
||||
block = 4,
|
||||
symlink = 3,
|
||||
block = 4,
|
||||
character = 5,
|
||||
fifo = 6,
|
||||
socket = 7,
|
||||
unknown = 8
|
||||
fifo = 6,
|
||||
socket = 7,
|
||||
unknown = 8
|
||||
};
|
||||
|
||||
_LIBCPP_END_NAMESPACE_FILESYSTEM
|
||||
|
||||
#endif // _LIBCPP_CXX03_LANG
|
||||
#endif // _LIBCPP_STD_VER >= 17
|
||||
|
||||
#endif // _LIBCPP___FILESYSTEM_FILE_TYPE_H
|
||||
|
|
|
@ -10,7 +10,6 @@
|
|||
#ifndef _LIBCPP___FILESYSTEM_FILESYSTEM_ERROR_H
|
||||
#define _LIBCPP___FILESYSTEM_FILESYSTEM_ERROR_H
|
||||
|
||||
#include <__availability>
|
||||
#include <__config>
|
||||
#include <__filesystem/path.h>
|
||||
#include <__memory/shared_ptr.h>
|
||||
|
@ -18,62 +17,48 @@
|
|||
#include <__system_error/system_error.h>
|
||||
#include <__utility/forward.h>
|
||||
#include <__verbose_abort>
|
||||
#include <iosfwd>
|
||||
#include <new>
|
||||
#include <string>
|
||||
|
||||
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
|
||||
# pragma GCC system_header
|
||||
#endif
|
||||
|
||||
#ifndef _LIBCPP_CXX03_LANG
|
||||
#if _LIBCPP_STD_VER >= 17
|
||||
|
||||
_LIBCPP_BEGIN_NAMESPACE_FILESYSTEM
|
||||
|
||||
class _LIBCPP_AVAILABILITY_FILESYSTEM _LIBCPP_EXCEPTION_ABI filesystem_error : public system_error {
|
||||
class _LIBCPP_AVAILABILITY_FILESYSTEM_LIBRARY _LIBCPP_EXPORTED_FROM_ABI filesystem_error : public system_error {
|
||||
public:
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
filesystem_error(const string& __what, error_code __ec)
|
||||
: system_error(__ec, __what),
|
||||
__storage_(make_shared<_Storage>(path(), path())) {
|
||||
_LIBCPP_HIDE_FROM_ABI filesystem_error(const string& __what, error_code __ec)
|
||||
: system_error(__ec, __what), __storage_(make_shared<_Storage>(path(), path())) {
|
||||
__create_what(0);
|
||||
}
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
filesystem_error(const string& __what, const path& __p1, error_code __ec)
|
||||
: system_error(__ec, __what),
|
||||
__storage_(make_shared<_Storage>(__p1, path())) {
|
||||
_LIBCPP_HIDE_FROM_ABI filesystem_error(const string& __what, const path& __p1, error_code __ec)
|
||||
: system_error(__ec, __what), __storage_(make_shared<_Storage>(__p1, path())) {
|
||||
__create_what(1);
|
||||
}
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
filesystem_error(const string& __what, const path& __p1, const path& __p2,
|
||||
error_code __ec)
|
||||
: system_error(__ec, __what),
|
||||
__storage_(make_shared<_Storage>(__p1, __p2)) {
|
||||
_LIBCPP_HIDE_FROM_ABI filesystem_error(const string& __what, const path& __p1, const path& __p2, error_code __ec)
|
||||
: system_error(__ec, __what), __storage_(make_shared<_Storage>(__p1, __p2)) {
|
||||
__create_what(2);
|
||||
}
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
const path& path1() const noexcept { return __storage_->__p1_; }
|
||||
_LIBCPP_HIDE_FROM_ABI const path& path1() const noexcept { return __storage_->__p1_; }
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
const path& path2() const noexcept { return __storage_->__p2_; }
|
||||
_LIBCPP_HIDE_FROM_ABI const path& path2() const noexcept { return __storage_->__p2_; }
|
||||
|
||||
_LIBCPP_HIDE_FROM_ABI filesystem_error(const filesystem_error&) = default;
|
||||
~filesystem_error() override; // key function
|
||||
|
||||
_LIBCPP_HIDE_FROM_ABI_VIRTUAL
|
||||
const char* what() const noexcept override {
|
||||
return __storage_->__what_.c_str();
|
||||
}
|
||||
const char* what() const noexcept override { return __storage_->__what_.c_str(); }
|
||||
|
||||
void __create_what(int __num_paths);
|
||||
|
||||
private:
|
||||
struct _LIBCPP_HIDDEN _Storage {
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
_Storage(const path& __p1, const path& __p2) : __p1_(__p1), __p2_(__p2) {}
|
||||
_LIBCPP_HIDE_FROM_ABI _Storage(const path& __p1, const path& __p2) : __p1_(__p1), __p2_(__p2) {}
|
||||
|
||||
path __p1_;
|
||||
path __p2_;
|
||||
|
@ -82,25 +67,22 @@ private:
|
|||
shared_ptr<_Storage> __storage_;
|
||||
};
|
||||
|
||||
// TODO(ldionne): We need to pop the pragma and push it again after
|
||||
// filesystem_error to work around PR41078.
|
||||
_LIBCPP_AVAILABILITY_FILESYSTEM_PUSH
|
||||
|
||||
# ifndef _LIBCPP_HAS_NO_EXCEPTIONS
|
||||
template <class... _Args>
|
||||
_LIBCPP_NORETURN inline _LIBCPP_INLINE_VISIBILITY
|
||||
#ifndef _LIBCPP_HAS_NO_EXCEPTIONS
|
||||
void __throw_filesystem_error(_Args&&... __args) {
|
||||
throw filesystem_error(_VSTD::forward<_Args>(__args)...);
|
||||
_LIBCPP_NORETURN inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_AVAILABILITY_FILESYSTEM_LIBRARY void
|
||||
__throw_filesystem_error(_Args&&... __args) {
|
||||
throw filesystem_error(std::forward<_Args>(__args)...);
|
||||
}
|
||||
#else
|
||||
void __throw_filesystem_error(_Args&&...) {
|
||||
_LIBCPP_VERBOSE_ABORT("filesystem_error was thrown in -fno-exceptions mode");
|
||||
# else
|
||||
template <class... _Args>
|
||||
_LIBCPP_NORETURN inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_AVAILABILITY_FILESYSTEM_LIBRARY void
|
||||
__throw_filesystem_error(_Args&&...) {
|
||||
_LIBCPP_VERBOSE_ABORT("filesystem_error was thrown in -fno-exceptions mode");
|
||||
}
|
||||
#endif
|
||||
_LIBCPP_AVAILABILITY_FILESYSTEM_POP
|
||||
# endif
|
||||
|
||||
_LIBCPP_END_NAMESPACE_FILESYSTEM
|
||||
|
||||
#endif // _LIBCPP_CXX03_LANG
|
||||
#endif // _LIBCPP_STD_VER >= 17
|
||||
|
||||
#endif // _LIBCPP___FILESYSTEM_FILESYSTEM_ERROR_H
|
||||
|
|
287
third_party/libcxx/__filesystem/operations.h
vendored
287
third_party/libcxx/__filesystem/operations.h
vendored
|
@ -10,7 +10,6 @@
|
|||
#ifndef _LIBCPP___FILESYSTEM_OPERATIONS_H
|
||||
#define _LIBCPP___FILESYSTEM_OPERATIONS_H
|
||||
|
||||
#include <__availability>
|
||||
#include <__chrono/time_point.h>
|
||||
#include <__config>
|
||||
#include <__filesystem/copy_options.h>
|
||||
|
@ -28,77 +27,130 @@
|
|||
# pragma GCC system_header
|
||||
#endif
|
||||
|
||||
#ifndef _LIBCPP_CXX03_LANG
|
||||
#if _LIBCPP_STD_VER >= 17 && !defined(_LIBCPP_HAS_NO_FILESYSTEM)
|
||||
|
||||
_LIBCPP_BEGIN_NAMESPACE_FILESYSTEM
|
||||
|
||||
_LIBCPP_AVAILABILITY_FILESYSTEM_PUSH
|
||||
_LIBCPP_AVAILABILITY_FILESYSTEM_LIBRARY_PUSH
|
||||
|
||||
_LIBCPP_FUNC_VIS path __absolute(const path&, error_code* __ec = nullptr);
|
||||
_LIBCPP_FUNC_VIS path __canonical(const path&, error_code* __ec = nullptr);
|
||||
_LIBCPP_FUNC_VIS bool __copy_file(const path& __from, const path& __to, copy_options __opt, error_code* __ec = nullptr);
|
||||
_LIBCPP_FUNC_VIS void __copy_symlink(const path& __existing_symlink, const path& __new_symlink, error_code* __ec = nullptr);
|
||||
_LIBCPP_FUNC_VIS void __copy(const path& __from, const path& __to, copy_options __opt, error_code* __ec = nullptr);
|
||||
_LIBCPP_FUNC_VIS bool __create_directories(const path&, error_code* = nullptr);
|
||||
_LIBCPP_FUNC_VIS void __create_directory_symlink(const path& __to, const path& __new_symlink, error_code* __ec = nullptr);
|
||||
_LIBCPP_FUNC_VIS bool __create_directory(const path&, error_code* = nullptr);
|
||||
_LIBCPP_FUNC_VIS bool __create_directory(const path&, const path& __attributes, error_code* = nullptr);
|
||||
_LIBCPP_FUNC_VIS void __create_hard_link(const path& __to, const path& __new_hard_link, error_code* __ec = nullptr);
|
||||
_LIBCPP_FUNC_VIS void __create_symlink(const path& __to, const path& __new_symlink, error_code* __ec = nullptr);
|
||||
_LIBCPP_FUNC_VIS path __current_path(error_code* __ec = nullptr);
|
||||
_LIBCPP_FUNC_VIS void __current_path(const path&, error_code* __ec = nullptr);
|
||||
_LIBCPP_FUNC_VIS bool __equivalent(const path&, const path&, error_code* __ec = nullptr);
|
||||
_LIBCPP_FUNC_VIS file_status __status(const path&, error_code* __ec = nullptr);
|
||||
_LIBCPP_FUNC_VIS uintmax_t __file_size(const path&, error_code* __ec = nullptr);
|
||||
_LIBCPP_FUNC_VIS uintmax_t __hard_link_count(const path&, error_code* __ec = nullptr);
|
||||
_LIBCPP_FUNC_VIS file_status __symlink_status(const path&, error_code* __ec = nullptr);
|
||||
_LIBCPP_FUNC_VIS file_time_type __last_write_time(const path&, error_code* __ec = nullptr);
|
||||
_LIBCPP_FUNC_VIS void __last_write_time(const path&, file_time_type __new_time, error_code* __ec = nullptr);
|
||||
_LIBCPP_FUNC_VIS path __weakly_canonical(path const& __p, error_code* __ec = nullptr);
|
||||
_LIBCPP_FUNC_VIS path __read_symlink(const path&, error_code* __ec = nullptr);
|
||||
_LIBCPP_FUNC_VIS uintmax_t __remove_all(const path&, error_code* __ec = nullptr);
|
||||
_LIBCPP_FUNC_VIS bool __remove(const path&, error_code* __ec = nullptr);
|
||||
_LIBCPP_FUNC_VIS void __rename(const path& __from, const path& __to, error_code* __ec = nullptr);
|
||||
_LIBCPP_FUNC_VIS void __resize_file(const path&, uintmax_t __size, error_code* = nullptr);
|
||||
_LIBCPP_FUNC_VIS path __temp_directory_path(error_code* __ec = nullptr);
|
||||
_LIBCPP_EXPORTED_FROM_ABI path __absolute(const path&, error_code* __ec = nullptr);
|
||||
_LIBCPP_EXPORTED_FROM_ABI path __canonical(const path&, error_code* __ec = nullptr);
|
||||
_LIBCPP_EXPORTED_FROM_ABI bool
|
||||
__copy_file(const path& __from, const path& __to, copy_options __opt, error_code* __ec = nullptr);
|
||||
_LIBCPP_EXPORTED_FROM_ABI void
|
||||
__copy_symlink(const path& __existing_symlink, const path& __new_symlink, error_code* __ec = nullptr);
|
||||
_LIBCPP_EXPORTED_FROM_ABI void
|
||||
__copy(const path& __from, const path& __to, copy_options __opt, error_code* __ec = nullptr);
|
||||
_LIBCPP_EXPORTED_FROM_ABI bool __create_directories(const path&, error_code* = nullptr);
|
||||
_LIBCPP_EXPORTED_FROM_ABI void
|
||||
__create_directory_symlink(const path& __to, const path& __new_symlink, error_code* __ec = nullptr);
|
||||
_LIBCPP_EXPORTED_FROM_ABI bool __create_directory(const path&, error_code* = nullptr);
|
||||
_LIBCPP_EXPORTED_FROM_ABI bool __create_directory(const path&, const path& __attributes, error_code* = nullptr);
|
||||
_LIBCPP_EXPORTED_FROM_ABI void
|
||||
__create_hard_link(const path& __to, const path& __new_hard_link, error_code* __ec = nullptr);
|
||||
_LIBCPP_EXPORTED_FROM_ABI void
|
||||
__create_symlink(const path& __to, const path& __new_symlink, error_code* __ec = nullptr);
|
||||
_LIBCPP_EXPORTED_FROM_ABI path __current_path(error_code* __ec = nullptr);
|
||||
_LIBCPP_EXPORTED_FROM_ABI void __current_path(const path&, error_code* __ec = nullptr);
|
||||
_LIBCPP_EXPORTED_FROM_ABI bool __equivalent(const path&, const path&, error_code* __ec = nullptr);
|
||||
_LIBCPP_EXPORTED_FROM_ABI file_status __status(const path&, error_code* __ec = nullptr);
|
||||
_LIBCPP_EXPORTED_FROM_ABI uintmax_t __file_size(const path&, error_code* __ec = nullptr);
|
||||
_LIBCPP_EXPORTED_FROM_ABI uintmax_t __hard_link_count(const path&, error_code* __ec = nullptr);
|
||||
_LIBCPP_EXPORTED_FROM_ABI file_status __symlink_status(const path&, error_code* __ec = nullptr);
|
||||
_LIBCPP_EXPORTED_FROM_ABI file_time_type __last_write_time(const path&, error_code* __ec = nullptr);
|
||||
_LIBCPP_EXPORTED_FROM_ABI void __last_write_time(const path&, file_time_type __new_time, error_code* __ec = nullptr);
|
||||
_LIBCPP_EXPORTED_FROM_ABI path __weakly_canonical(path const& __p, error_code* __ec = nullptr);
|
||||
_LIBCPP_EXPORTED_FROM_ABI path __read_symlink(const path&, error_code* __ec = nullptr);
|
||||
_LIBCPP_EXPORTED_FROM_ABI uintmax_t __remove_all(const path&, error_code* __ec = nullptr);
|
||||
_LIBCPP_EXPORTED_FROM_ABI bool __remove(const path&, error_code* __ec = nullptr);
|
||||
_LIBCPP_EXPORTED_FROM_ABI void __rename(const path& __from, const path& __to, error_code* __ec = nullptr);
|
||||
_LIBCPP_EXPORTED_FROM_ABI void __resize_file(const path&, uintmax_t __size, error_code* = nullptr);
|
||||
_LIBCPP_EXPORTED_FROM_ABI path __temp_directory_path(error_code* __ec = nullptr);
|
||||
|
||||
inline _LIBCPP_HIDE_FROM_ABI path absolute(const path& __p) { return __absolute(__p); }
|
||||
inline _LIBCPP_HIDE_FROM_ABI path absolute(const path& __p, error_code& __ec) { return __absolute(__p, &__ec); }
|
||||
inline _LIBCPP_HIDE_FROM_ABI path canonical(const path& __p) { return __canonical(__p); }
|
||||
inline _LIBCPP_HIDE_FROM_ABI path canonical(const path& __p) { return __canonical(__p); }
|
||||
inline _LIBCPP_HIDE_FROM_ABI path canonical(const path& __p, error_code& __ec) { return __canonical(__p, &__ec); }
|
||||
inline _LIBCPP_HIDE_FROM_ABI bool copy_file(const path& __from, const path& __to) { return __copy_file(__from, __to, copy_options::none); }
|
||||
inline _LIBCPP_HIDE_FROM_ABI bool copy_file(const path& __from, const path& __to, error_code& __ec) { return __copy_file(__from, __to, copy_options::none, &__ec); }
|
||||
inline _LIBCPP_HIDE_FROM_ABI bool copy_file(const path& __from, const path& __to, copy_options __opt) { return __copy_file(__from, __to, __opt); }
|
||||
inline _LIBCPP_HIDE_FROM_ABI bool copy_file(const path& __from, const path& __to, copy_options __opt, error_code& __ec) { return __copy_file(__from, __to, __opt, &__ec); }
|
||||
inline _LIBCPP_HIDE_FROM_ABI bool copy_file(const path& __from, const path& __to) {
|
||||
return __copy_file(__from, __to, copy_options::none);
|
||||
}
|
||||
inline _LIBCPP_HIDE_FROM_ABI bool copy_file(const path& __from, const path& __to, error_code& __ec) {
|
||||
return __copy_file(__from, __to, copy_options::none, &__ec);
|
||||
}
|
||||
inline _LIBCPP_HIDE_FROM_ABI bool copy_file(const path& __from, const path& __to, copy_options __opt) {
|
||||
return __copy_file(__from, __to, __opt);
|
||||
}
|
||||
inline _LIBCPP_HIDE_FROM_ABI bool
|
||||
copy_file(const path& __from, const path& __to, copy_options __opt, error_code& __ec) {
|
||||
return __copy_file(__from, __to, __opt, &__ec);
|
||||
}
|
||||
inline _LIBCPP_HIDE_FROM_ABI void copy_symlink(const path& __from, const path& __to) { __copy_symlink(__from, __to); }
|
||||
inline _LIBCPP_HIDE_FROM_ABI void copy_symlink(const path& __from, const path& __to, error_code& __ec) noexcept { __copy_symlink(__from, __to, &__ec); }
|
||||
inline _LIBCPP_HIDE_FROM_ABI void copy(const path& __from, const path& __to) { __copy(__from, __to, copy_options::none); }
|
||||
inline _LIBCPP_HIDE_FROM_ABI void copy(const path& __from, const path& __to, error_code& __ec) { __copy(__from, __to, copy_options::none, &__ec); }
|
||||
inline _LIBCPP_HIDE_FROM_ABI void copy(const path& __from, const path& __to, copy_options __opt) { __copy(__from, __to, __opt); }
|
||||
inline _LIBCPP_HIDE_FROM_ABI void copy(const path& __from, const path& __to, copy_options __opt, error_code& __ec) { __copy(__from, __to, __opt, &__ec); }
|
||||
inline _LIBCPP_HIDE_FROM_ABI void copy_symlink(const path& __from, const path& __to, error_code& __ec) noexcept {
|
||||
__copy_symlink(__from, __to, &__ec);
|
||||
}
|
||||
inline _LIBCPP_HIDE_FROM_ABI void copy(const path& __from, const path& __to) {
|
||||
__copy(__from, __to, copy_options::none);
|
||||
}
|
||||
inline _LIBCPP_HIDE_FROM_ABI void copy(const path& __from, const path& __to, error_code& __ec) {
|
||||
__copy(__from, __to, copy_options::none, &__ec);
|
||||
}
|
||||
inline _LIBCPP_HIDE_FROM_ABI void copy(const path& __from, const path& __to, copy_options __opt) {
|
||||
__copy(__from, __to, __opt);
|
||||
}
|
||||
inline _LIBCPP_HIDE_FROM_ABI void copy(const path& __from, const path& __to, copy_options __opt, error_code& __ec) {
|
||||
__copy(__from, __to, __opt, &__ec);
|
||||
}
|
||||
inline _LIBCPP_HIDE_FROM_ABI bool create_directories(const path& __p) { return __create_directories(__p); }
|
||||
inline _LIBCPP_HIDE_FROM_ABI bool create_directories(const path& __p, error_code& __ec) { return __create_directories(__p, &__ec); }
|
||||
inline _LIBCPP_HIDE_FROM_ABI void create_directory_symlink(const path& __target, const path& __link) { __create_directory_symlink(__target, __link); }
|
||||
inline _LIBCPP_HIDE_FROM_ABI void create_directory_symlink(const path& __target, const path& __link, error_code& __ec) noexcept { __create_directory_symlink(__target, __link, &__ec); }
|
||||
inline _LIBCPP_HIDE_FROM_ABI bool create_directories(const path& __p, error_code& __ec) {
|
||||
return __create_directories(__p, &__ec);
|
||||
}
|
||||
inline _LIBCPP_HIDE_FROM_ABI void create_directory_symlink(const path& __target, const path& __link) {
|
||||
__create_directory_symlink(__target, __link);
|
||||
}
|
||||
inline _LIBCPP_HIDE_FROM_ABI void
|
||||
create_directory_symlink(const path& __target, const path& __link, error_code& __ec) noexcept {
|
||||
__create_directory_symlink(__target, __link, &__ec);
|
||||
}
|
||||
inline _LIBCPP_HIDE_FROM_ABI bool create_directory(const path& __p) { return __create_directory(__p); }
|
||||
inline _LIBCPP_HIDE_FROM_ABI bool create_directory(const path& __p, error_code& __ec) noexcept { return __create_directory(__p, &__ec); }
|
||||
inline _LIBCPP_HIDE_FROM_ABI bool create_directory(const path& __p, const path& __attrs) { return __create_directory(__p, __attrs); }
|
||||
inline _LIBCPP_HIDE_FROM_ABI bool create_directory(const path& __p, const path& __attrs, error_code& __ec) noexcept { return __create_directory(__p, __attrs, &__ec); }
|
||||
inline _LIBCPP_HIDE_FROM_ABI void create_hard_link(const path& __target, const path& __link) { __create_hard_link(__target, __link); }
|
||||
inline _LIBCPP_HIDE_FROM_ABI void create_hard_link(const path& __target, const path& __link, error_code& __ec) noexcept { __create_hard_link(__target, __link, &__ec); }
|
||||
inline _LIBCPP_HIDE_FROM_ABI void create_symlink(const path& __target, const path& __link) { __create_symlink(__target, __link); }
|
||||
inline _LIBCPP_HIDE_FROM_ABI void create_symlink(const path& __target, const path& __link, error_code& __ec) noexcept { return __create_symlink(__target, __link, &__ec); }
|
||||
inline _LIBCPP_HIDE_FROM_ABI bool create_directory(const path& __p, error_code& __ec) noexcept {
|
||||
return __create_directory(__p, &__ec);
|
||||
}
|
||||
inline _LIBCPP_HIDE_FROM_ABI bool create_directory(const path& __p, const path& __attrs) {
|
||||
return __create_directory(__p, __attrs);
|
||||
}
|
||||
inline _LIBCPP_HIDE_FROM_ABI bool create_directory(const path& __p, const path& __attrs, error_code& __ec) noexcept {
|
||||
return __create_directory(__p, __attrs, &__ec);
|
||||
}
|
||||
inline _LIBCPP_HIDE_FROM_ABI void create_hard_link(const path& __target, const path& __link) {
|
||||
__create_hard_link(__target, __link);
|
||||
}
|
||||
inline _LIBCPP_HIDE_FROM_ABI void
|
||||
create_hard_link(const path& __target, const path& __link, error_code& __ec) noexcept {
|
||||
__create_hard_link(__target, __link, &__ec);
|
||||
}
|
||||
inline _LIBCPP_HIDE_FROM_ABI void create_symlink(const path& __target, const path& __link) {
|
||||
__create_symlink(__target, __link);
|
||||
}
|
||||
inline _LIBCPP_HIDE_FROM_ABI void create_symlink(const path& __target, const path& __link, error_code& __ec) noexcept {
|
||||
return __create_symlink(__target, __link, &__ec);
|
||||
}
|
||||
inline _LIBCPP_HIDE_FROM_ABI path current_path() { return __current_path(); }
|
||||
inline _LIBCPP_HIDE_FROM_ABI path current_path(error_code& __ec) { return __current_path(&__ec); }
|
||||
inline _LIBCPP_HIDE_FROM_ABI void current_path(const path& __p) { __current_path(__p); }
|
||||
inline _LIBCPP_HIDE_FROM_ABI void current_path(const path& __p, error_code& __ec) noexcept { __current_path(__p, &__ec); }
|
||||
inline _LIBCPP_HIDE_FROM_ABI void current_path(const path& __p, error_code& __ec) noexcept {
|
||||
__current_path(__p, &__ec);
|
||||
}
|
||||
inline _LIBCPP_HIDE_FROM_ABI bool equivalent(const path& __p1, const path& __p2) { return __equivalent(__p1, __p2); }
|
||||
inline _LIBCPP_HIDE_FROM_ABI bool equivalent(const path& __p1, const path& __p2, error_code& __ec) noexcept { return __equivalent(__p1, __p2, &__ec); }
|
||||
inline _LIBCPP_HIDE_FROM_ABI bool equivalent(const path& __p1, const path& __p2, error_code& __ec) noexcept {
|
||||
return __equivalent(__p1, __p2, &__ec);
|
||||
}
|
||||
inline _LIBCPP_HIDE_FROM_ABI bool status_known(file_status __s) noexcept { return __s.type() != file_type::none; }
|
||||
inline _LIBCPP_HIDE_FROM_ABI bool exists(file_status __s) noexcept { return status_known(__s) && __s.type() != file_type::not_found; }
|
||||
inline _LIBCPP_HIDE_FROM_ABI bool exists(file_status __s) noexcept {
|
||||
return status_known(__s) && __s.type() != file_type::not_found;
|
||||
}
|
||||
inline _LIBCPP_HIDE_FROM_ABI bool exists(const path& __p) { return exists(__status(__p)); }
|
||||
|
||||
inline _LIBCPP_INLINE_VISIBILITY bool exists(const path& __p, error_code& __ec) noexcept {
|
||||
inline _LIBCPP_HIDE_FROM_ABI bool exists(const path& __p, error_code& __ec) noexcept {
|
||||
auto __s = __status(__p, &__ec);
|
||||
if (status_known(__s))
|
||||
__ec.clear();
|
||||
|
@ -106,46 +158,81 @@ inline _LIBCPP_INLINE_VISIBILITY bool exists(const path& __p, error_code& __ec)
|
|||
}
|
||||
|
||||
inline _LIBCPP_HIDE_FROM_ABI uintmax_t file_size(const path& __p) { return __file_size(__p); }
|
||||
inline _LIBCPP_HIDE_FROM_ABI uintmax_t file_size(const path& __p, error_code& __ec) noexcept { return __file_size(__p, &__ec); }
|
||||
inline _LIBCPP_HIDE_FROM_ABI uintmax_t file_size(const path& __p, error_code& __ec) noexcept {
|
||||
return __file_size(__p, &__ec);
|
||||
}
|
||||
inline _LIBCPP_HIDE_FROM_ABI uintmax_t hard_link_count(const path& __p) { return __hard_link_count(__p); }
|
||||
inline _LIBCPP_HIDE_FROM_ABI uintmax_t hard_link_count(const path& __p, error_code& __ec) noexcept { return __hard_link_count(__p, &__ec); }
|
||||
inline _LIBCPP_HIDE_FROM_ABI uintmax_t hard_link_count(const path& __p, error_code& __ec) noexcept {
|
||||
return __hard_link_count(__p, &__ec);
|
||||
}
|
||||
inline _LIBCPP_HIDE_FROM_ABI bool is_block_file(file_status __s) noexcept { return __s.type() == file_type::block; }
|
||||
inline _LIBCPP_HIDE_FROM_ABI bool is_block_file(const path& __p) { return is_block_file(__status(__p)); }
|
||||
inline _LIBCPP_HIDE_FROM_ABI bool is_block_file(const path& __p, error_code& __ec) noexcept { return is_block_file(__status(__p, &__ec)); }
|
||||
inline _LIBCPP_HIDE_FROM_ABI bool is_character_file(file_status __s) noexcept { return __s.type() == file_type::character; }
|
||||
inline _LIBCPP_HIDE_FROM_ABI bool is_block_file(const path& __p, error_code& __ec) noexcept {
|
||||
return is_block_file(__status(__p, &__ec));
|
||||
}
|
||||
inline _LIBCPP_HIDE_FROM_ABI bool is_character_file(file_status __s) noexcept {
|
||||
return __s.type() == file_type::character;
|
||||
}
|
||||
inline _LIBCPP_HIDE_FROM_ABI bool is_character_file(const path& __p) { return is_character_file(__status(__p)); }
|
||||
inline _LIBCPP_HIDE_FROM_ABI bool is_character_file(const path& __p, error_code& __ec) noexcept { return is_character_file(__status(__p, &__ec)); }
|
||||
inline _LIBCPP_HIDE_FROM_ABI bool is_character_file(const path& __p, error_code& __ec) noexcept {
|
||||
return is_character_file(__status(__p, &__ec));
|
||||
}
|
||||
inline _LIBCPP_HIDE_FROM_ABI bool is_directory(file_status __s) noexcept { return __s.type() == file_type::directory; }
|
||||
inline _LIBCPP_HIDE_FROM_ABI bool is_directory(const path& __p) { return is_directory(__status(__p)); }
|
||||
inline _LIBCPP_HIDE_FROM_ABI bool is_directory(const path& __p, error_code& __ec) noexcept { return is_directory(__status(__p, &__ec)); }
|
||||
_LIBCPP_FUNC_VIS bool __fs_is_empty(const path& __p, error_code* __ec = nullptr);
|
||||
inline _LIBCPP_HIDE_FROM_ABI bool is_directory(const path& __p, error_code& __ec) noexcept {
|
||||
return is_directory(__status(__p, &__ec));
|
||||
}
|
||||
_LIBCPP_EXPORTED_FROM_ABI bool __fs_is_empty(const path& __p, error_code* __ec = nullptr);
|
||||
inline _LIBCPP_HIDE_FROM_ABI bool is_empty(const path& __p) { return __fs_is_empty(__p); }
|
||||
inline _LIBCPP_HIDE_FROM_ABI bool is_empty(const path& __p, error_code& __ec) { return __fs_is_empty(__p, &__ec); }
|
||||
inline _LIBCPP_HIDE_FROM_ABI bool is_fifo(file_status __s) noexcept { return __s.type() == file_type::fifo; }
|
||||
inline _LIBCPP_HIDE_FROM_ABI bool is_fifo(const path& __p) { return is_fifo(__status(__p)); }
|
||||
inline _LIBCPP_HIDE_FROM_ABI bool is_fifo(const path& __p, error_code& __ec) noexcept { return is_fifo(__status(__p, &__ec)); }
|
||||
inline _LIBCPP_HIDE_FROM_ABI bool is_fifo(const path& __p, error_code& __ec) noexcept {
|
||||
return is_fifo(__status(__p, &__ec));
|
||||
}
|
||||
inline _LIBCPP_HIDE_FROM_ABI bool is_regular_file(file_status __s) noexcept { return __s.type() == file_type::regular; }
|
||||
inline _LIBCPP_HIDE_FROM_ABI bool is_regular_file(const path& __p) { return is_regular_file(__status(__p)); }
|
||||
inline _LIBCPP_HIDE_FROM_ABI bool is_regular_file(const path& __p, error_code& __ec) noexcept { return is_regular_file(__status(__p, &__ec)); }
|
||||
inline _LIBCPP_HIDE_FROM_ABI bool is_regular_file(const path& __p, error_code& __ec) noexcept {
|
||||
return is_regular_file(__status(__p, &__ec));
|
||||
}
|
||||
inline _LIBCPP_HIDE_FROM_ABI bool is_symlink(file_status __s) noexcept { return __s.type() == file_type::symlink; }
|
||||
inline _LIBCPP_HIDE_FROM_ABI bool is_symlink(const path& __p) { return is_symlink(__symlink_status(__p)); }
|
||||
inline _LIBCPP_HIDE_FROM_ABI bool is_symlink(const path& __p, error_code& __ec) noexcept { return is_symlink(__symlink_status(__p, &__ec)); }
|
||||
inline _LIBCPP_HIDE_FROM_ABI bool is_other(file_status __s) noexcept { return exists(__s) && !is_regular_file(__s) && !is_directory(__s) && !is_symlink(__s); }
|
||||
inline _LIBCPP_HIDE_FROM_ABI bool is_symlink(const path& __p, error_code& __ec) noexcept {
|
||||
return is_symlink(__symlink_status(__p, &__ec));
|
||||
}
|
||||
inline _LIBCPP_HIDE_FROM_ABI bool is_other(file_status __s) noexcept {
|
||||
return exists(__s) && !is_regular_file(__s) && !is_directory(__s) && !is_symlink(__s);
|
||||
}
|
||||
inline _LIBCPP_HIDE_FROM_ABI bool is_other(const path& __p) { return is_other(__status(__p)); }
|
||||
inline _LIBCPP_HIDE_FROM_ABI bool is_other(const path& __p, error_code& __ec) noexcept { return is_other(__status(__p, &__ec)); }
|
||||
inline _LIBCPP_HIDE_FROM_ABI bool is_other(const path& __p, error_code& __ec) noexcept {
|
||||
return is_other(__status(__p, &__ec));
|
||||
}
|
||||
inline _LIBCPP_HIDE_FROM_ABI bool is_socket(file_status __s) noexcept { return __s.type() == file_type::socket; }
|
||||
inline _LIBCPP_HIDE_FROM_ABI bool is_socket(const path& __p) { return is_socket(__status(__p)); }
|
||||
inline _LIBCPP_HIDE_FROM_ABI bool is_socket(const path& __p, error_code& __ec) noexcept { return is_socket(__status(__p, &__ec)); }
|
||||
inline _LIBCPP_HIDE_FROM_ABI bool is_socket(const path& __p, error_code& __ec) noexcept {
|
||||
return is_socket(__status(__p, &__ec));
|
||||
}
|
||||
inline _LIBCPP_HIDE_FROM_ABI file_time_type last_write_time(const path& __p) { return __last_write_time(__p); }
|
||||
inline _LIBCPP_HIDE_FROM_ABI file_time_type last_write_time(const path& __p, error_code& __ec) noexcept { return __last_write_time(__p, &__ec); }
|
||||
inline _LIBCPP_HIDE_FROM_ABI file_time_type last_write_time(const path& __p, error_code& __ec) noexcept {
|
||||
return __last_write_time(__p, &__ec);
|
||||
}
|
||||
inline _LIBCPP_HIDE_FROM_ABI void last_write_time(const path& __p, file_time_type __t) { __last_write_time(__p, __t); }
|
||||
inline _LIBCPP_HIDE_FROM_ABI void last_write_time(const path& __p, file_time_type __t, error_code& __ec) noexcept { __last_write_time(__p, __t, &__ec); }
|
||||
_LIBCPP_FUNC_VIS void __permissions(const path&, perms, perm_options, error_code* = nullptr);
|
||||
inline _LIBCPP_HIDE_FROM_ABI void permissions(const path& __p, perms __prms, perm_options __opts = perm_options::replace) { __permissions(__p, __prms, __opts); }
|
||||
inline _LIBCPP_HIDE_FROM_ABI void permissions(const path& __p, perms __prms, error_code& __ec) noexcept { __permissions(__p, __prms, perm_options::replace, &__ec); }
|
||||
inline _LIBCPP_HIDE_FROM_ABI void permissions(const path& __p, perms __prms, perm_options __opts, error_code& __ec) { __permissions(__p, __prms, __opts, &__ec); }
|
||||
inline _LIBCPP_HIDE_FROM_ABI void last_write_time(const path& __p, file_time_type __t, error_code& __ec) noexcept {
|
||||
__last_write_time(__p, __t, &__ec);
|
||||
}
|
||||
_LIBCPP_EXPORTED_FROM_ABI void __permissions(const path&, perms, perm_options, error_code* = nullptr);
|
||||
inline _LIBCPP_HIDE_FROM_ABI void
|
||||
permissions(const path& __p, perms __prms, perm_options __opts = perm_options::replace) {
|
||||
__permissions(__p, __prms, __opts);
|
||||
}
|
||||
inline _LIBCPP_HIDE_FROM_ABI void permissions(const path& __p, perms __prms, error_code& __ec) noexcept {
|
||||
__permissions(__p, __prms, perm_options::replace, &__ec);
|
||||
}
|
||||
inline _LIBCPP_HIDE_FROM_ABI void permissions(const path& __p, perms __prms, perm_options __opts, error_code& __ec) {
|
||||
__permissions(__p, __prms, __opts, &__ec);
|
||||
}
|
||||
|
||||
inline _LIBCPP_INLINE_VISIBILITY path proximate(const path& __p, const path& __base, error_code& __ec) {
|
||||
inline _LIBCPP_HIDE_FROM_ABI path proximate(const path& __p, const path& __base, error_code& __ec) {
|
||||
path __tmp = __weakly_canonical(__p, &__ec);
|
||||
if (__ec)
|
||||
return {};
|
||||
|
@ -155,12 +242,16 @@ inline _LIBCPP_INLINE_VISIBILITY path proximate(const path& __p, const path& __b
|
|||
return __tmp.lexically_proximate(__tmp_base);
|
||||
}
|
||||
|
||||
inline _LIBCPP_HIDE_FROM_ABI path proximate(const path& __p, error_code& __ec) { return proximate(__p, current_path(), __ec); }
|
||||
inline _LIBCPP_HIDE_FROM_ABI path proximate(const path& __p, const path& __base = current_path()) { return __weakly_canonical(__p).lexically_proximate(__weakly_canonical(__base)); }
|
||||
inline _LIBCPP_HIDE_FROM_ABI path proximate(const path& __p, error_code& __ec) {
|
||||
return proximate(__p, current_path(), __ec);
|
||||
}
|
||||
inline _LIBCPP_HIDE_FROM_ABI path proximate(const path& __p, const path& __base = current_path()) {
|
||||
return __weakly_canonical(__p).lexically_proximate(__weakly_canonical(__base));
|
||||
}
|
||||
inline _LIBCPP_HIDE_FROM_ABI path read_symlink(const path& __p) { return __read_symlink(__p); }
|
||||
inline _LIBCPP_HIDE_FROM_ABI path read_symlink(const path& __p, error_code& __ec) { return __read_symlink(__p, &__ec); }
|
||||
|
||||
inline _LIBCPP_INLINE_VISIBILITY path relative(const path& __p, const path& __base, error_code& __ec) {
|
||||
inline _LIBCPP_HIDE_FROM_ABI path relative(const path& __p, const path& __base, error_code& __ec) {
|
||||
path __tmp = __weakly_canonical(__p, &__ec);
|
||||
if (__ec)
|
||||
return path();
|
||||
|
@ -170,32 +261,50 @@ inline _LIBCPP_INLINE_VISIBILITY path relative(const path& __p, const path& __ba
|
|||
return __tmp.lexically_relative(__tmpbase);
|
||||
}
|
||||
|
||||
inline _LIBCPP_HIDE_FROM_ABI path relative(const path& __p, error_code& __ec) { return relative(__p, current_path(), __ec); }
|
||||
inline _LIBCPP_HIDE_FROM_ABI path relative(const path& __p, const path& __base = current_path()) { return __weakly_canonical(__p).lexically_relative(__weakly_canonical(__base)); }
|
||||
inline _LIBCPP_HIDE_FROM_ABI path relative(const path& __p, error_code& __ec) {
|
||||
return relative(__p, current_path(), __ec);
|
||||
}
|
||||
inline _LIBCPP_HIDE_FROM_ABI path relative(const path& __p, const path& __base = current_path()) {
|
||||
return __weakly_canonical(__p).lexically_relative(__weakly_canonical(__base));
|
||||
}
|
||||
inline _LIBCPP_HIDE_FROM_ABI uintmax_t remove_all(const path& __p) { return __remove_all(__p); }
|
||||
inline _LIBCPP_HIDE_FROM_ABI uintmax_t remove_all(const path& __p, error_code& __ec) { return __remove_all(__p, &__ec); }
|
||||
inline _LIBCPP_HIDE_FROM_ABI uintmax_t remove_all(const path& __p, error_code& __ec) {
|
||||
return __remove_all(__p, &__ec);
|
||||
}
|
||||
inline _LIBCPP_HIDE_FROM_ABI bool remove(const path& __p) { return __remove(__p); }
|
||||
inline _LIBCPP_HIDE_FROM_ABI bool remove(const path& __p, error_code& __ec) noexcept { return __remove(__p, &__ec); }
|
||||
inline _LIBCPP_HIDE_FROM_ABI void rename(const path& __from, const path& __to) { return __rename(__from, __to); }
|
||||
inline _LIBCPP_HIDE_FROM_ABI void rename(const path& __from, const path& __to, error_code& __ec) noexcept { return __rename(__from, __to, &__ec); }
|
||||
inline _LIBCPP_HIDE_FROM_ABI void rename(const path& __from, const path& __to, error_code& __ec) noexcept {
|
||||
return __rename(__from, __to, &__ec);
|
||||
}
|
||||
inline _LIBCPP_HIDE_FROM_ABI void resize_file(const path& __p, uintmax_t __ns) { return __resize_file(__p, __ns); }
|
||||
inline _LIBCPP_HIDE_FROM_ABI void resize_file(const path& __p, uintmax_t __ns, error_code& __ec) noexcept { return __resize_file(__p, __ns, &__ec); }
|
||||
_LIBCPP_FUNC_VIS space_info __space(const path&, error_code* __ec = nullptr);
|
||||
inline _LIBCPP_HIDE_FROM_ABI void resize_file(const path& __p, uintmax_t __ns, error_code& __ec) noexcept {
|
||||
return __resize_file(__p, __ns, &__ec);
|
||||
}
|
||||
_LIBCPP_EXPORTED_FROM_ABI space_info __space(const path&, error_code* __ec = nullptr);
|
||||
inline _LIBCPP_HIDE_FROM_ABI space_info space(const path& __p) { return __space(__p); }
|
||||
inline _LIBCPP_HIDE_FROM_ABI space_info space(const path& __p, error_code& __ec) noexcept { return __space(__p, &__ec); }
|
||||
inline _LIBCPP_HIDE_FROM_ABI space_info space(const path& __p, error_code& __ec) noexcept {
|
||||
return __space(__p, &__ec);
|
||||
}
|
||||
inline _LIBCPP_HIDE_FROM_ABI file_status status(const path& __p) { return __status(__p); }
|
||||
inline _LIBCPP_HIDE_FROM_ABI file_status status(const path& __p, error_code& __ec) noexcept { return __status(__p, &__ec); }
|
||||
inline _LIBCPP_HIDE_FROM_ABI file_status status(const path& __p, error_code& __ec) noexcept {
|
||||
return __status(__p, &__ec);
|
||||
}
|
||||
inline _LIBCPP_HIDE_FROM_ABI file_status symlink_status(const path& __p) { return __symlink_status(__p); }
|
||||
inline _LIBCPP_HIDE_FROM_ABI file_status symlink_status(const path& __p, error_code& __ec) noexcept { return __symlink_status(__p, &__ec); }
|
||||
inline _LIBCPP_HIDE_FROM_ABI file_status symlink_status(const path& __p, error_code& __ec) noexcept {
|
||||
return __symlink_status(__p, &__ec);
|
||||
}
|
||||
inline _LIBCPP_HIDE_FROM_ABI path temp_directory_path() { return __temp_directory_path(); }
|
||||
inline _LIBCPP_HIDE_FROM_ABI path temp_directory_path(error_code& __ec) { return __temp_directory_path(&__ec); }
|
||||
inline _LIBCPP_HIDE_FROM_ABI path weakly_canonical(path const& __p) { return __weakly_canonical(__p); }
|
||||
inline _LIBCPP_HIDE_FROM_ABI path weakly_canonical(path const& __p, error_code& __ec) { return __weakly_canonical(__p, &__ec); }
|
||||
inline _LIBCPP_HIDE_FROM_ABI path weakly_canonical(path const& __p, error_code& __ec) {
|
||||
return __weakly_canonical(__p, &__ec);
|
||||
}
|
||||
|
||||
_LIBCPP_AVAILABILITY_FILESYSTEM_POP
|
||||
_LIBCPP_AVAILABILITY_FILESYSTEM_LIBRARY_POP
|
||||
|
||||
_LIBCPP_END_NAMESPACE_FILESYSTEM
|
||||
|
||||
#endif // _LIBCPP_CXX03_LANG
|
||||
#endif // _LIBCPP_STD_VER >= 17 && !defined(_LIBCPP_HAS_NO_FILESYSTEM)
|
||||
|
||||
#endif // _LIBCPP___FILESYSTEM_OPERATIONS_H
|
||||
|
|
766
third_party/libcxx/__filesystem/path.h
vendored
766
third_party/libcxx/__filesystem/path.h
vendored
File diff suppressed because it is too large
Load diff
63
third_party/libcxx/__filesystem/path_iterator.h
vendored
63
third_party/libcxx/__filesystem/path_iterator.h
vendored
|
@ -11,7 +11,6 @@
|
|||
#define _LIBCPP___FILESYSTEM_PATH_ITERATOR_H
|
||||
|
||||
#include <__assert>
|
||||
#include <__availability>
|
||||
#include <__config>
|
||||
#include <__filesystem/path.h>
|
||||
#include <__iterator/iterator_traits.h>
|
||||
|
@ -23,13 +22,11 @@
|
|||
# pragma GCC system_header
|
||||
#endif
|
||||
|
||||
#ifndef _LIBCPP_CXX03_LANG
|
||||
#if _LIBCPP_STD_VER >= 17
|
||||
|
||||
_LIBCPP_BEGIN_NAMESPACE_FILESYSTEM
|
||||
|
||||
_LIBCPP_AVAILABILITY_FILESYSTEM_PUSH
|
||||
|
||||
class _LIBCPP_TYPE_VIS path::iterator {
|
||||
class _LIBCPP_EXPORTED_FROM_ABI path::iterator {
|
||||
public:
|
||||
enum _ParserState : unsigned char {
|
||||
_Singular,
|
||||
|
@ -51,49 +48,37 @@ public:
|
|||
typedef path reference;
|
||||
|
||||
public:
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
iterator()
|
||||
: __stashed_elem_(), __path_ptr_(nullptr), __entry_(),
|
||||
__state_(_Singular) {}
|
||||
_LIBCPP_HIDE_FROM_ABI iterator() : __stashed_elem_(), __path_ptr_(nullptr), __entry_(), __state_(_Singular) {}
|
||||
|
||||
_LIBCPP_HIDE_FROM_ABI iterator(const iterator&) = default;
|
||||
_LIBCPP_HIDE_FROM_ABI ~iterator() = default;
|
||||
_LIBCPP_HIDE_FROM_ABI ~iterator() = default;
|
||||
|
||||
_LIBCPP_HIDE_FROM_ABI iterator& operator=(const iterator&) = default;
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
reference operator*() const { return __stashed_elem_; }
|
||||
_LIBCPP_HIDE_FROM_ABI reference operator*() const { return __stashed_elem_; }
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
pointer operator->() const { return &__stashed_elem_; }
|
||||
_LIBCPP_HIDE_FROM_ABI pointer operator->() const { return &__stashed_elem_; }
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
iterator& operator++() {
|
||||
_LIBCPP_ASSERT(__state_ != _Singular,
|
||||
"attempting to increment a singular iterator");
|
||||
_LIBCPP_ASSERT(__state_ != _AtEnd,
|
||||
"attempting to increment the end iterator");
|
||||
_LIBCPP_HIDE_FROM_ABI iterator& operator++() {
|
||||
_LIBCPP_ASSERT_NON_NULL(__state_ != _Singular, "attempting to increment a singular iterator");
|
||||
_LIBCPP_ASSERT_UNCATEGORIZED(__state_ != _AtEnd, "attempting to increment the end iterator");
|
||||
return __increment();
|
||||
}
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
iterator operator++(int) {
|
||||
_LIBCPP_HIDE_FROM_ABI iterator operator++(int) {
|
||||
iterator __it(*this);
|
||||
this->operator++();
|
||||
return __it;
|
||||
}
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
iterator& operator--() {
|
||||
_LIBCPP_ASSERT(__state_ != _Singular,
|
||||
"attempting to decrement a singular iterator");
|
||||
_LIBCPP_ASSERT(__entry_.data() != __path_ptr_->native().data(),
|
||||
"attempting to decrement the begin iterator");
|
||||
_LIBCPP_HIDE_FROM_ABI iterator& operator--() {
|
||||
_LIBCPP_ASSERT_NON_NULL(__state_ != _Singular, "attempting to decrement a singular iterator");
|
||||
_LIBCPP_ASSERT_UNCATEGORIZED(
|
||||
__entry_.data() != __path_ptr_->native().data(), "attempting to decrement the begin iterator");
|
||||
return __decrement();
|
||||
}
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
iterator operator--(int) {
|
||||
_LIBCPP_HIDE_FROM_ABI iterator operator--(int) {
|
||||
iterator __it(*this);
|
||||
this->operator--();
|
||||
return __it;
|
||||
|
@ -102,8 +87,7 @@ public:
|
|||
private:
|
||||
friend class path;
|
||||
|
||||
inline _LIBCPP_INLINE_VISIBILITY friend bool operator==(const iterator&,
|
||||
const iterator&);
|
||||
inline _LIBCPP_HIDE_FROM_ABI friend bool operator==(const iterator&, const iterator&);
|
||||
|
||||
iterator& __increment();
|
||||
iterator& __decrement();
|
||||
|
@ -114,21 +98,18 @@ private:
|
|||
_ParserState __state_;
|
||||
};
|
||||
|
||||
inline _LIBCPP_INLINE_VISIBILITY bool operator==(const path::iterator& __lhs,
|
||||
const path::iterator& __rhs) {
|
||||
return __lhs.__path_ptr_ == __rhs.__path_ptr_ &&
|
||||
__lhs.__entry_.data() == __rhs.__entry_.data();
|
||||
_LIBCPP_AVAILABILITY_FILESYSTEM_LIBRARY
|
||||
inline _LIBCPP_HIDE_FROM_ABI bool operator==(const path::iterator& __lhs, const path::iterator& __rhs) {
|
||||
return __lhs.__path_ptr_ == __rhs.__path_ptr_ && __lhs.__entry_.data() == __rhs.__entry_.data();
|
||||
}
|
||||
|
||||
inline _LIBCPP_INLINE_VISIBILITY bool operator!=(const path::iterator& __lhs,
|
||||
const path::iterator& __rhs) {
|
||||
_LIBCPP_AVAILABILITY_FILESYSTEM_LIBRARY
|
||||
inline _LIBCPP_HIDE_FROM_ABI bool operator!=(const path::iterator& __lhs, const path::iterator& __rhs) {
|
||||
return !(__lhs == __rhs);
|
||||
}
|
||||
|
||||
_LIBCPP_AVAILABILITY_FILESYSTEM_POP
|
||||
|
||||
_LIBCPP_END_NAMESPACE_FILESYSTEM
|
||||
|
||||
#endif // _LIBCPP_CXX03_LANG
|
||||
#endif // _LIBCPP_STD_VER >= 17
|
||||
|
||||
#endif // _LIBCPP___FILESYSTEM_PATH_ITERATOR_H
|
||||
|
|
46
third_party/libcxx/__filesystem/perm_options.h
vendored
46
third_party/libcxx/__filesystem/perm_options.h
vendored
|
@ -10,68 +10,48 @@
|
|||
#ifndef _LIBCPP___FILESYSTEM_PERM_OPTIONS_H
|
||||
#define _LIBCPP___FILESYSTEM_PERM_OPTIONS_H
|
||||
|
||||
#include <__availability>
|
||||
#include <__config>
|
||||
|
||||
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
|
||||
# pragma GCC system_header
|
||||
#endif
|
||||
|
||||
#ifndef _LIBCPP_CXX03_LANG
|
||||
#if _LIBCPP_STD_VER >= 17
|
||||
|
||||
_LIBCPP_BEGIN_NAMESPACE_FILESYSTEM
|
||||
|
||||
_LIBCPP_AVAILABILITY_FILESYSTEM_PUSH
|
||||
enum class perm_options : unsigned char { replace = 1, add = 2, remove = 4, nofollow = 8 };
|
||||
|
||||
enum class _LIBCPP_ENUM_VIS perm_options : unsigned char {
|
||||
replace = 1,
|
||||
add = 2,
|
||||
remove = 4,
|
||||
nofollow = 8
|
||||
};
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
inline constexpr perm_options operator&(perm_options __lhs, perm_options __rhs) {
|
||||
return static_cast<perm_options>(static_cast<unsigned>(__lhs) &
|
||||
static_cast<unsigned>(__rhs));
|
||||
_LIBCPP_HIDE_FROM_ABI inline constexpr perm_options operator&(perm_options __lhs, perm_options __rhs) {
|
||||
return static_cast<perm_options>(static_cast<unsigned>(__lhs) & static_cast<unsigned>(__rhs));
|
||||
}
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
inline constexpr perm_options operator|(perm_options __lhs, perm_options __rhs) {
|
||||
return static_cast<perm_options>(static_cast<unsigned>(__lhs) |
|
||||
static_cast<unsigned>(__rhs));
|
||||
_LIBCPP_HIDE_FROM_ABI inline constexpr perm_options operator|(perm_options __lhs, perm_options __rhs) {
|
||||
return static_cast<perm_options>(static_cast<unsigned>(__lhs) | static_cast<unsigned>(__rhs));
|
||||
}
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
inline constexpr perm_options operator^(perm_options __lhs, perm_options __rhs) {
|
||||
return static_cast<perm_options>(static_cast<unsigned>(__lhs) ^
|
||||
static_cast<unsigned>(__rhs));
|
||||
_LIBCPP_HIDE_FROM_ABI inline constexpr perm_options operator^(perm_options __lhs, perm_options __rhs) {
|
||||
return static_cast<perm_options>(static_cast<unsigned>(__lhs) ^ static_cast<unsigned>(__rhs));
|
||||
}
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
inline constexpr perm_options operator~(perm_options __lhs) {
|
||||
_LIBCPP_HIDE_FROM_ABI inline constexpr perm_options operator~(perm_options __lhs) {
|
||||
return static_cast<perm_options>(~static_cast<unsigned>(__lhs));
|
||||
}
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
inline perm_options& operator&=(perm_options& __lhs, perm_options __rhs) {
|
||||
_LIBCPP_HIDE_FROM_ABI inline perm_options& operator&=(perm_options& __lhs, perm_options __rhs) {
|
||||
return __lhs = __lhs & __rhs;
|
||||
}
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
inline perm_options& operator|=(perm_options& __lhs, perm_options __rhs) {
|
||||
_LIBCPP_HIDE_FROM_ABI inline perm_options& operator|=(perm_options& __lhs, perm_options __rhs) {
|
||||
return __lhs = __lhs | __rhs;
|
||||
}
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
inline perm_options& operator^=(perm_options& __lhs, perm_options __rhs) {
|
||||
_LIBCPP_HIDE_FROM_ABI inline perm_options& operator^=(perm_options& __lhs, perm_options __rhs) {
|
||||
return __lhs = __lhs ^ __rhs;
|
||||
}
|
||||
|
||||
_LIBCPP_AVAILABILITY_FILESYSTEM_POP
|
||||
|
||||
_LIBCPP_END_NAMESPACE_FILESYSTEM
|
||||
|
||||
#endif // _LIBCPP_CXX03_LANG
|
||||
#endif // _LIBCPP_STD_VER >= 17
|
||||
|
||||
#endif // _LIBCPP___FILESYSTEM_PERM_OPTIONS_H
|
||||
|
|
67
third_party/libcxx/__filesystem/perms.h
vendored
67
third_party/libcxx/__filesystem/perms.h
vendored
|
@ -10,86 +10,71 @@
|
|||
#ifndef _LIBCPP___FILESYSTEM_PERMS_H
|
||||
#define _LIBCPP___FILESYSTEM_PERMS_H
|
||||
|
||||
#include <__availability>
|
||||
#include <__config>
|
||||
|
||||
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
|
||||
# pragma GCC system_header
|
||||
#endif
|
||||
|
||||
#ifndef _LIBCPP_CXX03_LANG
|
||||
#if _LIBCPP_STD_VER >= 17
|
||||
|
||||
_LIBCPP_BEGIN_NAMESPACE_FILESYSTEM
|
||||
|
||||
_LIBCPP_AVAILABILITY_FILESYSTEM_PUSH
|
||||
|
||||
// On Windows, these permission bits map to one single readonly flag per
|
||||
// file, and the executable bit is always returned as set. When setting
|
||||
// permissions, as long as the write bit is set for either owner, group or
|
||||
// others, the readonly flag is cleared.
|
||||
enum class _LIBCPP_ENUM_VIS perms : unsigned {
|
||||
enum class perms : unsigned {
|
||||
none = 0,
|
||||
|
||||
owner_read = 0400,
|
||||
owner_read = 0400,
|
||||
owner_write = 0200,
|
||||
owner_exec = 0100,
|
||||
owner_all = 0700,
|
||||
owner_exec = 0100,
|
||||
owner_all = 0700,
|
||||
|
||||
group_read = 040,
|
||||
group_read = 040,
|
||||
group_write = 020,
|
||||
group_exec = 010,
|
||||
group_all = 070,
|
||||
group_exec = 010,
|
||||
group_all = 070,
|
||||
|
||||
others_read = 04,
|
||||
others_read = 04,
|
||||
others_write = 02,
|
||||
others_exec = 01,
|
||||
others_all = 07,
|
||||
others_exec = 01,
|
||||
others_all = 07,
|
||||
|
||||
all = 0777,
|
||||
|
||||
set_uid = 04000,
|
||||
set_gid = 02000,
|
||||
set_uid = 04000,
|
||||
set_gid = 02000,
|
||||
sticky_bit = 01000,
|
||||
mask = 07777,
|
||||
unknown = 0xFFFF,
|
||||
mask = 07777,
|
||||
unknown = 0xFFFF,
|
||||
};
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
inline constexpr perms operator&(perms __lhs, perms __rhs) {
|
||||
return static_cast<perms>(static_cast<unsigned>(__lhs) &
|
||||
static_cast<unsigned>(__rhs));
|
||||
_LIBCPP_HIDE_FROM_ABI inline constexpr perms operator&(perms __lhs, perms __rhs) {
|
||||
return static_cast<perms>(static_cast<unsigned>(__lhs) & static_cast<unsigned>(__rhs));
|
||||
}
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
inline constexpr perms operator|(perms __lhs, perms __rhs) {
|
||||
return static_cast<perms>(static_cast<unsigned>(__lhs) |
|
||||
static_cast<unsigned>(__rhs));
|
||||
_LIBCPP_HIDE_FROM_ABI inline constexpr perms operator|(perms __lhs, perms __rhs) {
|
||||
return static_cast<perms>(static_cast<unsigned>(__lhs) | static_cast<unsigned>(__rhs));
|
||||
}
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
inline constexpr perms operator^(perms __lhs, perms __rhs) {
|
||||
return static_cast<perms>(static_cast<unsigned>(__lhs) ^
|
||||
static_cast<unsigned>(__rhs));
|
||||
_LIBCPP_HIDE_FROM_ABI inline constexpr perms operator^(perms __lhs, perms __rhs) {
|
||||
return static_cast<perms>(static_cast<unsigned>(__lhs) ^ static_cast<unsigned>(__rhs));
|
||||
}
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
inline constexpr perms operator~(perms __lhs) {
|
||||
_LIBCPP_HIDE_FROM_ABI inline constexpr perms operator~(perms __lhs) {
|
||||
return static_cast<perms>(~static_cast<unsigned>(__lhs));
|
||||
}
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
inline perms& operator&=(perms& __lhs, perms __rhs) { return __lhs = __lhs & __rhs; }
|
||||
_LIBCPP_HIDE_FROM_ABI inline perms& operator&=(perms& __lhs, perms __rhs) { return __lhs = __lhs & __rhs; }
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
inline perms& operator|=(perms& __lhs, perms __rhs) { return __lhs = __lhs | __rhs; }
|
||||
_LIBCPP_HIDE_FROM_ABI inline perms& operator|=(perms& __lhs, perms __rhs) { return __lhs = __lhs | __rhs; }
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
inline perms& operator^=(perms& __lhs, perms __rhs) { return __lhs = __lhs ^ __rhs; }
|
||||
|
||||
_LIBCPP_AVAILABILITY_FILESYSTEM_POP
|
||||
_LIBCPP_HIDE_FROM_ABI inline perms& operator^=(perms& __lhs, perms __rhs) { return __lhs = __lhs ^ __rhs; }
|
||||
|
||||
_LIBCPP_END_NAMESPACE_FILESYSTEM
|
||||
|
||||
#endif // _LIBCPP_CXX03_LANG
|
||||
#endif // _LIBCPP_STD_VER >= 17
|
||||
|
||||
#endif // _LIBCPP___FILESYSTEM_PERMS_H
|
||||
|
|
|
@ -10,11 +10,11 @@
|
|||
#ifndef _LIBCPP___FILESYSTEM_RECURSIVE_DIRECTORY_ITERATOR_H
|
||||
#define _LIBCPP___FILESYSTEM_RECURSIVE_DIRECTORY_ITERATOR_H
|
||||
|
||||
#include <__availability>
|
||||
#include <__config>
|
||||
#include <__filesystem/directory_entry.h>
|
||||
#include <__filesystem/directory_options.h>
|
||||
#include <__filesystem/path.h>
|
||||
#include <__iterator/default_sentinel.h>
|
||||
#include <__iterator/iterator_traits.h>
|
||||
#include <__memory/shared_ptr.h>
|
||||
#include <__ranges/enable_borrowed_range.h>
|
||||
|
@ -27,51 +27,46 @@
|
|||
# pragma GCC system_header
|
||||
#endif
|
||||
|
||||
#ifndef _LIBCPP_CXX03_LANG
|
||||
_LIBCPP_PUSH_MACROS
|
||||
#include <__undef_macros>
|
||||
|
||||
#if _LIBCPP_STD_VER >= 17 && !defined(_LIBCPP_HAS_NO_FILESYSTEM)
|
||||
|
||||
_LIBCPP_BEGIN_NAMESPACE_FILESYSTEM
|
||||
|
||||
_LIBCPP_AVAILABILITY_FILESYSTEM_PUSH
|
||||
_LIBCPP_AVAILABILITY_FILESYSTEM_LIBRARY_PUSH
|
||||
|
||||
class recursive_directory_iterator {
|
||||
public:
|
||||
using value_type = directory_entry;
|
||||
using difference_type = ptrdiff_t;
|
||||
using pointer = directory_entry const*;
|
||||
using reference = directory_entry const&;
|
||||
using value_type = directory_entry;
|
||||
using difference_type = ptrdiff_t;
|
||||
using pointer = directory_entry const*;
|
||||
using reference = directory_entry const&;
|
||||
using iterator_category = input_iterator_tag;
|
||||
|
||||
public:
|
||||
// constructors and destructor
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
recursive_directory_iterator() noexcept : __rec_(false) {}
|
||||
_LIBCPP_HIDE_FROM_ABI recursive_directory_iterator() noexcept : __rec_(false) {}
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
explicit recursive_directory_iterator(
|
||||
_LIBCPP_HIDE_FROM_ABI explicit recursive_directory_iterator(
|
||||
const path& __p, directory_options __xoptions = directory_options::none)
|
||||
: recursive_directory_iterator(__p, __xoptions, nullptr) {}
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
recursive_directory_iterator(const path& __p, directory_options __xoptions,
|
||||
error_code& __ec)
|
||||
_LIBCPP_HIDE_FROM_ABI recursive_directory_iterator(const path& __p, directory_options __xoptions, error_code& __ec)
|
||||
: recursive_directory_iterator(__p, __xoptions, &__ec) {}
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
recursive_directory_iterator(const path& __p, error_code& __ec)
|
||||
_LIBCPP_HIDE_FROM_ABI recursive_directory_iterator(const path& __p, error_code& __ec)
|
||||
: recursive_directory_iterator(__p, directory_options::none, &__ec) {}
|
||||
|
||||
_LIBCPP_HIDE_FROM_ABI recursive_directory_iterator(const recursive_directory_iterator&) = default;
|
||||
_LIBCPP_HIDE_FROM_ABI recursive_directory_iterator(recursive_directory_iterator&&) = default;
|
||||
_LIBCPP_HIDE_FROM_ABI recursive_directory_iterator(recursive_directory_iterator&&) = default;
|
||||
|
||||
_LIBCPP_HIDE_FROM_ABI recursive_directory_iterator&
|
||||
operator=(const recursive_directory_iterator&) = default;
|
||||
_LIBCPP_HIDE_FROM_ABI recursive_directory_iterator& operator=(const recursive_directory_iterator&) = default;
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
recursive_directory_iterator&
|
||||
operator=(recursive_directory_iterator&& __o) noexcept {
|
||||
_LIBCPP_HIDE_FROM_ABI recursive_directory_iterator& operator=(recursive_directory_iterator&& __o) noexcept {
|
||||
// non-default implementation provided to support self-move assign.
|
||||
if (this != &__o) {
|
||||
__imp_ = _VSTD::move(__o.__imp_);
|
||||
__imp_ = std::move(__o.__imp_);
|
||||
__rec_ = __o.__rec_;
|
||||
}
|
||||
return *this;
|
||||
|
@ -79,108 +74,91 @@ public:
|
|||
|
||||
_LIBCPP_HIDE_FROM_ABI ~recursive_directory_iterator() = default;
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
const directory_entry& operator*() const { return __dereference(); }
|
||||
_LIBCPP_HIDE_FROM_ABI const directory_entry& operator*() const { return __dereference(); }
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
const directory_entry* operator->() const { return &__dereference(); }
|
||||
_LIBCPP_HIDE_FROM_ABI const directory_entry* operator->() const { return &__dereference(); }
|
||||
|
||||
_LIBCPP_HIDE_FROM_ABI recursive_directory_iterator& operator++() { return __increment(); }
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
__dir_element_proxy operator++(int) {
|
||||
_LIBCPP_HIDE_FROM_ABI __dir_element_proxy operator++(int) {
|
||||
__dir_element_proxy __p(**this);
|
||||
__increment();
|
||||
return __p;
|
||||
}
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
recursive_directory_iterator& increment(error_code& __ec) {
|
||||
return __increment(&__ec);
|
||||
_LIBCPP_HIDE_FROM_ABI recursive_directory_iterator& increment(error_code& __ec) { return __increment(&__ec); }
|
||||
|
||||
_LIBCPP_EXPORTED_FROM_ABI directory_options options() const;
|
||||
_LIBCPP_EXPORTED_FROM_ABI int depth() const;
|
||||
|
||||
_LIBCPP_HIDE_FROM_ABI void pop() { __pop(); }
|
||||
|
||||
_LIBCPP_HIDE_FROM_ABI void pop(error_code& __ec) { __pop(&__ec); }
|
||||
|
||||
_LIBCPP_HIDE_FROM_ABI bool recursion_pending() const { return __rec_; }
|
||||
|
||||
_LIBCPP_HIDE_FROM_ABI void disable_recursion_pending() { __rec_ = false; }
|
||||
|
||||
# if _LIBCPP_STD_VER >= 20
|
||||
|
||||
_LIBCPP_HIDE_FROM_ABI bool operator==(default_sentinel_t) const noexcept {
|
||||
return *this == recursive_directory_iterator();
|
||||
}
|
||||
|
||||
_LIBCPP_FUNC_VIS directory_options options() const;
|
||||
_LIBCPP_FUNC_VIS int depth() const;
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
void pop() { __pop(); }
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
void pop(error_code& __ec) { __pop(&__ec); }
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
bool recursion_pending() const { return __rec_; }
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
void disable_recursion_pending() { __rec_ = false; }
|
||||
# endif
|
||||
|
||||
private:
|
||||
_LIBCPP_FUNC_VIS
|
||||
recursive_directory_iterator(const path& __p, directory_options __opt,
|
||||
error_code* __ec);
|
||||
_LIBCPP_EXPORTED_FROM_ABI recursive_directory_iterator(const path& __p, directory_options __opt, error_code* __ec);
|
||||
_LIBCPP_EXPORTED_FROM_ABI const directory_entry& __dereference() const;
|
||||
_LIBCPP_EXPORTED_FROM_ABI bool __try_recursion(error_code* __ec);
|
||||
_LIBCPP_EXPORTED_FROM_ABI void __advance(error_code* __ec = nullptr);
|
||||
_LIBCPP_EXPORTED_FROM_ABI recursive_directory_iterator& __increment(error_code* __ec = nullptr);
|
||||
_LIBCPP_EXPORTED_FROM_ABI void __pop(error_code* __ec = nullptr);
|
||||
|
||||
_LIBCPP_FUNC_VIS
|
||||
const directory_entry& __dereference() const;
|
||||
|
||||
_LIBCPP_FUNC_VIS
|
||||
bool __try_recursion(error_code* __ec);
|
||||
|
||||
_LIBCPP_FUNC_VIS
|
||||
void __advance(error_code* __ec = nullptr);
|
||||
|
||||
_LIBCPP_FUNC_VIS
|
||||
recursive_directory_iterator& __increment(error_code* __ec = nullptr);
|
||||
|
||||
_LIBCPP_FUNC_VIS
|
||||
void __pop(error_code* __ec = nullptr);
|
||||
|
||||
inline _LIBCPP_INLINE_VISIBILITY friend bool
|
||||
operator==(const recursive_directory_iterator&,
|
||||
const recursive_directory_iterator&) noexcept;
|
||||
inline _LIBCPP_HIDE_FROM_ABI friend bool
|
||||
operator==(const recursive_directory_iterator&, const recursive_directory_iterator&) noexcept;
|
||||
|
||||
struct _LIBCPP_HIDDEN __shared_imp;
|
||||
shared_ptr<__shared_imp> __imp_;
|
||||
bool __rec_;
|
||||
}; // class recursive_directory_iterator
|
||||
|
||||
inline _LIBCPP_INLINE_VISIBILITY bool
|
||||
operator==(const recursive_directory_iterator& __lhs,
|
||||
const recursive_directory_iterator& __rhs) noexcept {
|
||||
inline _LIBCPP_HIDE_FROM_ABI bool
|
||||
operator==(const recursive_directory_iterator& __lhs, const recursive_directory_iterator& __rhs) noexcept {
|
||||
return __lhs.__imp_ == __rhs.__imp_;
|
||||
}
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
inline bool operator!=(const recursive_directory_iterator& __lhs,
|
||||
const recursive_directory_iterator& __rhs) noexcept {
|
||||
_LIBCPP_HIDE_FROM_ABI inline bool
|
||||
operator!=(const recursive_directory_iterator& __lhs, const recursive_directory_iterator& __rhs) noexcept {
|
||||
return !(__lhs == __rhs);
|
||||
}
|
||||
// enable recursive_directory_iterator range-based for statements
|
||||
inline _LIBCPP_INLINE_VISIBILITY recursive_directory_iterator
|
||||
begin(recursive_directory_iterator __iter) noexcept {
|
||||
inline _LIBCPP_HIDE_FROM_ABI recursive_directory_iterator begin(recursive_directory_iterator __iter) noexcept {
|
||||
return __iter;
|
||||
}
|
||||
|
||||
inline _LIBCPP_INLINE_VISIBILITY recursive_directory_iterator
|
||||
end(recursive_directory_iterator) noexcept {
|
||||
inline _LIBCPP_HIDE_FROM_ABI recursive_directory_iterator end(recursive_directory_iterator) noexcept {
|
||||
return recursive_directory_iterator();
|
||||
}
|
||||
|
||||
_LIBCPP_AVAILABILITY_FILESYSTEM_POP
|
||||
_LIBCPP_AVAILABILITY_FILESYSTEM_LIBRARY_POP
|
||||
|
||||
_LIBCPP_END_NAMESPACE_FILESYSTEM
|
||||
|
||||
#if _LIBCPP_STD_VER >= 20
|
||||
# if _LIBCPP_STD_VER >= 20
|
||||
|
||||
template <>
|
||||
_LIBCPP_AVAILABILITY_FILESYSTEM
|
||||
inline constexpr bool _VSTD::ranges::enable_borrowed_range<_VSTD_FS::recursive_directory_iterator> = true;
|
||||
_LIBCPP_AVAILABILITY_FILESYSTEM_LIBRARY inline constexpr bool
|
||||
std::ranges::enable_borrowed_range<std::filesystem::recursive_directory_iterator> = true;
|
||||
|
||||
template <>
|
||||
_LIBCPP_AVAILABILITY_FILESYSTEM
|
||||
inline constexpr bool _VSTD::ranges::enable_view<_VSTD_FS::recursive_directory_iterator> = true;
|
||||
_LIBCPP_AVAILABILITY_FILESYSTEM_LIBRARY inline constexpr bool
|
||||
std::ranges::enable_view<std::filesystem::recursive_directory_iterator> = true;
|
||||
|
||||
#endif // _LIBCPP_STD_VER >= 20
|
||||
# endif // _LIBCPP_STD_VER >= 20
|
||||
|
||||
#endif // _LIBCPP_CXX03_LANG
|
||||
#endif // _LIBCPP_STD_VER >= 17 && !defined(_LIBCPP_HAS_NO_FILESYSTEM)
|
||||
|
||||
_LIBCPP_POP_MACROS
|
||||
|
||||
#endif // _LIBCPP___FILESYSTEM_RECURSIVE_DIRECTORY_ITERATOR_H
|
||||
|
|
11
third_party/libcxx/__filesystem/space_info.h
vendored
11
third_party/libcxx/__filesystem/space_info.h
vendored
|
@ -10,7 +10,6 @@
|
|||
#ifndef _LIBCPP___FILESYSTEM_SPACE_INFO_H
|
||||
#define _LIBCPP___FILESYSTEM_SPACE_INFO_H
|
||||
|
||||
#include <__availability>
|
||||
#include <__config>
|
||||
#include <cstdint>
|
||||
|
||||
|
@ -18,13 +17,11 @@
|
|||
# pragma GCC system_header
|
||||
#endif
|
||||
|
||||
#ifndef _LIBCPP_CXX03_LANG
|
||||
#if _LIBCPP_STD_VER >= 17
|
||||
|
||||
_LIBCPP_BEGIN_NAMESPACE_FILESYSTEM
|
||||
|
||||
_LIBCPP_AVAILABILITY_FILESYSTEM_PUSH
|
||||
|
||||
struct _LIBCPP_TYPE_VIS space_info {
|
||||
struct _LIBCPP_EXPORTED_FROM_ABI space_info {
|
||||
uintmax_t capacity;
|
||||
uintmax_t free;
|
||||
uintmax_t available;
|
||||
|
@ -34,10 +31,8 @@ struct _LIBCPP_TYPE_VIS space_info {
|
|||
# endif
|
||||
};
|
||||
|
||||
_LIBCPP_AVAILABILITY_FILESYSTEM_POP
|
||||
|
||||
_LIBCPP_END_NAMESPACE_FILESYSTEM
|
||||
|
||||
#endif // _LIBCPP_CXX03_LANG
|
||||
#endif // _LIBCPP_STD_VER >= 17
|
||||
|
||||
#endif // _LIBCPP___FILESYSTEM_SPACE_INFO_H
|
||||
|
|
69
third_party/libcxx/__filesystem/u8path.h
vendored
69
third_party/libcxx/__filesystem/u8path.h
vendored
|
@ -11,7 +11,6 @@
|
|||
#define _LIBCPP___FILESYSTEM_U8PATH_H
|
||||
|
||||
#include <__algorithm/unwrap_iter.h>
|
||||
#include <__availability>
|
||||
#include <__config>
|
||||
#include <__filesystem/path.h>
|
||||
#include <string>
|
||||
|
@ -19,52 +18,48 @@
|
|||
// Only required on Windows for __widen_from_utf8, and included conservatively
|
||||
// because it requires support for localization.
|
||||
#if defined(_LIBCPP_WIN32API)
|
||||
# include <locale>
|
||||
# include <locale>
|
||||
#endif
|
||||
|
||||
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
|
||||
# pragma GCC system_header
|
||||
#endif
|
||||
|
||||
#ifndef _LIBCPP_CXX03_LANG
|
||||
#if _LIBCPP_STD_VER >= 17
|
||||
|
||||
_LIBCPP_BEGIN_NAMESPACE_FILESYSTEM
|
||||
|
||||
_LIBCPP_AVAILABILITY_FILESYSTEM_PUSH
|
||||
_LIBCPP_AVAILABILITY_FILESYSTEM_LIBRARY_PUSH
|
||||
|
||||
template <class _InputIt>
|
||||
_LIBCPP_INLINE_VISIBILITY _LIBCPP_DEPRECATED_WITH_CHAR8_T
|
||||
typename enable_if<__is_pathable<_InputIt>::value, path>::type
|
||||
u8path(_InputIt __f, _InputIt __l) {
|
||||
template <class _InputIt, __enable_if_t<__is_pathable<_InputIt>::value, int> = 0>
|
||||
_LIBCPP_HIDE_FROM_ABI _LIBCPP_DEPRECATED_WITH_CHAR8_T path u8path(_InputIt __f, _InputIt __l) {
|
||||
static_assert(
|
||||
#ifndef _LIBCPP_HAS_NO_CHAR8_T
|
||||
# ifndef _LIBCPP_HAS_NO_CHAR8_T
|
||||
is_same<typename __is_pathable<_InputIt>::__char_type, char8_t>::value ||
|
||||
#endif
|
||||
is_same<typename __is_pathable<_InputIt>::__char_type, char>::value,
|
||||
# endif
|
||||
is_same<typename __is_pathable<_InputIt>::__char_type, char>::value,
|
||||
"u8path(Iter, Iter) requires Iter have a value_type of type 'char'"
|
||||
" or 'char8_t'");
|
||||
#if defined(_LIBCPP_WIN32API)
|
||||
# if defined(_LIBCPP_WIN32API)
|
||||
string __tmp(__f, __l);
|
||||
using _CVT = __widen_from_utf8<sizeof(wchar_t) * __CHAR_BIT__>;
|
||||
_VSTD::wstring __w;
|
||||
std::wstring __w;
|
||||
__w.reserve(__tmp.size());
|
||||
_CVT()(back_inserter(__w), __tmp.data(), __tmp.data() + __tmp.size());
|
||||
return path(__w);
|
||||
#else
|
||||
# else
|
||||
return path(__f, __l);
|
||||
#endif /* !_LIBCPP_WIN32API */
|
||||
# endif /* !_LIBCPP_WIN32API */
|
||||
}
|
||||
|
||||
#if defined(_LIBCPP_WIN32API)
|
||||
template <class _InputIt>
|
||||
_LIBCPP_INLINE_VISIBILITY _LIBCPP_DEPRECATED_WITH_CHAR8_T
|
||||
typename enable_if<__is_pathable<_InputIt>::value, path>::type
|
||||
u8path(_InputIt __f, _NullSentinel) {
|
||||
# if defined(_LIBCPP_WIN32API)
|
||||
template <class _InputIt, __enable_if_t<__is_pathable<_InputIt>::value, int> = 0>
|
||||
_LIBCPP_HIDE_FROM_ABI _LIBCPP_DEPRECATED_WITH_CHAR8_T path u8path(_InputIt __f, _NullSentinel) {
|
||||
static_assert(
|
||||
#ifndef _LIBCPP_HAS_NO_CHAR8_T
|
||||
# ifndef _LIBCPP_HAS_NO_CHAR8_T
|
||||
is_same<typename __is_pathable<_InputIt>::__char_type, char8_t>::value ||
|
||||
#endif
|
||||
is_same<typename __is_pathable<_InputIt>::__char_type, char>::value,
|
||||
# endif
|
||||
is_same<typename __is_pathable<_InputIt>::__char_type, char>::value,
|
||||
"u8path(Iter, Iter) requires Iter have a value_type of type 'char'"
|
||||
" or 'char8_t'");
|
||||
string __tmp;
|
||||
|
@ -72,36 +67,34 @@ _LIBCPP_INLINE_VISIBILITY _LIBCPP_DEPRECATED_WITH_CHAR8_T
|
|||
for (; *__f != __sentinel; ++__f)
|
||||
__tmp.push_back(*__f);
|
||||
using _CVT = __widen_from_utf8<sizeof(wchar_t) * __CHAR_BIT__>;
|
||||
_VSTD::wstring __w;
|
||||
std::wstring __w;
|
||||
__w.reserve(__tmp.size());
|
||||
_CVT()(back_inserter(__w), __tmp.data(), __tmp.data() + __tmp.size());
|
||||
return path(__w);
|
||||
}
|
||||
#endif /* _LIBCPP_WIN32API */
|
||||
# endif /* _LIBCPP_WIN32API */
|
||||
|
||||
template <class _Source>
|
||||
_LIBCPP_INLINE_VISIBILITY _LIBCPP_DEPRECATED_WITH_CHAR8_T
|
||||
typename enable_if<__is_pathable<_Source>::value, path>::type
|
||||
u8path(const _Source& __s) {
|
||||
template <class _Source, __enable_if_t<__is_pathable<_Source>::value, int> = 0>
|
||||
_LIBCPP_HIDE_FROM_ABI _LIBCPP_DEPRECATED_WITH_CHAR8_T path u8path(const _Source& __s) {
|
||||
static_assert(
|
||||
#ifndef _LIBCPP_HAS_NO_CHAR8_T
|
||||
# ifndef _LIBCPP_HAS_NO_CHAR8_T
|
||||
is_same<typename __is_pathable<_Source>::__char_type, char8_t>::value ||
|
||||
#endif
|
||||
is_same<typename __is_pathable<_Source>::__char_type, char>::value,
|
||||
# endif
|
||||
is_same<typename __is_pathable<_Source>::__char_type, char>::value,
|
||||
"u8path(Source const&) requires Source have a character type of type "
|
||||
"'char' or 'char8_t'");
|
||||
#if defined(_LIBCPP_WIN32API)
|
||||
# if defined(_LIBCPP_WIN32API)
|
||||
using _Traits = __is_pathable<_Source>;
|
||||
return u8path(_VSTD::__unwrap_iter(_Traits::__range_begin(__s)), _VSTD::__unwrap_iter(_Traits::__range_end(__s)));
|
||||
#else
|
||||
return u8path(std::__unwrap_iter(_Traits::__range_begin(__s)), std::__unwrap_iter(_Traits::__range_end(__s)));
|
||||
# else
|
||||
return path(__s);
|
||||
#endif
|
||||
# endif
|
||||
}
|
||||
|
||||
_LIBCPP_AVAILABILITY_FILESYSTEM_POP
|
||||
_LIBCPP_AVAILABILITY_FILESYSTEM_LIBRARY_POP
|
||||
|
||||
_LIBCPP_END_NAMESPACE_FILESYSTEM
|
||||
|
||||
#endif // _LIBCPP_CXX03_LANG
|
||||
#endif // _LIBCPP_STD_VER >= 17
|
||||
|
||||
#endif // _LIBCPP___FILESYSTEM_U8PATH_H
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue