source: Daodan/MSYS2/mingw32/include/c++/11.2.0/bits/fs_fwd.h@ 1171

Last change on this file since 1171 was 1166, checked in by rossy, 3 years ago

Daodan: Replace MinGW build env with an up-to-date MSYS2 env

File size: 10.0 KB
RevLine 
[1166]1// Filesystem declarations -*- C++ -*-
2
3// Copyright (C) 2014-2021 Free Software Foundation, Inc.
4//
5// This file is part of the GNU ISO C++ Library. This library is free
6// software; you can redistribute it and/or modify it under the
7// terms of the GNU General Public License as published by the
8// Free Software Foundation; either version 3, or (at your option)
9// any later version.
10
11// This library is distributed in the hope that it will be useful,
12// but WITHOUT ANY WARRANTY; without even the implied warranty of
13// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14// GNU General Public License for more details.
15
16// Under Section 7 of GPL version 3, you are granted additional
17// permissions described in the GCC Runtime Library Exception, version
18// 3.1, as published by the Free Software Foundation.
19
20// You should have received a copy of the GNU General Public License and
21// a copy of the GCC Runtime Library Exception along with this program;
22// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
23// <http://www.gnu.org/licenses/>.
24
25/** @file include/bits/fs_fwd.h
26 * This is an internal header file, included by other library headers.
27 * Do not attempt to use it directly. @headername{filesystem}
28 */
29
30#ifndef _GLIBCXX_FS_FWD_H
31#define _GLIBCXX_FS_FWD_H 1
32
33#if __cplusplus >= 201703L
34
35#include <system_error>
36#include <cstdint>
37#include <chrono>
38
39namespace std _GLIBCXX_VISIBILITY(default)
40{
41_GLIBCXX_BEGIN_NAMESPACE_VERSION
42
43/** @addtogroup filesystem
44 * @{
45 */
46
47/// ISO C++ 2017 namespace for File System library
48namespace filesystem
49{
50#if _GLIBCXX_USE_CXX11_ABI
51inline namespace __cxx11 __attribute__((__abi_tag__ ("cxx11"))) { }
52#endif
53
54
55 class file_status;
56_GLIBCXX_BEGIN_NAMESPACE_CXX11
57 class path;
58 class filesystem_error;
59 class directory_entry;
60 class directory_iterator;
61 class recursive_directory_iterator;
62_GLIBCXX_END_NAMESPACE_CXX11
63
64 struct space_info
65 {
66 uintmax_t capacity;
67 uintmax_t free;
68 uintmax_t available;
69
70#if __cpp_impl_three_way_comparison >= 201907L
71 friend bool operator==(const space_info&, const space_info&) = default;
72#endif
73 };
74
75 enum class file_type : signed char {
76 none = 0, not_found = -1, regular = 1, directory = 2, symlink = 3,
77 block = 4, character = 5, fifo = 6, socket = 7, unknown = 8
78 };
79
80 /// Bitmask type
81 enum class copy_options : unsigned short {
82 none = 0,
83 skip_existing = 1, overwrite_existing = 2, update_existing = 4,
84 recursive = 8,
85 copy_symlinks = 16, skip_symlinks = 32,
86 directories_only = 64, create_symlinks = 128, create_hard_links = 256
87 };
88
89 constexpr copy_options
90 operator&(copy_options __x, copy_options __y) noexcept
91 {
92 using __utype = typename std::underlying_type<copy_options>::type;
93 return static_cast<copy_options>(
94 static_cast<__utype>(__x) & static_cast<__utype>(__y));
95 }
96
97 constexpr copy_options
98 operator|(copy_options __x, copy_options __y) noexcept
99 {
100 using __utype = typename std::underlying_type<copy_options>::type;
101 return static_cast<copy_options>(
102 static_cast<__utype>(__x) | static_cast<__utype>(__y));
103 }
104
105 constexpr copy_options
106 operator^(copy_options __x, copy_options __y) noexcept
107 {
108 using __utype = typename std::underlying_type<copy_options>::type;
109 return static_cast<copy_options>(
110 static_cast<__utype>(__x) ^ static_cast<__utype>(__y));
111 }
112
113 constexpr copy_options
114 operator~(copy_options __x) noexcept
115 {
116 using __utype = typename std::underlying_type<copy_options>::type;
117 return static_cast<copy_options>(~static_cast<__utype>(__x));
118 }
119
120 inline copy_options&
121 operator&=(copy_options& __x, copy_options __y) noexcept
122 { return __x = __x & __y; }
123
124 inline copy_options&
125 operator|=(copy_options& __x, copy_options __y) noexcept
126 { return __x = __x | __y; }
127
128 inline copy_options&
129 operator^=(copy_options& __x, copy_options __y) noexcept
130 { return __x = __x ^ __y; }
131
132
133 /// Bitmask type
134 enum class perms : unsigned {
135 none = 0,
136 owner_read = 0400,
137 owner_write = 0200,
138 owner_exec = 0100,
139 owner_all = 0700,
140 group_read = 040,
141 group_write = 020,
142 group_exec = 010,
143 group_all = 070,
144 others_read = 04,
145 others_write = 02,
146 others_exec = 01,
147 others_all = 07,
148 all = 0777,
149 set_uid = 04000,
150 set_gid = 02000,
151 sticky_bit = 01000,
152 mask = 07777,
153 unknown = 0xFFFF,
154 };
155
156 constexpr perms
157 operator&(perms __x, perms __y) noexcept
158 {
159 using __utype = typename std::underlying_type<perms>::type;
160 return static_cast<perms>(
161 static_cast<__utype>(__x) & static_cast<__utype>(__y));
162 }
163
164 constexpr perms
165 operator|(perms __x, perms __y) noexcept
166 {
167 using __utype = typename std::underlying_type<perms>::type;
168 return static_cast<perms>(
169 static_cast<__utype>(__x) | static_cast<__utype>(__y));
170 }
171
172 constexpr perms
173 operator^(perms __x, perms __y) noexcept
174 {
175 using __utype = typename std::underlying_type<perms>::type;
176 return static_cast<perms>(
177 static_cast<__utype>(__x) ^ static_cast<__utype>(__y));
178 }
179
180 constexpr perms
181 operator~(perms __x) noexcept
182 {
183 using __utype = typename std::underlying_type<perms>::type;
184 return static_cast<perms>(~static_cast<__utype>(__x));
185 }
186
187 inline perms&
188 operator&=(perms& __x, perms __y) noexcept
189 { return __x = __x & __y; }
190
191 inline perms&
192 operator|=(perms& __x, perms __y) noexcept
193 { return __x = __x | __y; }
194
195 inline perms&
196 operator^=(perms& __x, perms __y) noexcept
197 { return __x = __x ^ __y; }
198
199 /// Bitmask type
200 enum class perm_options : unsigned {
201 replace = 0x1,
202 add = 0x2,
203 remove = 0x4,
204 nofollow = 0x8
205 };
206
207 constexpr perm_options
208 operator&(perm_options __x, perm_options __y) noexcept
209 {
210 using __utype = typename std::underlying_type<perm_options>::type;
211 return static_cast<perm_options>(
212 static_cast<__utype>(__x) & static_cast<__utype>(__y));
213 }
214
215 constexpr perm_options
216 operator|(perm_options __x, perm_options __y) noexcept
217 {
218 using __utype = typename std::underlying_type<perm_options>::type;
219 return static_cast<perm_options>(
220 static_cast<__utype>(__x) | static_cast<__utype>(__y));
221 }
222
223 constexpr perm_options
224 operator^(perm_options __x, perm_options __y) noexcept
225 {
226 using __utype = typename std::underlying_type<perm_options>::type;
227 return static_cast<perm_options>(
228 static_cast<__utype>(__x) ^ static_cast<__utype>(__y));
229 }
230
231 constexpr perm_options
232 operator~(perm_options __x) noexcept
233 {
234 using __utype = typename std::underlying_type<perm_options>::type;
235 return static_cast<perm_options>(~static_cast<__utype>(__x));
236 }
237
238 inline perm_options&
239 operator&=(perm_options& __x, perm_options __y) noexcept
240 { return __x = __x & __y; }
241
242 inline perm_options&
243 operator|=(perm_options& __x, perm_options __y) noexcept
244 { return __x = __x | __y; }
245
246 inline perm_options&
247 operator^=(perm_options& __x, perm_options __y) noexcept
248 { return __x = __x ^ __y; }
249
250 // Bitmask type
251 enum class directory_options : unsigned char {
252 none = 0, follow_directory_symlink = 1, skip_permission_denied = 2
253 };
254
255 constexpr directory_options
256 operator&(directory_options __x, directory_options __y) noexcept
257 {
258 using __utype = typename std::underlying_type<directory_options>::type;
259 return static_cast<directory_options>(
260 static_cast<__utype>(__x) & static_cast<__utype>(__y));
261 }
262
263 constexpr directory_options
264 operator|(directory_options __x, directory_options __y) noexcept
265 {
266 using __utype = typename std::underlying_type<directory_options>::type;
267 return static_cast<directory_options>(
268 static_cast<__utype>(__x) | static_cast<__utype>(__y));
269 }
270
271 constexpr directory_options
272 operator^(directory_options __x, directory_options __y) noexcept
273 {
274 using __utype = typename std::underlying_type<directory_options>::type;
275 return static_cast<directory_options>(
276 static_cast<__utype>(__x) ^ static_cast<__utype>(__y));
277 }
278
279 constexpr directory_options
280 operator~(directory_options __x) noexcept
281 {
282 using __utype = typename std::underlying_type<directory_options>::type;
283 return static_cast<directory_options>(~static_cast<__utype>(__x));
284 }
285
286 inline directory_options&
287 operator&=(directory_options& __x, directory_options __y) noexcept
288 { return __x = __x & __y; }
289
290 inline directory_options&
291 operator|=(directory_options& __x, directory_options __y) noexcept
292 { return __x = __x | __y; }
293
294 inline directory_options&
295 operator^=(directory_options& __x, directory_options __y) noexcept
296 { return __x = __x ^ __y; }
297
298 using file_time_type = __file_clock::time_point;
299
300 // operational functions
301
302 void copy(const path& __from, const path& __to, copy_options __options);
303 void copy(const path& __from, const path& __to, copy_options __options,
304 error_code&);
305
306 bool copy_file(const path& __from, const path& __to, copy_options __option);
307 bool copy_file(const path& __from, const path& __to, copy_options __option,
308 error_code&);
309
310 path current_path();
311
312 bool exists(file_status) noexcept;
313
314 bool is_other(file_status) noexcept;
315
316 uintmax_t file_size(const path&);
317 uintmax_t file_size(const path&, error_code&) noexcept;
318 uintmax_t hard_link_count(const path&);
319 uintmax_t hard_link_count(const path&, error_code&) noexcept;
320 file_time_type last_write_time(const path&);
321 file_time_type last_write_time(const path&, error_code&) noexcept;
322
323 void permissions(const path&, perms, perm_options, error_code&) noexcept;
324
325 path proximate(const path& __p, const path& __base, error_code& __ec);
326 path proximate(const path& __p, const path& __base, error_code& __ec);
327
328 path relative(const path& __p, const path& __base, error_code& __ec);
329
330 file_status status(const path&);
331 file_status status(const path&, error_code&) noexcept;
332
333 bool status_known(file_status) noexcept;
334
335 file_status symlink_status(const path&);
336 file_status symlink_status(const path&, error_code&) noexcept;
337
338 bool is_regular_file(file_status) noexcept;
339 bool is_symlink(file_status) noexcept;
340
341} // namespace filesystem
342/// @}
343_GLIBCXX_END_NAMESPACE_VERSION
344} // namespace std
345#endif // C++17
346#endif // _GLIBCXX_FS_FWD_H
Note: See TracBrowser for help on using the repository browser.