xref: /netbsd-src/external/apache2/llvm/dist/libcxx/include/experimental/filesystem (revision 4d6fc14bc9b0c5bf3e30be318c143ee82cadd108)
1*4d6fc14bSjoerg// -*- C++ -*-
2*4d6fc14bSjoerg//===--------------------------- filesystem -------------------------------===//
3*4d6fc14bSjoerg//
4*4d6fc14bSjoerg// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
5*4d6fc14bSjoerg// See https://llvm.org/LICENSE.txt for license information.
6*4d6fc14bSjoerg// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
7*4d6fc14bSjoerg//
8*4d6fc14bSjoerg//===----------------------------------------------------------------------===//
9*4d6fc14bSjoerg#ifndef _LIBCPP_EXPERIMENTAL_FILESYSTEM
10*4d6fc14bSjoerg#define _LIBCPP_EXPERIMENTAL_FILESYSTEM
11*4d6fc14bSjoerg/*
12*4d6fc14bSjoerg    filesystem synopsis
13*4d6fc14bSjoerg
14*4d6fc14bSjoerg    namespace std { namespace experimental { namespace filesystem { inline namespace v1 {
15*4d6fc14bSjoerg
16*4d6fc14bSjoerg    class path;
17*4d6fc14bSjoerg
18*4d6fc14bSjoerg    void swap(path& lhs, path& rhs) noexcept;
19*4d6fc14bSjoerg    size_t hash_value(const path& p) noexcept;
20*4d6fc14bSjoerg
21*4d6fc14bSjoerg    bool operator==(const path& lhs, const path& rhs) noexcept;
22*4d6fc14bSjoerg    bool operator!=(const path& lhs, const path& rhs) noexcept;
23*4d6fc14bSjoerg    bool operator< (const path& lhs, const path& rhs) noexcept;
24*4d6fc14bSjoerg    bool operator<=(const path& lhs, const path& rhs) noexcept;
25*4d6fc14bSjoerg    bool operator> (const path& lhs, const path& rhs) noexcept;
26*4d6fc14bSjoerg    bool operator>=(const path& lhs, const path& rhs) noexcept;
27*4d6fc14bSjoerg
28*4d6fc14bSjoerg    path operator/ (const path& lhs, const path& rhs);
29*4d6fc14bSjoerg
30*4d6fc14bSjoerg    // fs.path.io operators are friends of path.
31*4d6fc14bSjoerg    template <class charT, class traits>
32*4d6fc14bSjoerg    friend basic_ostream<charT, traits>&
33*4d6fc14bSjoerg    operator<<(basic_ostream<charT, traits>& os, const path& p);
34*4d6fc14bSjoerg
35*4d6fc14bSjoerg    template <class charT, class traits>
36*4d6fc14bSjoerg    friend basic_istream<charT, traits>&
37*4d6fc14bSjoerg    operator>>(basic_istream<charT, traits>& is, path& p);
38*4d6fc14bSjoerg
39*4d6fc14bSjoerg    template <class Source>
40*4d6fc14bSjoerg      path u8path(const Source& source);
41*4d6fc14bSjoerg    template <class InputIterator>
42*4d6fc14bSjoerg      path u8path(InputIterator first, InputIterator last);
43*4d6fc14bSjoerg
44*4d6fc14bSjoerg    class filesystem_error;
45*4d6fc14bSjoerg    class directory_entry;
46*4d6fc14bSjoerg
47*4d6fc14bSjoerg    class directory_iterator;
48*4d6fc14bSjoerg
49*4d6fc14bSjoerg    // enable directory_iterator range-based for statements
50*4d6fc14bSjoerg    directory_iterator begin(directory_iterator iter) noexcept;
51*4d6fc14bSjoerg    directory_iterator end(const directory_iterator&) noexcept;
52*4d6fc14bSjoerg
53*4d6fc14bSjoerg    class recursive_directory_iterator;
54*4d6fc14bSjoerg
55*4d6fc14bSjoerg    // enable recursive_directory_iterator range-based for statements
56*4d6fc14bSjoerg    recursive_directory_iterator begin(recursive_directory_iterator iter) noexcept;
57*4d6fc14bSjoerg    recursive_directory_iterator end(const recursive_directory_iterator&) noexcept;
58*4d6fc14bSjoerg
59*4d6fc14bSjoerg    class file_status;
60*4d6fc14bSjoerg
61*4d6fc14bSjoerg    struct space_info
62*4d6fc14bSjoerg    {
63*4d6fc14bSjoerg      uintmax_t capacity;
64*4d6fc14bSjoerg      uintmax_t free;
65*4d6fc14bSjoerg      uintmax_t available;
66*4d6fc14bSjoerg    };
67*4d6fc14bSjoerg
68*4d6fc14bSjoerg    enum class file_type;
69*4d6fc14bSjoerg    enum class perms;
70*4d6fc14bSjoerg    enum class perm_options;
71*4d6fc14bSjoerg    enum class copy_options;
72*4d6fc14bSjoerg    enum class directory_options;
73*4d6fc14bSjoerg
74*4d6fc14bSjoerg    typedef chrono::time_point<trivial-clock>  file_time_type;
75*4d6fc14bSjoerg
76*4d6fc14bSjoerg    // operational functions
77*4d6fc14bSjoerg
78*4d6fc14bSjoerg    path absolute(const path& p);
79*4d6fc14bSjoerg    path absolute(const path& p, error_code &ec);
80*4d6fc14bSjoerg
81*4d6fc14bSjoerg    path canonical(const path& p);
82*4d6fc14bSjoerg    path canonical(const path& p, error_code& ec);
83*4d6fc14bSjoerg
84*4d6fc14bSjoerg    void copy(const path& from, const path& to);
85*4d6fc14bSjoerg    void copy(const path& from, const path& to, error_code& ec);
86*4d6fc14bSjoerg    void copy(const path& from, const path& to, copy_options options);
87*4d6fc14bSjoerg    void copy(const path& from, const path& to, copy_options options,
88*4d6fc14bSjoerg                   error_code& ec);
89*4d6fc14bSjoerg
90*4d6fc14bSjoerg    bool copy_file(const path& from, const path& to);
91*4d6fc14bSjoerg    bool copy_file(const path& from, const path& to, error_code& ec);
92*4d6fc14bSjoerg    bool copy_file(const path& from, const path& to, copy_options option);
93*4d6fc14bSjoerg    bool copy_file(const path& from, const path& to, copy_options option,
94*4d6fc14bSjoerg                           error_code& ec);
95*4d6fc14bSjoerg
96*4d6fc14bSjoerg    void copy_symlink(const path& existing_symlink, const path& new_symlink);
97*4d6fc14bSjoerg    void copy_symlink(const path& existing_symlink, const path& new_symlink,
98*4d6fc14bSjoerg                              error_code& ec) noexcept;
99*4d6fc14bSjoerg
100*4d6fc14bSjoerg    bool create_directories(const path& p);
101*4d6fc14bSjoerg    bool create_directories(const path& p, error_code& ec);
102*4d6fc14bSjoerg
103*4d6fc14bSjoerg    bool create_directory(const path& p);
104*4d6fc14bSjoerg    bool create_directory(const path& p, error_code& ec) noexcept;
105*4d6fc14bSjoerg
106*4d6fc14bSjoerg    bool create_directory(const path& p, const path& attributes);
107*4d6fc14bSjoerg    bool create_directory(const path& p, const path& attributes,
108*4d6fc14bSjoerg                                  error_code& ec) noexcept;
109*4d6fc14bSjoerg
110*4d6fc14bSjoerg    void create_directory_symlink(const path& to, const path& new_symlink);
111*4d6fc14bSjoerg    void create_directory_symlink(const path& to, const path& new_symlink,
112*4d6fc14bSjoerg                                          error_code& ec) noexcept;
113*4d6fc14bSjoerg
114*4d6fc14bSjoerg    void create_hard_link(const path& to, const path& new_hard_link);
115*4d6fc14bSjoerg    void create_hard_link(const path& to, const path& new_hard_link,
116*4d6fc14bSjoerg                                  error_code& ec) noexcept;
117*4d6fc14bSjoerg
118*4d6fc14bSjoerg    void create_symlink(const path& to, const path& new_symlink);
119*4d6fc14bSjoerg    void create_symlink(const path& to, const path& new_symlink,
120*4d6fc14bSjoerg                                error_code& ec) noexcept;
121*4d6fc14bSjoerg
122*4d6fc14bSjoerg    path current_path();
123*4d6fc14bSjoerg    path current_path(error_code& ec);
124*4d6fc14bSjoerg    void current_path(const path& p);
125*4d6fc14bSjoerg    void current_path(const path& p, error_code& ec) noexcept;
126*4d6fc14bSjoerg
127*4d6fc14bSjoerg    bool exists(file_status s) noexcept;
128*4d6fc14bSjoerg    bool exists(const path& p);
129*4d6fc14bSjoerg    bool exists(const path& p, error_code& ec) noexcept;
130*4d6fc14bSjoerg
131*4d6fc14bSjoerg    bool equivalent(const path& p1, const path& p2);
132*4d6fc14bSjoerg    bool equivalent(const path& p1, const path& p2, error_code& ec) noexcept;
133*4d6fc14bSjoerg
134*4d6fc14bSjoerg    uintmax_t    file_size(const path& p);
135*4d6fc14bSjoerg    uintmax_t    file_size(const path& p, error_code& ec) noexcept;
136*4d6fc14bSjoerg
137*4d6fc14bSjoerg    uintmax_t    hard_link_count(const path& p);
138*4d6fc14bSjoerg    uintmax_t    hard_link_count(const path& p, error_code& ec) noexcept;
139*4d6fc14bSjoerg
140*4d6fc14bSjoerg    bool is_block_file(file_status s) noexcept;
141*4d6fc14bSjoerg    bool is_block_file(const path& p);
142*4d6fc14bSjoerg    bool is_block_file(const path& p, error_code& ec) noexcept;
143*4d6fc14bSjoerg
144*4d6fc14bSjoerg    bool is_character_file(file_status s) noexcept;
145*4d6fc14bSjoerg    bool is_character_file(const path& p);
146*4d6fc14bSjoerg    bool is_character_file(const path& p, error_code& ec) noexcept;
147*4d6fc14bSjoerg
148*4d6fc14bSjoerg    bool is_directory(file_status s) noexcept;
149*4d6fc14bSjoerg    bool is_directory(const path& p);
150*4d6fc14bSjoerg    bool is_directory(const path& p, error_code& ec) noexcept;
151*4d6fc14bSjoerg
152*4d6fc14bSjoerg    bool is_empty(const path& p);
153*4d6fc14bSjoerg    bool is_empty(const path& p, error_code& ec) noexcept;
154*4d6fc14bSjoerg
155*4d6fc14bSjoerg    bool is_fifo(file_status s) noexcept;
156*4d6fc14bSjoerg    bool is_fifo(const path& p);
157*4d6fc14bSjoerg    bool is_fifo(const path& p, error_code& ec) noexcept;
158*4d6fc14bSjoerg
159*4d6fc14bSjoerg    bool is_other(file_status s) noexcept;
160*4d6fc14bSjoerg    bool is_other(const path& p);
161*4d6fc14bSjoerg    bool is_other(const path& p, error_code& ec) noexcept;
162*4d6fc14bSjoerg
163*4d6fc14bSjoerg    bool is_regular_file(file_status s) noexcept;
164*4d6fc14bSjoerg    bool is_regular_file(const path& p);
165*4d6fc14bSjoerg    bool is_regular_file(const path& p, error_code& ec) noexcept;
166*4d6fc14bSjoerg
167*4d6fc14bSjoerg    bool is_socket(file_status s) noexcept;
168*4d6fc14bSjoerg    bool is_socket(const path& p);
169*4d6fc14bSjoerg    bool is_socket(const path& p, error_code& ec) noexcept;
170*4d6fc14bSjoerg
171*4d6fc14bSjoerg    bool is_symlink(file_status s) noexcept;
172*4d6fc14bSjoerg    bool is_symlink(const path& p);
173*4d6fc14bSjoerg    bool is_symlink(const path& p, error_code& ec) noexcept;
174*4d6fc14bSjoerg
175*4d6fc14bSjoerg    file_time_type  last_write_time(const path& p);
176*4d6fc14bSjoerg    file_time_type  last_write_time(const path& p, error_code& ec) noexcept;
177*4d6fc14bSjoerg    void last_write_time(const path& p, file_time_type new_time);
178*4d6fc14bSjoerg    void last_write_time(const path& p, file_time_type new_time,
179*4d6fc14bSjoerg                                 error_code& ec) noexcept;
180*4d6fc14bSjoerg
181*4d6fc14bSjoerg    void permissions(const path& p, perms prms,
182*4d6fc14bSjoerg                     perm_options opts=perm_options::replace);
183*4d6fc14bSjoerg    void permissions(const path& p, perms prms, error_code& ec) noexcept;
184*4d6fc14bSjoerg    void permissions(const path& p, perms prms, perm_options opts,
185*4d6fc14bSjoerg                     error_code& ec);
186*4d6fc14bSjoerg
187*4d6fc14bSjoerg    path proximate(const path& p, error_code& ec);
188*4d6fc14bSjoerg    path proximate(const path& p, const path& base = current_path());
189*4d6fc14bSjoerg    path proximate(const path& p, const path& base, error_code &ec);
190*4d6fc14bSjoerg
191*4d6fc14bSjoerg    path read_symlink(const path& p);
192*4d6fc14bSjoerg    path read_symlink(const path& p, error_code& ec);
193*4d6fc14bSjoerg
194*4d6fc14bSjoerg    path relative(const path& p, error_code& ec);
195*4d6fc14bSjoerg    path relative(const path& p, const path& base=current_path());
196*4d6fc14bSjoerg    path relative(const path& p, const path& base, error_code& ec);
197*4d6fc14bSjoerg
198*4d6fc14bSjoerg    bool remove(const path& p);
199*4d6fc14bSjoerg    bool remove(const path& p, error_code& ec) noexcept;
200*4d6fc14bSjoerg
201*4d6fc14bSjoerg    uintmax_t    remove_all(const path& p);
202*4d6fc14bSjoerg    uintmax_t    remove_all(const path& p, error_code& ec);
203*4d6fc14bSjoerg
204*4d6fc14bSjoerg    void rename(const path& from, const path& to);
205*4d6fc14bSjoerg    void rename(const path& from, const path& to, error_code& ec) noexcept;
206*4d6fc14bSjoerg
207*4d6fc14bSjoerg    void resize_file(const path& p, uintmax_t size);
208*4d6fc14bSjoerg    void resize_file(const path& p, uintmax_t size, error_code& ec) noexcept;
209*4d6fc14bSjoerg
210*4d6fc14bSjoerg    space_info   space(const path& p);
211*4d6fc14bSjoerg    space_info   space(const path& p, error_code& ec) noexcept;
212*4d6fc14bSjoerg
213*4d6fc14bSjoerg    file_status  status(const path& p);
214*4d6fc14bSjoerg    file_status  status(const path& p, error_code& ec) noexcept;
215*4d6fc14bSjoerg
216*4d6fc14bSjoerg    bool status_known(file_status s) noexcept;
217*4d6fc14bSjoerg
218*4d6fc14bSjoerg    file_status  symlink_status(const path& p);
219*4d6fc14bSjoerg    file_status  symlink_status(const path& p, error_code& ec) noexcept;
220*4d6fc14bSjoerg
221*4d6fc14bSjoerg    path temp_directory_path();
222*4d6fc14bSjoerg    path temp_directory_path(error_code& ec);
223*4d6fc14bSjoerg
224*4d6fc14bSjoerg    path weakly_canonical(path const& p);
225*4d6fc14bSjoerg    path weakly_canonical(path const& p, error_code& ec);
226*4d6fc14bSjoerg
227*4d6fc14bSjoerg
228*4d6fc14bSjoerg} } } }  // namespaces std::experimental::filesystem::v1
229*4d6fc14bSjoerg
230*4d6fc14bSjoerg*/
231*4d6fc14bSjoerg
232*4d6fc14bSjoerg#include <experimental/__config>
233*4d6fc14bSjoerg#include <filesystem>
234*4d6fc14bSjoerg
235*4d6fc14bSjoerg#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
236*4d6fc14bSjoerg#pragma GCC system_header
237*4d6fc14bSjoerg#endif
238*4d6fc14bSjoerg
239*4d6fc14bSjoerg_LIBCPP_PUSH_MACROS
240*4d6fc14bSjoerg#include <__undef_macros>
241*4d6fc14bSjoerg
242*4d6fc14bSjoerg#ifndef _LIBCPP_CXX03_LANG
243*4d6fc14bSjoerg
244*4d6fc14bSjoerg#define __cpp_lib_experimental_filesystem 201406
245*4d6fc14bSjoerg
246*4d6fc14bSjoerg_LIBCPP_BEGIN_NAMESPACE_EXPERIMENTAL_FILESYSTEM
247*4d6fc14bSjoerg
248*4d6fc14bSjoergusing namespace _VSTD_FS;
249*4d6fc14bSjoerg
250*4d6fc14bSjoerg_LIBCPP_END_NAMESPACE_EXPERIMENTAL_FILESYSTEM
251*4d6fc14bSjoerg
252*4d6fc14bSjoerg#endif // !_LIBCPP_CXX03_LANG
253*4d6fc14bSjoerg
254*4d6fc14bSjoerg_LIBCPP_POP_MACROS
255*4d6fc14bSjoerg
256*4d6fc14bSjoerg#endif // _LIBCPP_EXPERIMENTAL_FILESYSTEM
257