libstdc++
|
00001 // Filesystem operational functions -*- C++ -*- 00002 00003 // Copyright (C) 2014-2018 Free Software Foundation, Inc. 00004 // 00005 // This file is part of the GNU ISO C++ Library. This library is free 00006 // software; you can redistribute it and/or modify it under the 00007 // terms of the GNU General Public License as published by the 00008 // Free Software Foundation; either version 3, or (at your __option) 00009 // any later version. 00010 00011 // This library is distributed in the hope that it will be useful, 00012 // but WITHOUT ANY WARRANTY; without even the implied warranty of 00013 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00014 // GNU General Public License for more details. 00015 00016 // Under Section 7 of GPL version 3, you are granted additional 00017 // permissions described in the GCC Runtime Library Exception, version 00018 // 3.1, as published by the Free Software Foundation. 00019 00020 // You should have received a copy of the GNU General Public License and 00021 // a copy of the GCC Runtime Library Exception along with this program; 00022 // see the files COPYING3 and COPYING.RUNTIME respectively. If not, see 00023 // <http://www.gnu.org/licenses/>. 00024 00025 /** @file experimental/bits/fs_fwd.h 00026 * This is an internal header file, included by other library headers. 00027 * Do not attempt to use it directly. @headername{experimental/filesystem} 00028 */ 00029 00030 #ifndef _GLIBCXX_EXPERIMENTAL_FS_OPS_H 00031 #define _GLIBCXX_EXPERIMENTAL_FS_OPS_H 1 00032 00033 #if __cplusplus < 201103L 00034 # include <bits/c++0x_warning.h> 00035 #else 00036 00037 #include <cstdint> 00038 00039 namespace std _GLIBCXX_VISIBILITY(default) 00040 { 00041 _GLIBCXX_BEGIN_NAMESPACE_VERSION 00042 00043 namespace experimental 00044 { 00045 namespace filesystem 00046 { 00047 inline namespace v1 00048 { 00049 /** 00050 * @ingroup filesystem-ts 00051 * @{ 00052 */ 00053 00054 path absolute(const path& __p, const path& __base = current_path()); 00055 00056 path canonical(const path& __p, const path& __base = current_path()); 00057 path canonical(const path& __p, error_code& __ec); 00058 path canonical(const path& __p, const path& __base, error_code& __ec); 00059 00060 inline void 00061 copy(const path& __from, const path& __to) 00062 { copy(__from, __to, copy_options::none); } 00063 00064 inline void 00065 copy(const path& __from, const path& __to, error_code& __ec) noexcept 00066 { copy(__from, __to, copy_options::none, __ec); } 00067 00068 void copy(const path& __from, const path& __to, copy_options __options); 00069 void copy(const path& __from, const path& __to, copy_options __options, 00070 error_code& __ec) noexcept; 00071 00072 inline bool 00073 copy_file(const path& __from, const path& __to) 00074 { return copy_file(__from, __to, copy_options::none); } 00075 00076 inline bool 00077 copy_file(const path& __from, const path& __to, error_code& __ec) noexcept 00078 { return copy_file(__from, __to, copy_options::none, __ec); } 00079 00080 bool copy_file(const path& __from, const path& __to, copy_options __option); 00081 bool copy_file(const path& __from, const path& __to, copy_options __option, 00082 error_code& __ec) noexcept; 00083 00084 void copy_symlink(const path& __existing_symlink, const path& __new_symlink); 00085 void copy_symlink(const path& __existing_symlink, const path& __new_symlink, 00086 error_code& __ec) noexcept; 00087 00088 bool create_directories(const path& __p); 00089 bool create_directories(const path& __p, error_code& __ec) noexcept; 00090 00091 bool create_directory(const path& __p); 00092 bool create_directory(const path& __p, error_code& __ec) noexcept; 00093 00094 bool create_directory(const path& __p, const path& attributes); 00095 bool create_directory(const path& __p, const path& attributes, 00096 error_code& __ec) noexcept; 00097 00098 void create_directory_symlink(const path& __to, const path& __new_symlink); 00099 void create_directory_symlink(const path& __to, const path& __new_symlink, 00100 error_code& __ec) noexcept; 00101 00102 void create_hard_link(const path& __to, const path& __new_hard_link); 00103 void create_hard_link(const path& __to, const path& __new_hard_link, 00104 error_code& __ec) noexcept; 00105 00106 void create_symlink(const path& __to, const path& __new_symlink); 00107 void create_symlink(const path& __to, const path& __new_symlink, 00108 error_code& __ec) noexcept; 00109 00110 path current_path(); 00111 path current_path(error_code& __ec); 00112 void current_path(const path& __p); 00113 void current_path(const path& __p, error_code& __ec) noexcept; 00114 00115 bool 00116 equivalent(const path& __p1, const path& __p2); 00117 00118 bool 00119 equivalent(const path& __p1, const path& __p2, error_code& __ec) noexcept; 00120 00121 inline bool 00122 exists(file_status __s) noexcept 00123 { return status_known(__s) && __s.type() != file_type::not_found; } 00124 00125 inline bool 00126 exists(const path& __p) 00127 { return exists(status(__p)); } 00128 00129 inline bool 00130 exists(const path& __p, error_code& __ec) noexcept 00131 { 00132 auto __s = status(__p, __ec); 00133 if (status_known(__s)) 00134 { 00135 __ec.clear(); 00136 return __s.type() != file_type::not_found; 00137 } 00138 return false; 00139 } 00140 00141 uintmax_t file_size(const path& __p); 00142 uintmax_t file_size(const path& __p, error_code& __ec) noexcept; 00143 00144 uintmax_t hard_link_count(const path& __p); 00145 uintmax_t hard_link_count(const path& __p, error_code& __ec) noexcept; 00146 00147 inline bool 00148 is_block_file(file_status __s) noexcept 00149 { return __s.type() == file_type::block; } 00150 00151 inline bool 00152 is_block_file(const path& __p) 00153 { return is_block_file(status(__p)); } 00154 00155 inline bool 00156 is_block_file(const path& __p, error_code& __ec) noexcept 00157 { return is_block_file(status(__p, __ec)); } 00158 00159 inline bool 00160 is_character_file(file_status __s) noexcept 00161 { return __s.type() == file_type::character; } 00162 00163 inline bool 00164 is_character_file(const path& __p) 00165 { return is_character_file(status(__p)); } 00166 00167 inline bool 00168 is_character_file(const path& __p, error_code& __ec) noexcept 00169 { return is_character_file(status(__p, __ec)); } 00170 00171 inline bool 00172 is_directory(file_status __s) noexcept 00173 { return __s.type() == file_type::directory; } 00174 00175 inline bool 00176 is_directory(const path& __p) 00177 { return is_directory(status(__p)); } 00178 00179 inline bool 00180 is_directory(const path& __p, error_code& __ec) noexcept 00181 { return is_directory(status(__p, __ec)); } 00182 00183 bool is_empty(const path& __p); 00184 bool is_empty(const path& __p, error_code& __ec) noexcept; 00185 00186 inline bool 00187 is_fifo(file_status __s) noexcept 00188 { return __s.type() == file_type::fifo; } 00189 00190 inline bool 00191 is_fifo(const path& __p) 00192 { return is_fifo(status(__p)); } 00193 00194 inline bool 00195 is_fifo(const path& __p, error_code& __ec) noexcept 00196 { return is_fifo(status(__p, __ec)); } 00197 00198 inline bool 00199 is_other(file_status __s) noexcept 00200 { 00201 return exists(__s) && !is_regular_file(__s) && !is_directory(__s) 00202 && !is_symlink(__s); 00203 } 00204 00205 inline bool 00206 is_other(const path& __p) 00207 { return is_other(status(__p)); } 00208 00209 inline bool 00210 is_other(const path& __p, error_code& __ec) noexcept 00211 { return is_other(status(__p, __ec)); } 00212 00213 inline bool 00214 is_regular_file(file_status __s) noexcept 00215 { return __s.type() == file_type::regular; } 00216 00217 inline bool 00218 is_regular_file(const path& __p) 00219 { return is_regular_file(status(__p)); } 00220 00221 inline bool 00222 is_regular_file(const path& __p, error_code& __ec) noexcept 00223 { return is_regular_file(status(__p, __ec)); } 00224 00225 inline bool 00226 is_socket(file_status __s) noexcept 00227 { return __s.type() == file_type::socket; } 00228 00229 inline bool 00230 is_socket(const path& __p) 00231 { return is_socket(status(__p)); } 00232 00233 inline bool 00234 is_socket(const path& __p, error_code& __ec) noexcept 00235 { return is_socket(status(__p, __ec)); } 00236 00237 inline bool 00238 is_symlink(file_status __s) noexcept 00239 { return __s.type() == file_type::symlink; } 00240 00241 inline bool 00242 is_symlink(const path& __p) 00243 { return is_symlink(symlink_status(__p)); } 00244 00245 inline bool 00246 is_symlink(const path& __p, error_code& __ec) noexcept 00247 { return is_symlink(symlink_status(__p, __ec)); } 00248 00249 file_time_type last_write_time(const path& __p); 00250 file_time_type last_write_time(const path& __p, error_code& __ec) noexcept; 00251 void last_write_time(const path& __p, file_time_type __new_time); 00252 void last_write_time(const path& __p, file_time_type __new_time, 00253 error_code& __ec) noexcept; 00254 00255 void permissions(const path& __p, perms __prms); 00256 void permissions(const path& __p, perms __prms, error_code& __ec) noexcept; 00257 00258 path read_symlink(const path& __p); 00259 path read_symlink(const path& __p, error_code& __ec); 00260 00261 bool remove(const path& __p); 00262 bool remove(const path& __p, error_code& __ec) noexcept; 00263 00264 uintmax_t remove_all(const path& __p); 00265 uintmax_t remove_all(const path& __p, error_code& __ec) noexcept; 00266 00267 void rename(const path& __from, const path& __to); 00268 void rename(const path& __from, const path& __to, error_code& __ec) noexcept; 00269 00270 void resize_file(const path& __p, uintmax_t __size); 00271 void resize_file(const path& __p, uintmax_t __size, error_code& __ec) noexcept; 00272 00273 space_info space(const path& __p); 00274 space_info space(const path& __p, error_code& __ec) noexcept; 00275 00276 file_status status(const path& __p); 00277 file_status status(const path& __p, error_code& __ec) noexcept; 00278 00279 inline bool status_known(file_status __s) noexcept 00280 { return __s.type() != file_type::none; } 00281 00282 file_status symlink_status(const path& __p); 00283 file_status symlink_status(const path& __p, error_code& __ec) noexcept; 00284 00285 path system_complete(const path& __p); 00286 path system_complete(const path& __p, error_code& __ec); 00287 00288 path temp_directory_path(); 00289 path temp_directory_path(error_code& __ec); 00290 00291 // @} group filesystem-ts 00292 } // namespace v1 00293 } // namespace filesystem 00294 } // namespace experimental 00295 00296 _GLIBCXX_END_NAMESPACE_VERSION 00297 } // namespace std 00298 00299 #endif // C++11 00300 00301 #endif // _GLIBCXX_EXPERIMENTAL_FS_OPS_H