libstdc++
fs_ops.h
00001 // Filesystem operational functions -*- C++ -*-
00002 
00003 // Copyright (C) 2014-2015 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/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 namespace experimental
00042 {
00043 namespace filesystem
00044 {
00045 inline namespace v1
00046 {
00047 _GLIBCXX_BEGIN_NAMESPACE_VERSION
00048 
00049   /**
00050    * @ingroup filesystem
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   inline bool
00116   exists(file_status __s) noexcept
00117   { return status_known(__s) && __s.type() != file_type::not_found; }
00118 
00119   inline bool
00120   exists(const path& __p)
00121   { return exists(status(__p)); }
00122 
00123   inline bool
00124   exists(const path& __p, error_code& __ec) noexcept
00125   { return exists(status(__p, __ec)); }
00126 
00127   bool
00128   equivalent(const path& __p1, const path& __p2);
00129 
00130   bool
00131   equivalent(const path& __p1, const path& __p2, error_code& __ec) noexcept;
00132 
00133   uintmax_t file_size(const path& __p);
00134   uintmax_t file_size(const path& __p, error_code& __ec) noexcept;
00135 
00136   uintmax_t hard_link_count(const path& __p);
00137   uintmax_t hard_link_count(const path& __p, error_code& __ec) noexcept;
00138 
00139   inline bool
00140   is_block_file(file_status __s) noexcept
00141   { return __s.type() == file_type::block; }
00142 
00143   inline bool
00144   is_block_file(const path& __p)
00145   { return is_block_file(status(__p)); }
00146 
00147   inline bool
00148   is_block_file(const path& __p, error_code& __ec) noexcept
00149   { return is_block_file(status(__p, __ec)); }
00150 
00151   inline bool
00152   is_character_file(file_status __s) noexcept
00153   { return __s.type() == file_type::character; }
00154 
00155   inline bool
00156   is_character_file(const path& __p)
00157   { return is_character_file(status(__p)); }
00158 
00159   inline bool
00160   is_character_file(const path& __p, error_code& __ec) noexcept
00161   { return is_character_file(status(__p, __ec)); }
00162 
00163   inline bool
00164   is_directory(file_status __s) noexcept
00165   { return __s.type() == file_type::directory; }
00166 
00167   inline bool
00168   is_directory(const path& __p)
00169   { return is_directory(status(__p)); }
00170 
00171   inline bool
00172   is_directory(const path& __p, error_code& __ec) noexcept
00173   { return is_directory(status(__p, __ec)); }
00174 
00175   bool is_empty(const path& __p);
00176   bool is_empty(const path& __p, error_code& __ec) noexcept;
00177 
00178   inline bool
00179   is_fifo(file_status __s) noexcept
00180   { return __s.type() == file_type::fifo; }
00181 
00182   inline bool
00183   is_fifo(const path& __p)
00184   { return is_fifo(status(__p)); }
00185 
00186   inline bool
00187   is_fifo(const path& __p, error_code& __ec) noexcept
00188   { return is_fifo(status(__p, __ec)); }
00189 
00190   inline bool
00191   is_other(file_status __s) noexcept
00192   {
00193     return exists(__s) && !is_regular_file(__s) && !is_directory(__s)
00194       && !is_symlink(__s);
00195   }
00196 
00197   inline bool
00198   is_other(const path& __p)
00199   { return is_other(status(__p)); }
00200 
00201   inline bool
00202   is_other(const path& __p, error_code& __ec) noexcept
00203   { return is_other(status(__p, __ec)); }
00204 
00205   inline bool
00206   is_regular_file(file_status __s) noexcept
00207   { return __s.type() == file_type::regular; }
00208 
00209   inline bool
00210   is_regular_file(const path& __p)
00211   { return is_regular_file(status(__p)); }
00212 
00213   inline bool
00214   is_regular_file(const path& __p, error_code& __ec) noexcept
00215   { return is_regular_file(status(__p, __ec)); }
00216 
00217   inline bool
00218   is_socket(file_status __s) noexcept
00219   { return __s.type() == file_type::socket; }
00220 
00221   inline bool
00222   is_socket(const path& __p)
00223   { return is_socket(status(__p)); }
00224 
00225   inline bool
00226   is_socket(const path& __p, error_code& __ec) noexcept
00227   { return is_socket(status(__p, __ec)); }
00228 
00229   inline bool
00230   is_symlink(file_status __s) noexcept
00231   { return __s.type() == file_type::symlink; }
00232 
00233   inline bool
00234   is_symlink(const path& __p)
00235   { return is_symlink(symlink_status(__p)); }
00236 
00237   inline bool
00238   is_symlink(const path& __p, error_code& __ec) noexcept
00239   { return is_symlink(symlink_status(__p, __ec)); }
00240 
00241   file_time_type  last_write_time(const path& __p);
00242   file_time_type  last_write_time(const path& __p, error_code& __ec) noexcept;
00243   void last_write_time(const path& __p, file_time_type __new_time);
00244   void last_write_time(const path& __p, file_time_type __new_time,
00245                        error_code& __ec) noexcept;
00246 
00247   void permissions(const path& __p, perms __prms);
00248   void permissions(const path& __p, perms __prms, error_code& __ec) noexcept;
00249 
00250   path read_symlink(const path& __p);
00251   path read_symlink(const path& __p, error_code& __ec);
00252 
00253   bool remove(const path& __p);
00254   bool remove(const path& __p, error_code& __ec) noexcept;
00255 
00256   uintmax_t remove_all(const path& __p);
00257   uintmax_t remove_all(const path& __p, error_code& __ec) noexcept;
00258 
00259   void rename(const path& __from, const path& __to);
00260   void rename(const path& __from, const path& __to, error_code& __ec) noexcept;
00261 
00262   void resize_file(const path& __p, uintmax_t __size);
00263   void resize_file(const path& __p, uintmax_t __size, error_code& __ec) noexcept;
00264 
00265   space_info space(const path& __p);
00266   space_info space(const path& __p, error_code& __ec) noexcept;
00267 
00268   file_status status(const path& __p);
00269   file_status status(const path& __p, error_code& __ec) noexcept;
00270 
00271   inline bool status_known(file_status __s) noexcept
00272   { return __s.type() != file_type::none; }
00273 
00274   file_status symlink_status(const path& __p);
00275   file_status symlink_status(const path& __p, error_code& __ec) noexcept;
00276 
00277   path system_complete(const path& __p);
00278   path system_complete(const path& __p, error_code& __ec);
00279 
00280   path temp_directory_path();
00281   path temp_directory_path(error_code& __ec);
00282 
00283   // @} group filesystem
00284 _GLIBCXX_END_NAMESPACE_VERSION
00285 } // namespace v1
00286 } // namespace filesystem
00287 } // namespace experimental
00288 } // namespace std
00289 
00290 #endif // C++11
00291 
00292 #endif // _GLIBCXX_EXPERIMENTAL_FS_OPS_H