30 #ifndef _GLIBCXX_FS_FWD_H
31 #define _GLIBCXX_FS_FWD_H 1
33 #if __cplusplus >= 201703L
35 #include <system_error>
39 namespace std _GLIBCXX_VISIBILITY(default)
41 _GLIBCXX_BEGIN_NAMESPACE_VERSION
50 #if _GLIBCXX_USE_CXX11_ABI
51 inline namespace __cxx11 __attribute__((__abi_tag__ ("cxx11"))) { }
56 _GLIBCXX_BEGIN_NAMESPACE_CXX11
58 class filesystem_error;
59 class directory_entry;
60 class directory_iterator;
61 class recursive_directory_iterator;
62 _GLIBCXX_END_NAMESPACE_CXX11
71 enum class file_type : signed char {
72 none = 0, not_found = -1, regular = 1, directory = 2, symlink = 3,
73 block = 4, character = 5, fifo = 6, socket = 7, unknown = 8
79 skip_existing = 1, overwrite_existing = 2, update_existing = 4,
81 copy_symlinks = 16, skip_symlinks = 32,
82 directories_only = 64, create_symlinks = 128, create_hard_links = 256
88 using __utype =
typename std::underlying_type<copy_options>::type;
90 static_cast<__utype
>(__x) &
static_cast<__utype
>(__y));
96 using __utype =
typename std::underlying_type<copy_options>::type;
98 static_cast<__utype
>(__x) |
static_cast<__utype
>(__y));
104 using __utype =
typename std::underlying_type<copy_options>::type;
106 static_cast<__utype
>(__x) ^
static_cast<__utype
>(__y));
112 using __utype =
typename std::underlying_type<copy_options>::type;
113 return static_cast<copy_options>(~static_cast<__utype>(__x));
118 {
return __x = __x & __y; }
122 {
return __x = __x | __y; }
126 {
return __x = __x ^ __y; }
130 enum class perms : unsigned {
155 using __utype =
typename std::underlying_type<perms>::type;
156 return static_cast<perms>(
157 static_cast<__utype
>(__x) &
static_cast<__utype
>(__y));
163 using __utype =
typename std::underlying_type<perms>::type;
164 return static_cast<perms>(
165 static_cast<__utype
>(__x) |
static_cast<__utype
>(__y));
171 using __utype =
typename std::underlying_type<perms>::type;
172 return static_cast<perms>(
173 static_cast<__utype
>(__x) ^
static_cast<__utype
>(__y));
177 operator~(
perms __x) noexcept
179 using __utype =
typename std::underlying_type<perms>::type;
180 return static_cast<perms>(~static_cast<__utype>(__x));
185 {
return __x = __x & __y; }
189 {
return __x = __x | __y; }
193 {
return __x = __x ^ __y; }
196 enum class perm_options : unsigned {
203 constexpr perm_options
204 operator&(perm_options __x, perm_options __y) noexcept
206 using __utype =
typename std::underlying_type<perm_options>::type;
207 return static_cast<perm_options
>(
208 static_cast<__utype
>(__x) &
static_cast<__utype
>(__y));
211 constexpr perm_options
212 operator|(perm_options __x, perm_options __y) noexcept
214 using __utype =
typename std::underlying_type<perm_options>::type;
215 return static_cast<perm_options
>(
216 static_cast<__utype
>(__x) |
static_cast<__utype
>(__y));
219 constexpr perm_options
220 operator^(perm_options __x, perm_options __y) noexcept
222 using __utype =
typename std::underlying_type<perm_options>::type;
223 return static_cast<perm_options
>(
224 static_cast<__utype
>(__x) ^
static_cast<__utype
>(__y));
227 constexpr perm_options
228 operator~(perm_options __x) noexcept
230 using __utype =
typename std::underlying_type<perm_options>::type;
231 return static_cast<perm_options
>(~static_cast<__utype>(__x));
235 operator&=(perm_options& __x, perm_options __y) noexcept
236 {
return __x = __x & __y; }
239 operator|=(perm_options& __x, perm_options __y) noexcept
240 {
return __x = __x | __y; }
243 operator^=(perm_options& __x, perm_options __y) noexcept
244 {
return __x = __x ^ __y; }
247 enum class directory_options : unsigned char {
248 none = 0, follow_directory_symlink = 1, skip_permission_denied = 2
251 constexpr directory_options
252 operator&(directory_options __x, directory_options __y) noexcept
254 using __utype =
typename std::underlying_type<directory_options>::type;
255 return static_cast<directory_options
>(
256 static_cast<__utype
>(__x) &
static_cast<__utype
>(__y));
259 constexpr directory_options
260 operator|(directory_options __x, directory_options __y) noexcept
262 using __utype =
typename std::underlying_type<directory_options>::type;
263 return static_cast<directory_options
>(
264 static_cast<__utype
>(__x) |
static_cast<__utype
>(__y));
267 constexpr directory_options
268 operator^(directory_options __x, directory_options __y) noexcept
270 using __utype =
typename std::underlying_type<directory_options>::type;
271 return static_cast<directory_options
>(
272 static_cast<__utype
>(__x) ^
static_cast<__utype
>(__y));
275 constexpr directory_options
276 operator~(directory_options __x) noexcept
278 using __utype =
typename std::underlying_type<directory_options>::type;
279 return static_cast<directory_options
>(~static_cast<__utype>(__x));
282 inline directory_options&
283 operator&=(directory_options& __x, directory_options __y) noexcept
284 {
return __x = __x & __y; }
286 inline directory_options&
287 operator|=(directory_options& __x, directory_options __y) noexcept
288 {
return __x = __x | __y; }
290 inline directory_options&
291 operator^=(directory_options& __x, directory_options __y) noexcept
292 {
return __x = __x ^ __y; }
297 using rep = duration::rep;
298 using period = duration::period;
299 using time_point = chrono::time_point<__file_clock>;
300 static constexpr
bool is_steady =
false;
304 {
return _S_from_sys(chrono::system_clock::now()); }
307 using __sys_clock = chrono::system_clock;
316 template<
typename _Dur>
318 chrono::time_point<__file_clock, _Dur>
319 _S_from_sys(
const chrono::time_point<__sys_clock, _Dur>& __t) noexcept
321 using __file_time = chrono::time_point<__file_clock, _Dur>;
322 return __file_time{__t.time_since_epoch()} - _S_epoch_diff;
326 template<
typename _Dur>
328 chrono::time_point<__sys_clock, _Dur>
329 _S_to_sys(
const chrono::time_point<__file_clock, _Dur>& __t) noexcept
331 using __sys_time = chrono::time_point<__sys_clock, _Dur>;
332 return __sys_time{__t.time_since_epoch()} + _S_epoch_diff;
336 using file_time_type = __file_clock::time_point;
340 void copy(
const path& __from,
const path& __to,
copy_options __options);
341 void copy(
const path& __from,
const path& __to,
copy_options __options,
344 bool copy_file(
const path& __from,
const path& __to,
copy_options __option);
345 bool copy_file(
const path& __from,
const path& __to,
copy_options __option,
350 bool exists(file_status) noexcept;
352 bool is_other(file_status) noexcept;
354 uintmax_t file_size(
const path&);
355 uintmax_t file_size(
const path&, error_code&) noexcept;
356 uintmax_t hard_link_count(
const path&);
357 uintmax_t hard_link_count(
const path&, error_code&) noexcept;
358 file_time_type last_write_time(
const path&);
359 file_time_type last_write_time(
const path&, error_code&) noexcept;
361 void permissions(
const path&,
perms, perm_options, error_code&) noexcept;
363 path proximate(
const path& __p,
const path&
__base, error_code& __ec);
364 path proximate(
const path& __p,
const path&
__base, error_code& __ec);
366 path relative(
const path& __p,
const path&
__base, error_code& __ec);
368 file_status status(
const path&);
369 file_status status(
const path&, error_code&) noexcept;
371 bool status_known(file_status) noexcept;
373 file_status symlink_status(
const path&);
374 file_status symlink_status(
const path&, error_code&) noexcept;
376 bool is_regular_file(file_status) noexcept;
377 bool is_symlink(file_status) noexcept;
381 _GLIBCXX_END_NAMESPACE_VERSION
384 #endif // _GLIBCXX_FS_FWD_H