MySQL 8.0.40
Source Code Documentation
filesystem.h
Go to the documentation of this file.
1/*
2 Copyright (c) 2020, 2024, Oracle and/or its affiliates.
3
4 This program is free software; you can redistribute it and/or modify
5 it under the terms of the GNU General Public License, version 2.0,
6 as published by the Free Software Foundation.
7
8 This program is designed to work with certain software (including
9 but not limited to OpenSSL) that is licensed under separate terms,
10 as designated in a particular file or component or in included license
11 documentation. The authors of MySQL hereby grant you an additional
12 permission to link the program and your derivative works with the
13 separately licensed software that they have either included with
14 the program or referenced in the documentation.
15
16 This program is distributed in the hope that it will be useful,
17 but WITHOUT ANY WARRANTY; without even the implied warranty of
18 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 GNU General Public License for more details.
20
21 You should have received a copy of the GNU General Public License
22 along with this program; if not, write to the Free Software
23 Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
24*/
25#ifndef MYSQL_HARNESS_STDX_FILESYSTEM_INCLUDED
26#define MYSQL_HARNESS_STDX_FILESYSTEM_INCLUDED
27
28#include <string>
29#include <system_error>
30#include <type_traits>
31
33
34// std::filesystem from C++17 on top of C++14
35
36namespace stdx {
37namespace filesystem {
38class path {
39 public:
40 using value_type = char;
41 using string_type = std::basic_string<value_type>;
42
43 path() = default;
44
46
47 path(const path &p) = default;
48 path(path &&p) = default;
49
50 const value_type *c_str() const noexcept { return native().c_str(); }
51 const string_type &native() const noexcept { return native_path_; }
52
53 operator string_type() const { return native_path_; }
54
55 private:
57};
58
59/**
60 * get current path.
61 *
62 * @throws std::system_error on error
63 *
64 * @returns current path
65 */
67
68/**
69 * get current path.
70 *
71 * sets ec on error.
72 *
73 * @returns current path
74 */
75HARNESS_STDX_EXPORT path current_path(std::error_code &ec) noexcept;
76
77HARNESS_STDX_EXPORT bool remove(const path &p, std::error_code &ec) noexcept;
78
79} // namespace filesystem
80} // namespace stdx
81
82#endif
Definition: filesystem.h:38
std::basic_string< value_type > string_type
Definition: filesystem.h:41
string_type native_path_
Definition: filesystem.h:56
const string_type & native() const noexcept
Definition: filesystem.h:51
path(string_type source)
Definition: filesystem.h:45
const value_type * c_str() const noexcept
Definition: filesystem.h:50
char value_type
Definition: filesystem.h:40
path(path &&p)=default
path(const path &p)=default
const char * p
Definition: ctype-mb.cc:1237
Definition: gcs_xcom_synode.h:64
HARNESS_STDX_EXPORT bool remove(const path &p, std::error_code &ec) noexcept
Definition: filesystem.cc:148
HARNESS_STDX_EXPORT path current_path()
get current path.
Definition: filesystem.cc:139
Definition: bit.h:34
repeated Source source
Definition: replication_asynchronous_connection_failover.proto:42
#define HARNESS_STDX_EXPORT
Definition: stdx_export.h:15