Nie możesz wybrać więcej, niż 25 tematów Tematy muszą się zaczynać od litery lub cyfry, mogą zawierać myślniki ('-') i mogą mieć do 35 znaków.

314 lines
9.5KB

  1. // Filesystem operational functions -*- C++ -*-
  2. // Copyright (C) 2014-2020 Free Software Foundation, Inc.
  3. //
  4. // This file is part of the GNU ISO C++ Library. This library is free
  5. // software; you can redistribute it and/or modify it under the
  6. // terms of the GNU General Public License as published by the
  7. // Free Software Foundation; either version 3, or (at your __option)
  8. // any later version.
  9. // This library is distributed in the hope that it will be useful,
  10. // but WITHOUT ANY WARRANTY; without even the implied warranty of
  11. // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  12. // GNU General Public License for more details.
  13. // Under Section 7 of GPL version 3, you are granted additional
  14. // permissions described in the GCC Runtime Library Exception, version
  15. // 3.1, as published by the Free Software Foundation.
  16. // You should have received a copy of the GNU General Public License and
  17. // a copy of the GCC Runtime Library Exception along with this program;
  18. // see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
  19. // <http://www.gnu.org/licenses/>.
  20. /** @file include/bits/fs_fwd.h
  21. * This is an internal header file, included by other library headers.
  22. * Do not attempt to use it directly. @headername{filesystem}
  23. */
  24. #ifndef _GLIBCXX_FS_OPS_H
  25. #define _GLIBCXX_FS_OPS_H 1
  26. #if __cplusplus >= 201703L
  27. #include <cstdint>
  28. namespace std _GLIBCXX_VISIBILITY(default)
  29. {
  30. _GLIBCXX_BEGIN_NAMESPACE_VERSION
  31. namespace filesystem
  32. {
  33. /** @addtogroup filesystem
  34. * @{
  35. */
  36. path absolute(const path& __p);
  37. path absolute(const path& __p, error_code& __ec);
  38. path canonical(const path& __p);
  39. path canonical(const path& __p, error_code& __ec);
  40. inline void
  41. copy(const path& __from, const path& __to)
  42. { copy(__from, __to, copy_options::none); }
  43. inline void
  44. copy(const path& __from, const path& __to, error_code& __ec)
  45. { copy(__from, __to, copy_options::none, __ec); }
  46. void copy(const path& __from, const path& __to, copy_options __options);
  47. void copy(const path& __from, const path& __to, copy_options __options,
  48. error_code& __ec);
  49. inline bool
  50. copy_file(const path& __from, const path& __to)
  51. { return copy_file(__from, __to, copy_options::none); }
  52. inline bool
  53. copy_file(const path& __from, const path& __to, error_code& __ec)
  54. { return copy_file(__from, __to, copy_options::none, __ec); }
  55. bool copy_file(const path& __from, const path& __to, copy_options __option);
  56. bool copy_file(const path& __from, const path& __to, copy_options __option,
  57. error_code& __ec);
  58. void copy_symlink(const path& __existing_symlink, const path& __new_symlink);
  59. void copy_symlink(const path& __existing_symlink, const path& __new_symlink,
  60. error_code& __ec) noexcept;
  61. bool create_directories(const path& __p);
  62. bool create_directories(const path& __p, error_code& __ec);
  63. bool create_directory(const path& __p);
  64. bool create_directory(const path& __p, error_code& __ec) noexcept;
  65. bool create_directory(const path& __p, const path& attributes);
  66. bool create_directory(const path& __p, const path& attributes,
  67. error_code& __ec) noexcept;
  68. void create_directory_symlink(const path& __to, const path& __new_symlink);
  69. void create_directory_symlink(const path& __to, const path& __new_symlink,
  70. error_code& __ec) noexcept;
  71. void create_hard_link(const path& __to, const path& __new_hard_link);
  72. void create_hard_link(const path& __to, const path& __new_hard_link,
  73. error_code& __ec) noexcept;
  74. void create_symlink(const path& __to, const path& __new_symlink);
  75. void create_symlink(const path& __to, const path& __new_symlink,
  76. error_code& __ec) noexcept;
  77. path current_path();
  78. path current_path(error_code& __ec);
  79. void current_path(const path& __p);
  80. void current_path(const path& __p, error_code& __ec) noexcept;
  81. bool
  82. equivalent(const path& __p1, const path& __p2);
  83. bool
  84. equivalent(const path& __p1, const path& __p2, error_code& __ec) noexcept;
  85. inline bool
  86. exists(file_status __s) noexcept
  87. { return status_known(__s) && __s.type() != file_type::not_found; }
  88. inline bool
  89. exists(const path& __p)
  90. { return exists(status(__p)); }
  91. inline bool
  92. exists(const path& __p, error_code& __ec) noexcept
  93. {
  94. auto __s = status(__p, __ec);
  95. if (status_known(__s))
  96. {
  97. __ec.clear();
  98. return __s.type() != file_type::not_found;
  99. }
  100. return false;
  101. }
  102. uintmax_t file_size(const path& __p);
  103. uintmax_t file_size(const path& __p, error_code& __ec) noexcept;
  104. uintmax_t hard_link_count(const path& __p);
  105. uintmax_t hard_link_count(const path& __p, error_code& __ec) noexcept;
  106. inline bool
  107. is_block_file(file_status __s) noexcept
  108. { return __s.type() == file_type::block; }
  109. inline bool
  110. is_block_file(const path& __p)
  111. { return is_block_file(status(__p)); }
  112. inline bool
  113. is_block_file(const path& __p, error_code& __ec) noexcept
  114. { return is_block_file(status(__p, __ec)); }
  115. inline bool
  116. is_character_file(file_status __s) noexcept
  117. { return __s.type() == file_type::character; }
  118. inline bool
  119. is_character_file(const path& __p)
  120. { return is_character_file(status(__p)); }
  121. inline bool
  122. is_character_file(const path& __p, error_code& __ec) noexcept
  123. { return is_character_file(status(__p, __ec)); }
  124. inline bool
  125. is_directory(file_status __s) noexcept
  126. { return __s.type() == file_type::directory; }
  127. inline bool
  128. is_directory(const path& __p)
  129. { return is_directory(status(__p)); }
  130. inline bool
  131. is_directory(const path& __p, error_code& __ec) noexcept
  132. { return is_directory(status(__p, __ec)); }
  133. bool is_empty(const path& __p);
  134. bool is_empty(const path& __p, error_code& __ec);
  135. inline bool
  136. is_fifo(file_status __s) noexcept
  137. { return __s.type() == file_type::fifo; }
  138. inline bool
  139. is_fifo(const path& __p)
  140. { return is_fifo(status(__p)); }
  141. inline bool
  142. is_fifo(const path& __p, error_code& __ec) noexcept
  143. { return is_fifo(status(__p, __ec)); }
  144. inline bool
  145. is_other(file_status __s) noexcept
  146. {
  147. return exists(__s) && !is_regular_file(__s) && !is_directory(__s)
  148. && !is_symlink(__s);
  149. }
  150. inline bool
  151. is_other(const path& __p)
  152. { return is_other(status(__p)); }
  153. inline bool
  154. is_other(const path& __p, error_code& __ec) noexcept
  155. { return is_other(status(__p, __ec)); }
  156. inline bool
  157. is_regular_file(file_status __s) noexcept
  158. { return __s.type() == file_type::regular; }
  159. inline bool
  160. is_regular_file(const path& __p)
  161. { return is_regular_file(status(__p)); }
  162. inline bool
  163. is_regular_file(const path& __p, error_code& __ec) noexcept
  164. { return is_regular_file(status(__p, __ec)); }
  165. inline bool
  166. is_socket(file_status __s) noexcept
  167. { return __s.type() == file_type::socket; }
  168. inline bool
  169. is_socket(const path& __p)
  170. { return is_socket(status(__p)); }
  171. inline bool
  172. is_socket(const path& __p, error_code& __ec) noexcept
  173. { return is_socket(status(__p, __ec)); }
  174. inline bool
  175. is_symlink(file_status __s) noexcept
  176. { return __s.type() == file_type::symlink; }
  177. inline bool
  178. is_symlink(const path& __p)
  179. { return is_symlink(symlink_status(__p)); }
  180. inline bool
  181. is_symlink(const path& __p, error_code& __ec) noexcept
  182. { return is_symlink(symlink_status(__p, __ec)); }
  183. file_time_type last_write_time(const path& __p);
  184. file_time_type last_write_time(const path& __p, error_code& __ec) noexcept;
  185. void last_write_time(const path& __p, file_time_type __new_time);
  186. void last_write_time(const path& __p, file_time_type __new_time,
  187. error_code& __ec) noexcept;
  188. void
  189. permissions(const path& __p, perms __prms,
  190. perm_options __opts = perm_options::replace);
  191. inline void
  192. permissions(const path& __p, perms __prms, error_code& __ec) noexcept
  193. { permissions(__p, __prms, perm_options::replace, __ec); }
  194. void
  195. permissions(const path& __p, perms __prms, perm_options __opts,
  196. error_code& __ec) noexcept;
  197. inline path proximate(const path& __p, error_code& __ec)
  198. { return proximate(__p, current_path(), __ec); }
  199. path proximate(const path& __p, const path& __base = current_path());
  200. path proximate(const path& __p, const path& __base, error_code& __ec);
  201. path read_symlink(const path& __p);
  202. path read_symlink(const path& __p, error_code& __ec);
  203. inline path relative(const path& __p, error_code& __ec)
  204. { return relative(__p, current_path(), __ec); }
  205. path relative(const path& __p, const path& __base = current_path());
  206. path relative(const path& __p, const path& __base, error_code& __ec);
  207. bool remove(const path& __p);
  208. bool remove(const path& __p, error_code& __ec) noexcept;
  209. uintmax_t remove_all(const path& __p);
  210. uintmax_t remove_all(const path& __p, error_code& __ec);
  211. void rename(const path& __from, const path& __to);
  212. void rename(const path& __from, const path& __to, error_code& __ec) noexcept;
  213. void resize_file(const path& __p, uintmax_t __size);
  214. void resize_file(const path& __p, uintmax_t __size, error_code& __ec) noexcept;
  215. space_info space(const path& __p);
  216. space_info space(const path& __p, error_code& __ec) noexcept;
  217. file_status status(const path& __p);
  218. file_status status(const path& __p, error_code& __ec) noexcept;
  219. inline bool status_known(file_status __s) noexcept
  220. { return __s.type() != file_type::none; }
  221. file_status symlink_status(const path& __p);
  222. file_status symlink_status(const path& __p, error_code& __ec) noexcept;
  223. path temp_directory_path();
  224. path temp_directory_path(error_code& __ec);
  225. path weakly_canonical(const path& __p);
  226. path weakly_canonical(const path& __p, error_code& __ec);
  227. // @} group filesystem
  228. } // namespace filesystem
  229. _GLIBCXX_END_NAMESPACE_VERSION
  230. } // namespace std
  231. #endif // C++17
  232. #endif // _GLIBCXX_FS_OPS_H