1 // Filesystem operational functions -*- C++ -*-
3 // Copyright (C) 2014-2017 Free Software Foundation, Inc.
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)
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.
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.
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/>.
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}
30 #ifndef _GLIBCXX_FS_OPS_H
31 #define _GLIBCXX_FS_OPS_H 1
33 #if __cplusplus >= 201703L
37 namespace std
_GLIBCXX_VISIBILITY(default)
39 _GLIBCXX_BEGIN_NAMESPACE_VERSION
48 path
absolute(const path
& __p
);
49 path
absolute(const path
& __p
, error_code
& __ec
);
51 path
canonical(const path
& __p
);
52 path
canonical(const path
& __p
, error_code
& __ec
);
55 copy(const path
& __from
, const path
& __to
)
56 { copy(__from
, __to
, copy_options::none
); }
59 copy(const path
& __from
, const path
& __to
, error_code
& __ec
)
60 { copy(__from
, __to
, copy_options::none
, __ec
); }
62 void copy(const path
& __from
, const path
& __to
, copy_options __options
);
63 void copy(const path
& __from
, const path
& __to
, copy_options __options
,
67 copy_file(const path
& __from
, const path
& __to
)
68 { return copy_file(__from
, __to
, copy_options::none
); }
71 copy_file(const path
& __from
, const path
& __to
, error_code
& __ec
)
72 { return copy_file(__from
, __to
, copy_options::none
, __ec
); }
74 bool copy_file(const path
& __from
, const path
& __to
, copy_options __option
);
75 bool copy_file(const path
& __from
, const path
& __to
, copy_options __option
,
78 void copy_symlink(const path
& __existing_symlink
, const path
& __new_symlink
);
79 void copy_symlink(const path
& __existing_symlink
, const path
& __new_symlink
,
80 error_code
& __ec
) noexcept
;
82 bool create_directories(const path
& __p
);
83 bool create_directories(const path
& __p
, error_code
& __ec
);
85 bool create_directory(const path
& __p
);
86 bool create_directory(const path
& __p
, error_code
& __ec
) noexcept
;
88 bool create_directory(const path
& __p
, const path
& attributes
);
89 bool create_directory(const path
& __p
, const path
& attributes
,
90 error_code
& __ec
) noexcept
;
92 void create_directory_symlink(const path
& __to
, const path
& __new_symlink
);
93 void create_directory_symlink(const path
& __to
, const path
& __new_symlink
,
94 error_code
& __ec
) noexcept
;
96 void create_hard_link(const path
& __to
, const path
& __new_hard_link
);
97 void create_hard_link(const path
& __to
, const path
& __new_hard_link
,
98 error_code
& __ec
) noexcept
;
100 void create_symlink(const path
& __to
, const path
& __new_symlink
);
101 void create_symlink(const path
& __to
, const path
& __new_symlink
,
102 error_code
& __ec
) noexcept
;
105 path
current_path(error_code
& __ec
);
106 void current_path(const path
& __p
);
107 void current_path(const path
& __p
, error_code
& __ec
) noexcept
;
110 equivalent(const path
& __p1
, const path
& __p2
);
113 equivalent(const path
& __p1
, const path
& __p2
, error_code
& __ec
) noexcept
;
116 exists(file_status __s
) noexcept
117 { return status_known(__s
) && __s
.type() != file_type::not_found
; }
120 exists(const path
& __p
)
121 { return exists(status(__p
)); }
124 exists(const path
& __p
, error_code
& __ec
) noexcept
126 auto __s
= status(__p
, __ec
);
127 if (status_known(__s
))
132 uintmax_t file_size(const path
& __p
);
133 uintmax_t file_size(const path
& __p
, error_code
& __ec
) noexcept
;
135 uintmax_t hard_link_count(const path
& __p
);
136 uintmax_t hard_link_count(const path
& __p
, error_code
& __ec
) noexcept
;
139 is_block_file(file_status __s
) noexcept
140 { return __s
.type() == file_type::block
; }
143 is_block_file(const path
& __p
)
144 { return is_block_file(status(__p
)); }
147 is_block_file(const path
& __p
, error_code
& __ec
) noexcept
148 { return is_block_file(status(__p
, __ec
)); }
151 is_character_file(file_status __s
) noexcept
152 { return __s
.type() == file_type::character
; }
155 is_character_file(const path
& __p
)
156 { return is_character_file(status(__p
)); }
159 is_character_file(const path
& __p
, error_code
& __ec
) noexcept
160 { return is_character_file(status(__p
, __ec
)); }
163 is_directory(file_status __s
) noexcept
164 { return __s
.type() == file_type::directory
; }
167 is_directory(const path
& __p
)
168 { return is_directory(status(__p
)); }
171 is_directory(const path
& __p
, error_code
& __ec
) noexcept
172 { return is_directory(status(__p
, __ec
)); }
174 bool is_empty(const path
& __p
);
175 bool is_empty(const path
& __p
, error_code
& __ec
);
178 is_fifo(file_status __s
) noexcept
179 { return __s
.type() == file_type::fifo
; }
182 is_fifo(const path
& __p
)
183 { return is_fifo(status(__p
)); }
186 is_fifo(const path
& __p
, error_code
& __ec
) noexcept
187 { return is_fifo(status(__p
, __ec
)); }
190 is_other(file_status __s
) noexcept
192 return exists(__s
) && !is_regular_file(__s
) && !is_directory(__s
)
197 is_other(const path
& __p
)
198 { return is_other(status(__p
)); }
201 is_other(const path
& __p
, error_code
& __ec
) noexcept
202 { return is_other(status(__p
, __ec
)); }
205 is_regular_file(file_status __s
) noexcept
206 { return __s
.type() == file_type::regular
; }
209 is_regular_file(const path
& __p
)
210 { return is_regular_file(status(__p
)); }
213 is_regular_file(const path
& __p
, error_code
& __ec
) noexcept
214 { return is_regular_file(status(__p
, __ec
)); }
217 is_socket(file_status __s
) noexcept
218 { return __s
.type() == file_type::socket
; }
221 is_socket(const path
& __p
)
222 { return is_socket(status(__p
)); }
225 is_socket(const path
& __p
, error_code
& __ec
) noexcept
226 { return is_socket(status(__p
, __ec
)); }
229 is_symlink(file_status __s
) noexcept
230 { return __s
.type() == file_type::symlink
; }
233 is_symlink(const path
& __p
)
234 { return is_symlink(symlink_status(__p
)); }
237 is_symlink(const path
& __p
, error_code
& __ec
) noexcept
238 { return is_symlink(symlink_status(__p
, __ec
)); }
240 file_time_type
last_write_time(const path
& __p
);
241 file_time_type
last_write_time(const path
& __p
, error_code
& __ec
) noexcept
;
242 void last_write_time(const path
& __p
, file_time_type __new_time
);
243 void last_write_time(const path
& __p
, file_time_type __new_time
,
244 error_code
& __ec
) noexcept
;
247 permissions(const path
& __p
, perms __prms
,
248 perm_options __opts
= perm_options::replace
);
251 permissions(const path
& __p
, perms __prms
, error_code
& __ec
) noexcept
252 { permissions(__p
, __prms
, perm_options::replace
, __ec
); }
255 permissions(const path
& __p
, perms __prms
, perm_options __opts
,
258 inline path
proximate(const path
& __p
, error_code
& __ec
)
259 { return proximate(__p
, current_path(), __ec
); }
261 path
proximate(const path
& __p
, const path
& __base
= current_path());
262 path
proximate(const path
& __p
, const path
& __base
, error_code
& __ec
);
264 path
read_symlink(const path
& __p
);
265 path
read_symlink(const path
& __p
, error_code
& __ec
);
267 inline path
relative(const path
& __p
, error_code
& __ec
)
268 { return relative(__p
, current_path(), __ec
); }
270 path
relative(const path
& __p
, const path
& __base
= current_path());
271 path
relative(const path
& __p
, const path
& __base
, error_code
& __ec
);
273 bool remove(const path
& __p
);
274 bool remove(const path
& __p
, error_code
& __ec
) noexcept
;
276 uintmax_t remove_all(const path
& __p
);
277 uintmax_t remove_all(const path
& __p
, error_code
& __ec
);
279 void rename(const path
& __from
, const path
& __to
);
280 void rename(const path
& __from
, const path
& __to
, error_code
& __ec
) noexcept
;
282 void resize_file(const path
& __p
, uintmax_t __size
);
283 void resize_file(const path
& __p
, uintmax_t __size
, error_code
& __ec
) noexcept
;
285 space_info
space(const path
& __p
);
286 space_info
space(const path
& __p
, error_code
& __ec
) noexcept
;
288 file_status
status(const path
& __p
);
289 file_status
status(const path
& __p
, error_code
& __ec
) noexcept
;
291 inline bool status_known(file_status __s
) noexcept
292 { return __s
.type() != file_type::none
; }
294 file_status
symlink_status(const path
& __p
);
295 file_status
symlink_status(const path
& __p
, error_code
& __ec
) noexcept
;
297 path
temp_directory_path();
298 path
temp_directory_path(error_code
& __ec
);
300 path
weakly_canonical(const path
& __p
);
301 path
weakly_canonical(const path
& __p
, error_code
& __ec
);
303 // @} group filesystem
304 } // namespace filesystem
306 _GLIBCXX_END_NAMESPACE_VERSION
311 #endif // _GLIBCXX_FS_OPS_H