]>
Commit | Line | Data |
---|---|---|
0ca7ba9a JW |
1 | // Filesystem operational functions -*- C++ -*- |
2 | ||
818ab71a | 3 | // Copyright (C) 2014-2016 Free Software Foundation, Inc. |
0ca7ba9a JW |
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 | ||
6b4f8906 JW |
25 | /** @file experimental/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{experimental/filesystem} | |
0ca7ba9a JW |
28 | */ |
29 | ||
30 | #ifndef _GLIBCXX_EXPERIMENTAL_FS_OPS_H | |
31 | #define _GLIBCXX_EXPERIMENTAL_FS_OPS_H 1 | |
32 | ||
33 | #if __cplusplus < 201103L | |
34 | # include <bits/c++0x_warning.h> | |
35 | #else | |
36 | ||
37 | #include <cstdint> | |
38 | ||
39 | namespace std _GLIBCXX_VISIBILITY(default) | |
40 | { | |
41 | namespace experimental | |
42 | { | |
43 | namespace filesystem | |
44 | { | |
45 | inline namespace v1 | |
46 | { | |
47 | _GLIBCXX_BEGIN_NAMESPACE_VERSION | |
48 | ||
49 | /** | |
50 | * @ingroup filesystem | |
51 | * @{ | |
52 | */ | |
53 | ||
54 | path absolute(const path& __p, const path& __base = current_path()); | |
55 | ||
56 | path canonical(const path& __p, const path& __base = current_path()); | |
d6e023f3 JW |
57 | path canonical(const path& __p, error_code& __ec); |
58 | path canonical(const path& __p, const path& __base, error_code& __ec); | |
0ca7ba9a JW |
59 | |
60 | inline void | |
61 | copy(const path& __from, const path& __to) | |
62 | { copy(__from, __to, copy_options::none); } | |
63 | ||
64 | inline void | |
65 | copy(const path& __from, const path& __to, error_code& __ec) noexcept | |
66 | { copy(__from, __to, copy_options::none, __ec); } | |
67 | ||
d6e023f3 JW |
68 | void copy(const path& __from, const path& __to, copy_options __options); |
69 | void copy(const path& __from, const path& __to, copy_options __options, | |
0ca7ba9a JW |
70 | error_code& __ec) noexcept; |
71 | ||
72 | inline bool | |
73 | copy_file(const path& __from, const path& __to) | |
74 | { return copy_file(__from, __to, copy_options::none); } | |
75 | ||
76 | inline bool | |
77 | copy_file(const path& __from, const path& __to, error_code& __ec) noexcept | |
78 | { return copy_file(__from, __to, copy_options::none, __ec); } | |
79 | ||
80 | bool copy_file(const path& __from, const path& __to, copy_options __option); | |
81 | bool copy_file(const path& __from, const path& __to, copy_options __option, | |
82 | error_code& __ec) noexcept; | |
83 | ||
84 | void copy_symlink(const path& __existing_symlink, const path& __new_symlink); | |
85 | void copy_symlink(const path& __existing_symlink, const path& __new_symlink, | |
86 | error_code& __ec) noexcept; | |
87 | ||
88 | bool create_directories(const path& __p); | |
89 | bool create_directories(const path& __p, error_code& __ec) noexcept; | |
90 | ||
91 | bool create_directory(const path& __p); | |
92 | bool create_directory(const path& __p, error_code& __ec) noexcept; | |
93 | ||
94 | bool create_directory(const path& __p, const path& attributes); | |
95 | bool create_directory(const path& __p, const path& attributes, | |
96 | error_code& __ec) noexcept; | |
97 | ||
98 | void create_directory_symlink(const path& __to, const path& __new_symlink); | |
99 | void create_directory_symlink(const path& __to, const path& __new_symlink, | |
100 | error_code& __ec) noexcept; | |
101 | ||
102 | void create_hard_link(const path& __to, const path& __new_hard_link); | |
103 | void create_hard_link(const path& __to, const path& __new_hard_link, | |
104 | error_code& __ec) noexcept; | |
105 | ||
106 | void create_symlink(const path& __to, const path& __new_symlink); | |
107 | void create_symlink(const path& __to, const path& __new_symlink, | |
108 | error_code& __ec) noexcept; | |
109 | ||
110 | path current_path(); | |
111 | path current_path(error_code& __ec); | |
112 | void current_path(const path& __p); | |
113 | void current_path(const path& __p, error_code& __ec) noexcept; | |
114 | ||
115 | inline bool | |
116 | exists(file_status __s) noexcept | |
117 | { return status_known(__s) && __s.type() != file_type::not_found; } | |
118 | ||
119 | inline bool | |
120 | exists(const path& __p) | |
121 | { return exists(status(__p)); } | |
122 | ||
123 | inline bool | |
124 | exists(const path& __p, error_code& __ec) noexcept | |
125 | { return exists(status(__p, __ec)); } | |
126 | ||
127 | bool | |
128 | equivalent(const path& __p1, const path& __p2); | |
129 | ||
130 | bool | |
131 | equivalent(const path& __p1, const path& __p2, error_code& __ec) noexcept; | |
132 | ||
133 | uintmax_t file_size(const path& __p); | |
134 | uintmax_t file_size(const path& __p, error_code& __ec) noexcept; | |
135 | ||
136 | uintmax_t hard_link_count(const path& __p); | |
137 | uintmax_t hard_link_count(const path& __p, error_code& __ec) noexcept; | |
138 | ||
139 | inline bool | |
140 | is_block_file(file_status __s) noexcept | |
141 | { return __s.type() == file_type::block; } | |
142 | ||
143 | inline bool | |
144 | is_block_file(const path& __p) | |
145 | { return is_block_file(status(__p)); } | |
146 | ||
147 | inline bool | |
148 | is_block_file(const path& __p, error_code& __ec) noexcept | |
149 | { return is_block_file(status(__p, __ec)); } | |
150 | ||
151 | inline bool | |
152 | is_character_file(file_status __s) noexcept | |
153 | { return __s.type() == file_type::character; } | |
154 | ||
155 | inline bool | |
156 | is_character_file(const path& __p) | |
157 | { return is_character_file(status(__p)); } | |
158 | ||
159 | inline bool | |
160 | is_character_file(const path& __p, error_code& __ec) noexcept | |
161 | { return is_character_file(status(__p, __ec)); } | |
162 | ||
163 | inline bool | |
164 | is_directory(file_status __s) noexcept | |
165 | { return __s.type() == file_type::directory; } | |
166 | ||
167 | inline bool | |
168 | is_directory(const path& __p) | |
169 | { return is_directory(status(__p)); } | |
170 | ||
171 | inline bool | |
172 | is_directory(const path& __p, error_code& __ec) noexcept | |
173 | { return is_directory(status(__p, __ec)); } | |
174 | ||
175 | bool is_empty(const path& __p); | |
176 | bool is_empty(const path& __p, error_code& __ec) noexcept; | |
177 | ||
178 | inline bool | |
179 | is_fifo(file_status __s) noexcept | |
180 | { return __s.type() == file_type::fifo; } | |
181 | ||
182 | inline bool | |
183 | is_fifo(const path& __p) | |
184 | { return is_fifo(status(__p)); } | |
185 | ||
186 | inline bool | |
187 | is_fifo(const path& __p, error_code& __ec) noexcept | |
188 | { return is_fifo(status(__p, __ec)); } | |
189 | ||
190 | inline bool | |
191 | is_other(file_status __s) noexcept | |
192 | { | |
193 | return exists(__s) && !is_regular_file(__s) && !is_directory(__s) | |
194 | && !is_symlink(__s); | |
195 | } | |
196 | ||
197 | inline bool | |
198 | is_other(const path& __p) | |
199 | { return is_other(status(__p)); } | |
200 | ||
201 | inline bool | |
202 | is_other(const path& __p, error_code& __ec) noexcept | |
203 | { return is_other(status(__p, __ec)); } | |
204 | ||
205 | inline bool | |
206 | is_regular_file(file_status __s) noexcept | |
207 | { return __s.type() == file_type::regular; } | |
208 | ||
209 | inline bool | |
210 | is_regular_file(const path& __p) | |
211 | { return is_regular_file(status(__p)); } | |
212 | ||
213 | inline bool | |
214 | is_regular_file(const path& __p, error_code& __ec) noexcept | |
215 | { return is_regular_file(status(__p, __ec)); } | |
216 | ||
217 | inline bool | |
218 | is_socket(file_status __s) noexcept | |
219 | { return __s.type() == file_type::socket; } | |
220 | ||
221 | inline bool | |
222 | is_socket(const path& __p) | |
223 | { return is_socket(status(__p)); } | |
224 | ||
225 | inline bool | |
226 | is_socket(const path& __p, error_code& __ec) noexcept | |
227 | { return is_socket(status(__p, __ec)); } | |
228 | ||
229 | inline bool | |
230 | is_symlink(file_status __s) noexcept | |
231 | { return __s.type() == file_type::symlink; } | |
232 | ||
233 | inline bool | |
234 | is_symlink(const path& __p) | |
235 | { return is_symlink(symlink_status(__p)); } | |
236 | ||
237 | inline bool | |
238 | is_symlink(const path& __p, error_code& __ec) noexcept | |
239 | { return is_symlink(symlink_status(__p, __ec)); } | |
240 | ||
241 | file_time_type last_write_time(const path& __p); | |
242 | file_time_type last_write_time(const path& __p, error_code& __ec) noexcept; | |
d6e023f3 JW |
243 | void last_write_time(const path& __p, file_time_type __new_time); |
244 | void last_write_time(const path& __p, file_time_type __new_time, | |
0ca7ba9a JW |
245 | error_code& __ec) noexcept; |
246 | ||
d6e023f3 JW |
247 | void permissions(const path& __p, perms __prms); |
248 | void permissions(const path& __p, perms __prms, error_code& __ec) noexcept; | |
0ca7ba9a JW |
249 | |
250 | path read_symlink(const path& __p); | |
251 | path read_symlink(const path& __p, error_code& __ec); | |
252 | ||
253 | bool remove(const path& __p); | |
254 | bool remove(const path& __p, error_code& __ec) noexcept; | |
255 | ||
256 | uintmax_t remove_all(const path& __p); | |
257 | uintmax_t remove_all(const path& __p, error_code& __ec) noexcept; | |
258 | ||
259 | void rename(const path& __from, const path& __to); | |
260 | void rename(const path& __from, const path& __to, error_code& __ec) noexcept; | |
261 | ||
262 | void resize_file(const path& __p, uintmax_t __size); | |
263 | void resize_file(const path& __p, uintmax_t __size, error_code& __ec) noexcept; | |
264 | ||
265 | space_info space(const path& __p); | |
266 | space_info space(const path& __p, error_code& __ec) noexcept; | |
267 | ||
268 | file_status status(const path& __p); | |
269 | file_status status(const path& __p, error_code& __ec) noexcept; | |
270 | ||
271 | inline bool status_known(file_status __s) noexcept | |
272 | { return __s.type() != file_type::none; } | |
273 | ||
274 | file_status symlink_status(const path& __p); | |
275 | file_status symlink_status(const path& __p, error_code& __ec) noexcept; | |
276 | ||
277 | path system_complete(const path& __p); | |
278 | path system_complete(const path& __p, error_code& __ec); | |
279 | ||
280 | path temp_directory_path(); | |
281 | path temp_directory_path(error_code& __ec); | |
282 | ||
283 | // @} group filesystem | |
284 | _GLIBCXX_END_NAMESPACE_VERSION | |
285 | } // namespace v1 | |
286 | } // namespace filesystem | |
287 | } // namespace experimental | |
288 | } // namespace std | |
289 | ||
290 | #endif // C++11 | |
291 | ||
292 | #endif // _GLIBCXX_EXPERIMENTAL_FS_OPS_H |