30 #ifndef _GLIBCXX_FS_DIR_H
31 #define _GLIBCXX_FS_DIR_H 1
33 #if __cplusplus >= 201703L
37 # include <bits/shared_ptr.h>
39 #if __cplusplus > 201703L
43 namespace std _GLIBCXX_VISIBILITY(default)
45 _GLIBCXX_BEGIN_NAMESPACE_VERSION
62 : _M_type(__ft), _M_perms(__prms) { }
72 file_type type()
const noexcept {
return _M_type; }
73 perms permissions()
const noexcept {
return _M_perms; }
76 void type(
file_type __ft) noexcept { _M_type = __ft; }
77 void permissions(
perms __prms) noexcept { _M_perms = __prms; }
79 #if __cpp_lib_three_way_comparison
89 _GLIBCXX_BEGIN_NAMESPACE_CXX11
140 _M_path.replace_filename(__p);
147 _M_path.replace_filename(__p);
153 { _M_type = symlink_status().type(); }
157 { _M_type = symlink_status(__ec).type(); }
165 {
return filesystem::exists(
file_status{_M_file_type()}); }
169 {
return filesystem::exists(
file_status{_M_file_type(__ec)}); }
172 is_block_file()
const
173 {
return _M_file_type() == file_type::block; }
176 is_block_file(
error_code& __ec)
const noexcept
177 {
return _M_file_type(__ec) == file_type::block; }
180 is_character_file()
const
181 {
return _M_file_type() == file_type::character; }
184 is_character_file(
error_code& __ec)
const noexcept
185 {
return _M_file_type(__ec) == file_type::character; }
189 {
return _M_file_type() == file_type::directory; }
193 {
return _M_file_type(__ec) == file_type::directory; }
197 {
return _M_file_type() == file_type::fifo; }
201 {
return _M_file_type(__ec) == file_type::fifo; }
205 {
return filesystem::is_other(
file_status{_M_file_type()}); }
209 {
return filesystem::is_other(
file_status{_M_file_type(__ec)}); }
212 is_regular_file()
const
213 {
return _M_file_type() == file_type::regular; }
216 is_regular_file(
error_code& __ec)
const noexcept
217 {
return _M_file_type(__ec) == file_type::regular; }
221 {
return _M_file_type() == file_type::socket; }
225 {
return _M_file_type(__ec) == file_type::socket; }
230 if (_M_type != file_type::none)
231 return _M_type == file_type::symlink;
232 return symlink_status().type() == file_type::symlink;
238 if (_M_type != file_type::none)
239 return _M_type == file_type::symlink;
240 return symlink_status(__ec).type() == file_type::symlink;
245 {
return filesystem::file_size(_M_path); }
249 {
return filesystem::file_size(_M_path, __ec); }
252 hard_link_count()
const
253 {
return filesystem::hard_link_count(_M_path); }
256 hard_link_count(
error_code& __ec)
const noexcept
257 {
return filesystem::hard_link_count(_M_path, __ec); }
260 last_write_time()
const
261 {
return filesystem::last_write_time(_M_path); }
265 last_write_time(
error_code& __ec)
const noexcept
266 {
return filesystem::last_write_time(_M_path, __ec); }
270 {
return filesystem::status(_M_path); }
274 {
return filesystem::status(_M_path, __ec); }
277 symlink_status()
const
278 {
return filesystem::symlink_status(_M_path); }
281 symlink_status(
error_code& __ec)
const noexcept
282 {
return filesystem::symlink_status(_M_path, __ec); }
286 {
return _M_path == __rhs._M_path; }
288 #if __cpp_lib_three_way_comparison
291 {
return _M_path <=> __rhs._M_path; }
295 {
return _M_path != __rhs._M_path; }
299 {
return _M_path < __rhs._M_path; }
303 {
return _M_path <= __rhs._M_path; }
307 {
return _M_path > __rhs._M_path; }
311 {
return _M_path >= __rhs._M_path; }
321 template<
typename _CharT,
typename _Traits>
325 {
return __os << __d.path(); }
328 : _M_path(__p), _M_type(__t)
335 if (_M_type != file_type::none && _M_type != file_type::symlink)
337 return status().type();
344 if (_M_type != file_type::none && _M_type != file_type::symlink)
349 return status(__ec).type();
359 const directory_entry& operator*()
const& noexcept {
return _M_entry; }
378 typedef ptrdiff_t difference_type;
430 return !__rhs._M_dir.owner_before(__lhs._M_dir)
431 && !__lhs._M_dir.owner_before(__rhs._M_dir);
437 {
return !(__lhs == __rhs); }
441 std::__shared_ptr<_Dir> _M_dir;
465 typedef ptrdiff_t difference_type;
495 int depth()
const noexcept;
496 bool recursion_pending()
const noexcept;
520 void disable_recursion_pending() noexcept;
529 return !__rhs._M_dirs.owner_before(__lhs._M_dirs)
530 && !__lhs._M_dirs.owner_before(__rhs._M_dirs);
536 {
return !(__lhs == __rhs); }
539 std::__shared_ptr<_Dir_stack> _M_dirs;
547 filesystem::remove_all(
const path&);
566 _GLIBCXX_END_NAMESPACE_CXX11
574 extern template class
575 __shared_ptr<filesystem::_Dir>;
576 extern template class
577 __shared_ptr<filesystem::recursive_directory_iterator::_Dir_stack>;
579 _GLIBCXX_END_NAMESPACE_VERSION
recursive_directory_iterator end(recursive_directory_iterator) noexcept
Return a past-the-end recursive_directory_iterator.
directory_iterator end(directory_iterator) noexcept
Return a past-the-end directory_iterator.
directory_iterator begin(directory_iterator __iter) noexcept
Enable range-based for using directory_iterator.
perms
Bitmask type representing file access permissions.
directory_options
Bitmask type controlling directory iteration.
file_type
Enumerated type representing the type of a file.
recursive_directory_iterator begin(recursive_directory_iterator __iter) noexcept
Enable range-based for using recursive_directory_iterator.
constexpr std::remove_reference< _Tp >::type && move(_Tp &&__t) noexcept
Convert a value to an rvalue.
ISO C++ entities toplevel namespace is std.
std::basic_ostream< _CharT, _Traits > & operator<<(std::basic_ostream< _CharT, _Traits > &__os, const bitset< _Nb > &__x)
Global I/O operators for bitsets.
Template class basic_ostream.
chrono::time_point represents a point in time as measured by a clock
Information about a file's type and permissions.
The value type used by directory iterators.
Proxy returned by post-increment on directory iterators.
Iterator type for traversing the entries in a single directory.
Iterator type for recursively traversing a directory hierarchy.