${experimental_srcdir}/array \
${experimental_srcdir}/chrono \
${experimental_srcdir}/deque \
- ${experimental_srcdir}/erase_if.h \
${experimental_srcdir}/forward_list \
${experimental_srcdir}/functional \
${experimental_srcdir}/iterator \
${experimental_srcdir}/set \
${experimental_srcdir}/string \
${experimental_srcdir}/string_view \
- ${experimental_srcdir}/string_view.tcc \
${experimental_srcdir}/system_error \
${experimental_srcdir}/tuple \
${experimental_srcdir}/type_traits \
${experimental_srcdir}/vector \
${experimental_filesystem_headers}
+experimental_bits_srcdir = ${glibcxx_srcdir}/include/experimental/bits
+experimental_bits_builddir = ./experimental/bits
+experimental_bits_headers = \
+ ${experimental_bits_srcdir}/erase_if.h \
+ ${experimental_bits_srcdir}/string_view.tcc \
+ ${experimental_bits_filesystem_headers}
+
if ENABLE_FILESYSTEM_TS
experimental_filesystem_headers = \
- ${experimental_srcdir}/filesystem \
- ${experimental_srcdir}/fs_dir.h \
- ${experimental_srcdir}/fs_fwd.h \
- ${experimental_srcdir}/fs_ops.h \
- ${experimental_srcdir}/fs_path.h
+ ${experimental_srcdir}/filesystem
+experimental_bits_filesystem_headers = \
+ ${experimental_bits_srcdir}/fs_dir.h \
+ ${experimental_bits_srcdir}/fs_fwd.h \
+ ${experimental_bits_srcdir}/fs_ops.h \
+ ${experimental_bits_srcdir}/fs_path.h
else
experimental_filesystem_headers =
+experimental_bits_filesystem_headers =
endif
# This is the common subset of C++ files that all three "C" header models use.
allstamped = \
stamp-std stamp-bits stamp-bits-sup stamp-c_base stamp-c_compatibility \
stamp-backward stamp-ext stamp-pb stamp-tr1 stamp-tr2 stamp-decimal \
- stamp-experimental stamp-debug stamp-parallel stamp-profile \
- stamp-profile-impl stamp-host
+ stamp-experimental stamp-experimental-bits stamp-debug stamp-parallel \
+ stamp-profile stamp-profile-impl stamp-host
# List of all files that are created by explicit building, editing, or
# catenation.
@-cd ${experimental_builddir} && $(LN_S) $? . 2>/dev/null
@$(STAMP) stamp-experimental
+stamp-experimental-bits: ${experimental_bits_headers}
+ @-mkdir -p ${experimental_bits_builddir}
+ @-cd ${experimental_bits_builddir} && $(LN_S) $? . 2>/dev/null
+ @$(STAMP) stamp-experimental-bits
+
stamp-debug: ${debug_headers}
@-mkdir -p ${debug_builddir}
@-cd ${debug_builddir} && $(LN_S) $? . 2>/dev/null
$(mkinstalldirs) $(DESTDIR)${gxx_include_dir}/${experimental_builddir}
for file in ${experimental_headers}; do \
$(INSTALL_DATA) $${file} $(DESTDIR)${gxx_include_dir}/${experimental_builddir}; done
+ $(mkinstalldirs) $(DESTDIR)${gxx_include_dir}/${experimental_bits_builddir}
+ for file in ${experimental_bits_headers}; do \
+ $(INSTALL_DATA) $${file} $(DESTDIR)${gxx_include_dir}/${experimental_bits_builddir}; done
$(mkinstalldirs) $(DESTDIR)${gxx_include_dir}/${c_base_builddir}
for file in ${c_base_headers}; do \
$(INSTALL_DATA) $${file} $(DESTDIR)${gxx_include_dir}/${c_base_builddir}; done
# be made.)
.PRECIOUS: $(std_headers) $(c_base_headers) $(tr1_headers) $(tr2_headers)
$(decimal_headers) $(ext_headers) $(experimental_headers)
+ $(experimental_bits_headers)
$(std_headers): ; @:
$(c_base_headers): ; @:
$(tr1_headers): ; @:
$(decimal_headers): ; @:
$(ext_headers): ; @:
$(experimental_headers): ; @:
+$(experimental_bits_headers): ; @:
${experimental_srcdir}/array \
${experimental_srcdir}/chrono \
${experimental_srcdir}/deque \
- ${experimental_srcdir}/erase_if.h \
${experimental_srcdir}/forward_list \
${experimental_srcdir}/functional \
${experimental_srcdir}/iterator \
${experimental_srcdir}/set \
${experimental_srcdir}/string \
${experimental_srcdir}/string_view \
- ${experimental_srcdir}/string_view.tcc \
${experimental_srcdir}/system_error \
${experimental_srcdir}/tuple \
${experimental_srcdir}/type_traits \
${experimental_srcdir}/vector \
${experimental_filesystem_headers}
+experimental_bits_srcdir = ${glibcxx_srcdir}/include/experimental/bits
+experimental_bits_builddir = ./experimental/bits
+experimental_bits_headers = \
+ ${experimental_bits_srcdir}/erase_if.h \
+ ${experimental_bits_srcdir}/string_view.tcc \
+ ${experimental_bits_filesystem_headers}
+
@ENABLE_FILESYSTEM_TS_FALSE@experimental_filesystem_headers =
@ENABLE_FILESYSTEM_TS_TRUE@experimental_filesystem_headers = \
-@ENABLE_FILESYSTEM_TS_TRUE@ ${experimental_srcdir}/filesystem \
-@ENABLE_FILESYSTEM_TS_TRUE@ ${experimental_srcdir}/fs_dir.h \
-@ENABLE_FILESYSTEM_TS_TRUE@ ${experimental_srcdir}/fs_fwd.h \
-@ENABLE_FILESYSTEM_TS_TRUE@ ${experimental_srcdir}/fs_ops.h \
-@ENABLE_FILESYSTEM_TS_TRUE@ ${experimental_srcdir}/fs_path.h
+@ENABLE_FILESYSTEM_TS_TRUE@ ${experimental_srcdir}/filesystem
+
+@ENABLE_FILESYSTEM_TS_FALSE@experimental_bits_filesystem_headers =
+@ENABLE_FILESYSTEM_TS_TRUE@experimental_bits_filesystem_headers = \
+@ENABLE_FILESYSTEM_TS_TRUE@ ${experimental_bits_srcdir}/fs_dir.h \
+@ENABLE_FILESYSTEM_TS_TRUE@ ${experimental_bits_srcdir}/fs_fwd.h \
+@ENABLE_FILESYSTEM_TS_TRUE@ ${experimental_bits_srcdir}/fs_ops.h \
+@ENABLE_FILESYSTEM_TS_TRUE@ ${experimental_bits_srcdir}/fs_path.h
# This is the common subset of C++ files that all three "C" header models use.
allstamped = \
stamp-std stamp-bits stamp-bits-sup stamp-c_base stamp-c_compatibility \
stamp-backward stamp-ext stamp-pb stamp-tr1 stamp-tr2 stamp-decimal \
- stamp-experimental stamp-debug stamp-parallel stamp-profile \
- stamp-profile-impl stamp-host
+ stamp-experimental stamp-experimental-bits stamp-debug stamp-parallel \
+ stamp-profile stamp-profile-impl stamp-host
# List of all files that are created by explicit building, editing, or
@-cd ${experimental_builddir} && $(LN_S) $? . 2>/dev/null
@$(STAMP) stamp-experimental
+stamp-experimental-bits: ${experimental_bits_headers}
+ @-mkdir -p ${experimental_bits_builddir}
+ @-cd ${experimental_bits_builddir} && $(LN_S) $? . 2>/dev/null
+ @$(STAMP) stamp-experimental-bits
+
stamp-debug: ${debug_headers}
@-mkdir -p ${debug_builddir}
@-cd ${debug_builddir} && $(LN_S) $? . 2>/dev/null
$(mkinstalldirs) $(DESTDIR)${gxx_include_dir}/${experimental_builddir}
for file in ${experimental_headers}; do \
$(INSTALL_DATA) $${file} $(DESTDIR)${gxx_include_dir}/${experimental_builddir}; done
+ $(mkinstalldirs) $(DESTDIR)${gxx_include_dir}/${experimental_bits_builddir}
+ for file in ${experimental_bits_headers}; do \
+ $(INSTALL_DATA) $${file} $(DESTDIR)${gxx_include_dir}/${experimental_bits_builddir}; done
$(mkinstalldirs) $(DESTDIR)${gxx_include_dir}/${c_base_builddir}
for file in ${c_base_headers}; do \
$(INSTALL_DATA) $${file} $(DESTDIR)${gxx_include_dir}/${c_base_builddir}; done
# be made.)
.PRECIOUS: $(std_headers) $(c_base_headers) $(tr1_headers) $(tr2_headers)
$(decimal_headers) $(ext_headers) $(experimental_headers)
+ $(experimental_bits_headers)
$(std_headers): ; @:
$(c_base_headers): ; @:
$(tr1_headers): ; @:
$(decimal_headers): ; @:
$(ext_headers): ; @:
$(experimental_headers): ; @:
+$(experimental_bits_headers): ; @:
# Tell versions [3.59,3.63) of GNU make to not export all variables.
# Otherwise a system limit (for SysV at least) may be exceeded.
--- /dev/null
+// <experimental/bits/erase_if.h> -*- C++ -*-
+
+// Copyright (C) 2015 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// Under Section 7 of GPL version 3, you are granted additional
+// permissions described in the GCC Runtime Library Exception, version
+// 3.1, as published by the Free Software Foundation.
+
+// You should have received a copy of the GNU General Public License and
+// a copy of the GCC Runtime Library Exception along with this program;
+// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
+// <http://www.gnu.org/licenses/>.
+
+/** @file experimental/bits/erase_if.h
+ * This is an internal header file, included by other library headers.
+ * Do not attempt to use it directly.
+ */
+
+#ifndef _GLIBCXX_EXPERIMENTAL_ERASE_IF_H
+#define _GLIBCXX_EXPERIMENTAL_ERASE_IF_H 1
+
+#pragma GCC system_header
+
+#if __cplusplus <= 201103L
+# include <bits/c++14_warning.h>
+#else
+
+namespace std
+{
+namespace experimental
+{
+inline namespace fundamentals_v2
+{
+
+ namespace __detail
+ {
+ template<typename _Container, typename _Predicate>
+ void
+ __erase_nodes_if(_Container& __cont, _Predicate __pred)
+ {
+ for (auto __iter = __cont.begin(), __last = __cont.end();
+ __iter != __last;)
+ {
+ if (__pred(*__iter))
+ __iter = __cont.erase(__iter);
+ else
+ ++__iter;
+ }
+ }
+ }
+
+
+} // inline namespace fundamentals_v2
+} // namespace experimental
+} // namespace std
+
+#endif // C++14
+
+#endif // _GLIBCXX_EXPERIMENTAL_ERASE_IF_H
--- /dev/null
+// Filesystem directory utilities -*- C++ -*-
+
+// Copyright (C) 2014-2015 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// Under Section 7 of GPL version 3, you are granted additional
+// permissions described in the GCC Runtime Library Exception, version
+// 3.1, as published by the Free Software Foundation.
+
+// You should have received a copy of the GNU General Public License and
+// a copy of the GCC Runtime Library Exception along with this program;
+// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
+// <http://www.gnu.org/licenses/>.
+
+/** @file experimental/fs_dir.h
+ * This is an internal header file, included by other library headers.
+ * Do not attempt to use it directly. @headername{experimental/filesystem}
+ */
+
+#ifndef _GLIBCXX_EXPERIMENTAL_FS_DIR_H
+#define _GLIBCXX_EXPERIMENTAL_FS_DIR_H 1
+
+#if __cplusplus < 201103L
+# include <bits/c++0x_warning.h>
+#else
+# include <typeinfo>
+# include <ext/concurrence.h>
+# include <bits/unique_ptr.h>
+# include <bits/shared_ptr.h>
+
+namespace std _GLIBCXX_VISIBILITY(default)
+{
+namespace experimental
+{
+namespace filesystem
+{
+inline namespace v1
+{
+_GLIBCXX_BEGIN_NAMESPACE_VERSION
+
+ /**
+ * @ingroup filesystem
+ * @{
+ */
+
+ class file_status
+ {
+ public:
+ // constructors
+ explicit
+ file_status(file_type __ft = file_type::none,
+ perms __prms = perms::unknown) noexcept
+ : _M_type(__ft), _M_perms(__prms) { }
+
+ file_status(const file_status&) noexcept = default;
+ file_status(file_status&&) noexcept = default;
+ ~file_status() = default;
+
+ file_status& operator=(const file_status&) noexcept = default;
+ file_status& operator=(file_status&&) noexcept = default;
+
+ // observers
+ file_type type() const noexcept { return _M_type; }
+ perms permissions() const noexcept { return _M_perms; }
+
+ // modifiers
+ void type(file_type __ft) noexcept { _M_type = __ft; }
+ void permissions(perms __prms) noexcept { _M_perms = __prms; }
+
+ private:
+ file_type _M_type;
+ perms _M_perms;
+ };
+
+_GLIBCXX_BEGIN_NAMESPACE_CXX11
+
+ class directory_entry
+ {
+ public:
+ // constructors and destructor
+ directory_entry() noexcept = default;
+ directory_entry(const directory_entry&) = default;
+ directory_entry(directory_entry&&) noexcept = default;
+ explicit directory_entry(const filesystem::path& __p) : _M_path(__p) { }
+ ~directory_entry() = default;
+
+ // modifiers
+ directory_entry& operator=(const directory_entry&) = default;
+ directory_entry& operator=(directory_entry&&) noexcept = default;
+
+ void assign(const filesystem::path& __p) { _M_path = __p; }
+
+ void
+ replace_filename(const filesystem::path& __p)
+ { _M_path = _M_path.parent_path() / __p; }
+
+ // observers
+ const filesystem::path& path() const noexcept { return _M_path; }
+ operator const filesystem::path&() const noexcept { return _M_path; }
+
+ file_status
+ status() const
+ { return filesystem::status(_M_path); }
+
+ file_status
+ status(error_code& __ec) const noexcept
+ { return filesystem::status(_M_path, __ec); }
+
+ file_status
+ symlink_status() const
+ { return filesystem::symlink_status(_M_path); }
+
+ file_status
+ symlink_status(error_code& __ec) const noexcept
+ { return filesystem::symlink_status(_M_path, __ec); }
+
+ bool
+ operator< (const directory_entry& __rhs) const noexcept
+ { return _M_path < __rhs._M_path; }
+
+ bool
+ operator==(const directory_entry& __rhs) const noexcept
+ { return _M_path == __rhs._M_path; }
+
+ bool
+ operator!=(const directory_entry& __rhs) const noexcept
+ { return _M_path != __rhs._M_path; }
+
+ bool
+ operator<=(const directory_entry& __rhs) const noexcept
+ { return _M_path <= __rhs._M_path; }
+
+ bool
+ operator> (const directory_entry& __rhs) const noexcept
+ { return _M_path > __rhs._M_path; }
+
+ bool
+ operator>=(const directory_entry& __rhs) const noexcept
+ { return _M_path >= __rhs._M_path; }
+
+ private:
+ filesystem::path _M_path;
+ };
+
+ struct _Dir;
+ class recursive_directory_iterator;
+
+ class directory_iterator
+ {
+ public:
+ typedef directory_entry value_type;
+ typedef ptrdiff_t difference_type;
+ typedef const directory_entry* pointer;
+ typedef const directory_entry& reference;
+ typedef input_iterator_tag iterator_category;
+
+ directory_iterator() noexcept = default;
+
+ explicit
+ directory_iterator(const path& __p)
+ : directory_iterator(__p, directory_options::none, nullptr) { }
+
+ directory_iterator(const path& __p, directory_options __options)
+ : directory_iterator(__p, __options, nullptr) { }
+
+ directory_iterator(const path& __p, error_code& __ec) noexcept
+ : directory_iterator(__p, directory_options::none, __ec) { }
+
+ directory_iterator(const path& __p,
+ directory_options __options, error_code& __ec) noexcept
+ : directory_iterator(__p, __options, &__ec) { }
+
+ directory_iterator(const directory_iterator& __rhs) = default;
+
+ directory_iterator(directory_iterator&& __rhs) noexcept = default;
+
+ ~directory_iterator() = default;
+
+ directory_iterator& operator=(const directory_iterator& __rhs) = default;
+ directory_iterator& operator=(directory_iterator&& __rhs) noexcept = default;
+
+ const directory_entry& operator*() const;
+ const directory_entry* operator->() const { return &**this; }
+ directory_iterator& operator++();
+ directory_iterator& increment(error_code& __ec) noexcept;
+
+ directory_iterator operator++(int)
+ {
+ auto __tmp = *this;
+ ++*this;
+ return __tmp;
+ }
+
+ private:
+ directory_iterator(const path&, directory_options, error_code*);
+
+ friend bool
+ operator==(const directory_iterator& __lhs,
+ const directory_iterator& __rhs);
+
+ friend class recursive_directory_iterator;
+
+ std::shared_ptr<_Dir> _M_dir;
+ };
+
+ inline directory_iterator
+ begin(directory_iterator __iter) { return __iter; }
+
+ inline directory_iterator
+ end(directory_iterator) { return directory_iterator(); }
+
+ inline bool
+ operator==(const directory_iterator& __lhs, const directory_iterator& __rhs)
+ {
+ return !__rhs._M_dir.owner_before(__lhs._M_dir)
+ && !__lhs._M_dir.owner_before(__rhs._M_dir);
+ }
+
+ inline bool
+ operator!=(const directory_iterator& __lhs, const directory_iterator& __rhs)
+ { return !(__lhs == __rhs); }
+
+ class recursive_directory_iterator
+ {
+ public:
+ typedef directory_entry value_type;
+ typedef ptrdiff_t difference_type;
+ typedef const directory_entry* pointer;
+ typedef const directory_entry& reference;
+ typedef input_iterator_tag iterator_category;
+
+ recursive_directory_iterator() noexcept = default;
+
+ explicit
+ recursive_directory_iterator(const path& __p)
+ : recursive_directory_iterator(__p, directory_options::none, nullptr) { }
+
+ recursive_directory_iterator(const path& __p, directory_options __options)
+ : recursive_directory_iterator(__p, __options, nullptr) { }
+
+ recursive_directory_iterator(const path& __p,
+ directory_options __options,
+ error_code& __ec) noexcept
+ : recursive_directory_iterator(__p, __options, &__ec) { }
+
+ recursive_directory_iterator(const path& __p, error_code& __ec) noexcept
+ : recursive_directory_iterator(__p, directory_options::none, &__ec) { }
+
+ recursive_directory_iterator(
+ const recursive_directory_iterator&) = default;
+
+ recursive_directory_iterator(
+ recursive_directory_iterator&&) noexcept = default;
+
+ ~recursive_directory_iterator();
+
+ // observers
+ directory_options options() const { return _M_options; }
+ int depth() const;
+ bool recursion_pending() const { return _M_pending; }
+
+ const directory_entry& operator*() const;
+ const directory_entry* operator->() const { return &**this; }
+
+ // modifiers
+ recursive_directory_iterator&
+ operator=(const recursive_directory_iterator& __rhs) noexcept;
+ recursive_directory_iterator&
+ operator=(recursive_directory_iterator&& __rhs) noexcept;
+
+ recursive_directory_iterator& operator++();
+ recursive_directory_iterator& increment(error_code& __ec) noexcept;
+
+ recursive_directory_iterator operator++(int)
+ {
+ auto __tmp = *this;
+ ++*this;
+ return __tmp;
+ }
+
+ void pop();
+
+ void disable_recursion_pending() { _M_pending = false; }
+
+ private:
+ recursive_directory_iterator(const path&, directory_options, error_code*);
+
+ friend bool
+ operator==(const recursive_directory_iterator& __lhs,
+ const recursive_directory_iterator& __rhs);
+
+ struct _Dir_stack;
+ std::shared_ptr<_Dir_stack> _M_dirs;
+ directory_options _M_options;
+ bool _M_pending;
+ };
+
+ inline recursive_directory_iterator
+ begin(recursive_directory_iterator __iter) { return __iter; }
+
+ inline recursive_directory_iterator
+ end(recursive_directory_iterator) { return recursive_directory_iterator(); }
+
+ inline bool
+ operator==(const recursive_directory_iterator& __lhs,
+ const recursive_directory_iterator& __rhs)
+ {
+ return !__rhs._M_dirs.owner_before(__lhs._M_dirs)
+ && !__lhs._M_dirs.owner_before(__rhs._M_dirs);
+ }
+
+ inline bool
+ operator!=(const recursive_directory_iterator& __lhs,
+ const recursive_directory_iterator& __rhs)
+ { return !(__lhs == __rhs); }
+
+_GLIBCXX_END_NAMESPACE_CXX11
+
+ // @} group filesystem
+_GLIBCXX_END_NAMESPACE_VERSION
+} // namespace v1
+} // namespace filesystem
+} // namespace experimental
+} // namespace std
+
+#endif // C++11
+
+#endif // _GLIBCXX_EXPERIMENTAL_FS_DIR_H
--- /dev/null
+// Filesystem declarations -*- C++ -*-
+
+// Copyright (C) 2014-2015 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// Under Section 7 of GPL version 3, you are granted additional
+// permissions described in the GCC Runtime Library Exception, version
+// 3.1, as published by the Free Software Foundation.
+
+// You should have received a copy of the GNU General Public License and
+// a copy of the GCC Runtime Library Exception along with this program;
+// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
+// <http://www.gnu.org/licenses/>.
+
+/** @file experimental/filesystem
+ * This is a TS C++ Library header.
+ */
+
+#ifndef _GLIBCXX_EXPERIMENTAL_FS_FWD_H
+#define _GLIBCXX_EXPERIMENTAL_FS_FWD_H 1
+
+#if __cplusplus < 201103L
+# include <bits/c++0x_warning.h>
+#else
+
+#include <system_error>
+#include <cstdint>
+#include <chrono>
+
+namespace std _GLIBCXX_VISIBILITY(default)
+{
+namespace experimental
+{
+namespace filesystem
+{
+inline namespace v1
+{
+_GLIBCXX_BEGIN_NAMESPACE_VERSION
+
+#if _GLIBCXX_USE_CXX11_ABI
+ inline namespace __cxx11 __attribute__((__abi_tag__ ("cxx11"))) { }
+#endif
+
+ /**
+ * @defgroup filesystem
+ * @ingroup experimental
+ *
+ * Utilities for performing operations on file systems and their components,
+ * such as paths, regular files, and directories.
+ *
+ * @{
+ */
+
+ class file_status;
+_GLIBCXX_BEGIN_NAMESPACE_CXX11
+ class path;
+ class filesystem_error;
+ class directory_entry;
+ class directory_iterator;
+ class recursive_directory_iterator;
+_GLIBCXX_END_NAMESPACE_CXX11
+
+ struct space_info
+ {
+ uintmax_t capacity;
+ uintmax_t free;
+ uintmax_t available;
+ };
+
+ enum class file_type : signed char {
+ none = 0, not_found = -1, regular = 1, directory = 2, symlink = 3,
+ block = 4, character = 5, fifo = 6, socket = 7, unknown = 8
+ };
+
+ /// Bitmask type
+ enum class copy_options : unsigned short {
+ none = 0,
+ skip_existing = 1, overwrite_existing = 2, update_existing = 4,
+ recursive = 8,
+ copy_symlinks = 16, skip_symlinks = 32,
+ directories_only = 64, create_symlinks = 128, create_hard_links = 256
+ };
+
+ constexpr copy_options
+ operator&(copy_options __x, copy_options __y)
+ {
+ using __utype = typename std::underlying_type<copy_options>::type;
+ return static_cast<copy_options>(
+ static_cast<__utype>(__x) & static_cast<__utype>(__y));
+ }
+
+ constexpr copy_options
+ operator|(copy_options __x, copy_options __y)
+ {
+ using __utype = typename std::underlying_type<copy_options>::type;
+ return static_cast<copy_options>(
+ static_cast<__utype>(__x) | static_cast<__utype>(__y));
+ }
+
+ constexpr copy_options
+ operator^(copy_options __x, copy_options __y)
+ {
+ using __utype = typename std::underlying_type<copy_options>::type;
+ return static_cast<copy_options>(
+ static_cast<__utype>(__x) ^ static_cast<__utype>(__y));
+ }
+
+ constexpr copy_options
+ operator~(copy_options __x)
+ {
+ using __utype = typename std::underlying_type<copy_options>::type;
+ return static_cast<copy_options>(~static_cast<__utype>(__x));
+ }
+
+ inline copy_options&
+ operator&=(copy_options& __x, copy_options __y)
+ { return __x = __x & __y; }
+
+ inline copy_options&
+ operator|=(copy_options& __x, copy_options __y)
+ { return __x = __x | __y; }
+
+ inline copy_options&
+ operator^=(copy_options& __x, copy_options __y)
+ { return __x = __x ^ __y; }
+
+
+ /// Bitmask type
+ enum class perms : unsigned {
+ none = 0,
+ owner_read = 0400,
+ owner_write = 0200,
+ owner_exec = 0100,
+ owner_all = 0700,
+ group_read = 040,
+ group_write = 020,
+ group_exec = 010,
+ group_all = 070,
+ others_read = 04,
+ others_write = 02,
+ others_exec = 01,
+ others_all = 07,
+ all = 0777,
+ set_uid = 04000,
+ set_gid = 02000,
+ sticky_bit = 01000,
+ mask = 07777,
+ unknown = 0xFFFF,
+ add_perms = 0x10000,
+ remove_perms = 0x20000,
+ resolve_symlinks = 0x40000
+ };
+
+ constexpr perms
+ operator&(perms __x, perms __y)
+ {
+ using __utype = typename std::underlying_type<perms>::type;
+ return static_cast<perms>(
+ static_cast<__utype>(__x) & static_cast<__utype>(__y));
+ }
+
+ constexpr perms
+ operator|(perms __x, perms __y)
+ {
+ using __utype = typename std::underlying_type<perms>::type;
+ return static_cast<perms>(
+ static_cast<__utype>(__x) | static_cast<__utype>(__y));
+ }
+
+ constexpr perms
+ operator^(perms __x, perms __y)
+ {
+ using __utype = typename std::underlying_type<perms>::type;
+ return static_cast<perms>(
+ static_cast<__utype>(__x) ^ static_cast<__utype>(__y));
+ }
+
+ constexpr perms
+ operator~(perms __x)
+ {
+ using __utype = typename std::underlying_type<perms>::type;
+ return static_cast<perms>(~static_cast<__utype>(__x));
+ }
+
+ inline perms&
+ operator&=(perms& __x, perms __y)
+ { return __x = __x & __y; }
+
+ inline perms&
+ operator|=(perms& __x, perms __y)
+ { return __x = __x | __y; }
+
+ inline perms&
+ operator^=(perms& __x, perms __y)
+ { return __x = __x ^ __y; }
+
+ // Bitmask type
+ enum class directory_options : unsigned char {
+ none = 0, follow_directory_symlink = 1, skip_permission_denied = 2
+ };
+
+ constexpr directory_options
+ operator&(directory_options __x, directory_options __y)
+ {
+ using __utype = typename std::underlying_type<directory_options>::type;
+ return static_cast<directory_options>(
+ static_cast<__utype>(__x) & static_cast<__utype>(__y));
+ }
+
+ constexpr directory_options
+ operator|(directory_options __x, directory_options __y)
+ {
+ using __utype = typename std::underlying_type<directory_options>::type;
+ return static_cast<directory_options>(
+ static_cast<__utype>(__x) | static_cast<__utype>(__y));
+ }
+
+ constexpr directory_options
+ operator^(directory_options __x, directory_options __y)
+ {
+ using __utype = typename std::underlying_type<directory_options>::type;
+ return static_cast<directory_options>(
+ static_cast<__utype>(__x) ^ static_cast<__utype>(__y));
+ }
+
+ constexpr directory_options
+ operator~(directory_options __x)
+ {
+ using __utype = typename std::underlying_type<directory_options>::type;
+ return static_cast<directory_options>(~static_cast<__utype>(__x));
+ }
+
+ inline directory_options&
+ operator&=(directory_options& __x, directory_options __y)
+ { return __x = __x & __y; }
+
+ inline directory_options&
+ operator|=(directory_options& __x, directory_options __y)
+ { return __x = __x | __y; }
+
+ inline directory_options&
+ operator^=(directory_options& __x, directory_options __y)
+ { return __x = __x ^ __y; }
+
+ typedef chrono::time_point<chrono::system_clock> file_time_type;
+
+ // operational functions
+
+ void copy(const path& __from, const path& __to, copy_options __options);
+ void copy(const path& __from, const path& __to, copy_options __options,
+ error_code&) noexcept;
+
+ bool copy_file(const path& __from, const path& __to, copy_options __option);
+ bool copy_file(const path& __from, const path& __to, copy_options __option,
+ error_code&) noexcept;
+
+ path current_path();
+
+ file_status status(const path&);
+ file_status status(const path&, error_code&) noexcept;
+
+ bool status_known(file_status) noexcept;
+
+ file_status symlink_status(const path&);
+ file_status symlink_status(const path&, error_code&) noexcept;
+
+ bool is_regular_file(file_status) noexcept;
+ bool is_symlink(file_status) noexcept;
+
+ // @} group filesystem
+_GLIBCXX_END_NAMESPACE_VERSION
+} // namespace v1
+} // namespace filesystem
+} // namespace experimental
+} // namespace std
+
+#endif // C++11
+
+#endif // _GLIBCXX_EXPERIMENTAL_FS_FWD_H
--- /dev/null
+// Filesystem operational functions -*- C++ -*-
+
+// Copyright (C) 2014-2015 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your __option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// Under Section 7 of GPL version 3, you are granted additional
+// permissions described in the GCC Runtime Library Exception, version
+// 3.1, as published by the Free Software Foundation.
+
+// You should have received a copy of the GNU General Public License and
+// a copy of the GCC Runtime Library Exception along with this program;
+// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
+// <http://www.gnu.org/licenses/>.
+
+/** @file experimental/filesystem
+ * This is a TS C++ Library header.
+ */
+
+#ifndef _GLIBCXX_EXPERIMENTAL_FS_OPS_H
+#define _GLIBCXX_EXPERIMENTAL_FS_OPS_H 1
+
+#if __cplusplus < 201103L
+# include <bits/c++0x_warning.h>
+#else
+
+#include <cstdint>
+
+namespace std _GLIBCXX_VISIBILITY(default)
+{
+namespace experimental
+{
+namespace filesystem
+{
+inline namespace v1
+{
+_GLIBCXX_BEGIN_NAMESPACE_VERSION
+
+ /**
+ * @ingroup filesystem
+ * @{
+ */
+
+ path absolute(const path& __p, const path& __base = current_path());
+
+ path canonical(const path& __p, const path& __base = current_path());
+ path canonical(const path& __p, error_code& __ec);
+ path canonical(const path& __p, const path& __base, error_code& __ec);
+
+ inline void
+ copy(const path& __from, const path& __to)
+ { copy(__from, __to, copy_options::none); }
+
+ inline void
+ copy(const path& __from, const path& __to, error_code& __ec) noexcept
+ { copy(__from, __to, copy_options::none, __ec); }
+
+ void copy(const path& __from, const path& __to, copy_options __options);
+ void copy(const path& __from, const path& __to, copy_options __options,
+ error_code& __ec) noexcept;
+
+ inline bool
+ copy_file(const path& __from, const path& __to)
+ { return copy_file(__from, __to, copy_options::none); }
+
+ inline bool
+ copy_file(const path& __from, const path& __to, error_code& __ec) noexcept
+ { return copy_file(__from, __to, copy_options::none, __ec); }
+
+ bool copy_file(const path& __from, const path& __to, copy_options __option);
+ bool copy_file(const path& __from, const path& __to, copy_options __option,
+ error_code& __ec) noexcept;
+
+ void copy_symlink(const path& __existing_symlink, const path& __new_symlink);
+ void copy_symlink(const path& __existing_symlink, const path& __new_symlink,
+ error_code& __ec) noexcept;
+
+ bool create_directories(const path& __p);
+ bool create_directories(const path& __p, error_code& __ec) noexcept;
+
+ bool create_directory(const path& __p);
+ bool create_directory(const path& __p, error_code& __ec) noexcept;
+
+ bool create_directory(const path& __p, const path& attributes);
+ bool create_directory(const path& __p, const path& attributes,
+ error_code& __ec) noexcept;
+
+ void create_directory_symlink(const path& __to, const path& __new_symlink);
+ void create_directory_symlink(const path& __to, const path& __new_symlink,
+ error_code& __ec) noexcept;
+
+ void create_hard_link(const path& __to, const path& __new_hard_link);
+ void create_hard_link(const path& __to, const path& __new_hard_link,
+ error_code& __ec) noexcept;
+
+ void create_symlink(const path& __to, const path& __new_symlink);
+ void create_symlink(const path& __to, const path& __new_symlink,
+ error_code& __ec) noexcept;
+
+ path current_path();
+ path current_path(error_code& __ec);
+ void current_path(const path& __p);
+ void current_path(const path& __p, error_code& __ec) noexcept;
+
+ inline bool
+ exists(file_status __s) noexcept
+ { return status_known(__s) && __s.type() != file_type::not_found; }
+
+ inline bool
+ exists(const path& __p)
+ { return exists(status(__p)); }
+
+ inline bool
+ exists(const path& __p, error_code& __ec) noexcept
+ { return exists(status(__p, __ec)); }
+
+ bool
+ equivalent(const path& __p1, const path& __p2);
+
+ bool
+ equivalent(const path& __p1, const path& __p2, error_code& __ec) noexcept;
+
+ uintmax_t file_size(const path& __p);
+ uintmax_t file_size(const path& __p, error_code& __ec) noexcept;
+
+ uintmax_t hard_link_count(const path& __p);
+ uintmax_t hard_link_count(const path& __p, error_code& __ec) noexcept;
+
+ inline bool
+ is_block_file(file_status __s) noexcept
+ { return __s.type() == file_type::block; }
+
+ inline bool
+ is_block_file(const path& __p)
+ { return is_block_file(status(__p)); }
+
+ inline bool
+ is_block_file(const path& __p, error_code& __ec) noexcept
+ { return is_block_file(status(__p, __ec)); }
+
+ inline bool
+ is_character_file(file_status __s) noexcept
+ { return __s.type() == file_type::character; }
+
+ inline bool
+ is_character_file(const path& __p)
+ { return is_character_file(status(__p)); }
+
+ inline bool
+ is_character_file(const path& __p, error_code& __ec) noexcept
+ { return is_character_file(status(__p, __ec)); }
+
+ inline bool
+ is_directory(file_status __s) noexcept
+ { return __s.type() == file_type::directory; }
+
+ inline bool
+ is_directory(const path& __p)
+ { return is_directory(status(__p)); }
+
+ inline bool
+ is_directory(const path& __p, error_code& __ec) noexcept
+ { return is_directory(status(__p, __ec)); }
+
+ bool is_empty(const path& __p);
+ bool is_empty(const path& __p, error_code& __ec) noexcept;
+
+ inline bool
+ is_fifo(file_status __s) noexcept
+ { return __s.type() == file_type::fifo; }
+
+ inline bool
+ is_fifo(const path& __p)
+ { return is_fifo(status(__p)); }
+
+ inline bool
+ is_fifo(const path& __p, error_code& __ec) noexcept
+ { return is_fifo(status(__p, __ec)); }
+
+ inline bool
+ is_other(file_status __s) noexcept
+ {
+ return exists(__s) && !is_regular_file(__s) && !is_directory(__s)
+ && !is_symlink(__s);
+ }
+
+ inline bool
+ is_other(const path& __p)
+ { return is_other(status(__p)); }
+
+ inline bool
+ is_other(const path& __p, error_code& __ec) noexcept
+ { return is_other(status(__p, __ec)); }
+
+ inline bool
+ is_regular_file(file_status __s) noexcept
+ { return __s.type() == file_type::regular; }
+
+ inline bool
+ is_regular_file(const path& __p)
+ { return is_regular_file(status(__p)); }
+
+ inline bool
+ is_regular_file(const path& __p, error_code& __ec) noexcept
+ { return is_regular_file(status(__p, __ec)); }
+
+ inline bool
+ is_socket(file_status __s) noexcept
+ { return __s.type() == file_type::socket; }
+
+ inline bool
+ is_socket(const path& __p)
+ { return is_socket(status(__p)); }
+
+ inline bool
+ is_socket(const path& __p, error_code& __ec) noexcept
+ { return is_socket(status(__p, __ec)); }
+
+ inline bool
+ is_symlink(file_status __s) noexcept
+ { return __s.type() == file_type::symlink; }
+
+ inline bool
+ is_symlink(const path& __p)
+ { return is_symlink(symlink_status(__p)); }
+
+ inline bool
+ is_symlink(const path& __p, error_code& __ec) noexcept
+ { return is_symlink(symlink_status(__p, __ec)); }
+
+ file_time_type last_write_time(const path& __p);
+ file_time_type last_write_time(const path& __p, error_code& __ec) noexcept;
+ void last_write_time(const path& __p, file_time_type __new_time);
+ void last_write_time(const path& __p, file_time_type __new_time,
+ error_code& __ec) noexcept;
+
+ void permissions(const path& __p, perms __prms);
+ void permissions(const path& __p, perms __prms, error_code& __ec) noexcept;
+
+ path read_symlink(const path& __p);
+ path read_symlink(const path& __p, error_code& __ec);
+
+ bool remove(const path& __p);
+ bool remove(const path& __p, error_code& __ec) noexcept;
+
+ uintmax_t remove_all(const path& __p);
+ uintmax_t remove_all(const path& __p, error_code& __ec) noexcept;
+
+ void rename(const path& __from, const path& __to);
+ void rename(const path& __from, const path& __to, error_code& __ec) noexcept;
+
+ void resize_file(const path& __p, uintmax_t __size);
+ void resize_file(const path& __p, uintmax_t __size, error_code& __ec) noexcept;
+
+ space_info space(const path& __p);
+ space_info space(const path& __p, error_code& __ec) noexcept;
+
+ file_status status(const path& __p);
+ file_status status(const path& __p, error_code& __ec) noexcept;
+
+ inline bool status_known(file_status __s) noexcept
+ { return __s.type() != file_type::none; }
+
+ file_status symlink_status(const path& __p);
+ file_status symlink_status(const path& __p, error_code& __ec) noexcept;
+
+ path system_complete(const path& __p);
+ path system_complete(const path& __p, error_code& __ec);
+
+ path temp_directory_path();
+ path temp_directory_path(error_code& __ec);
+
+ // @} group filesystem
+_GLIBCXX_END_NAMESPACE_VERSION
+} // namespace v1
+} // namespace filesystem
+} // namespace experimental
+} // namespace std
+
+#endif // C++11
+
+#endif // _GLIBCXX_EXPERIMENTAL_FS_OPS_H
--- /dev/null
+// Class filesystem::path -*- C++ -*-
+
+// Copyright (C) 2014-2015 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// Under Section 7 of GPL version 3, you are granted additional
+// permissions described in the GCC Runtime Library Exception, version
+// 3.1, as published by the Free Software Foundation.
+
+// You should have received a copy of the GNU General Public License and
+// a copy of the GCC Runtime Library Exception along with this program;
+// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
+// <http://www.gnu.org/licenses/>.
+
+/** @file experimental/fs_path.h
+ * This is an internal header file, included by other library headers.
+ * Do not attempt to use it directly. @headername{experimental/filesystem}
+ */
+
+#ifndef _GLIBCXX_EXPERIMENTAL_FS_PATH_H
+#define _GLIBCXX_EXPERIMENTAL_FS_PATH_H 1
+
+#if __cplusplus < 201103L
+# include <bits/c++0x_warning.h>
+#else
+
+#include <utility>
+#include <type_traits>
+#include <vector>
+#include <locale>
+#include <iosfwd>
+#include <codecvt>
+#include <system_error>
+#include <bits/stl_algobase.h>
+#include <bits/quoted_string.h>
+#include <bits/locale_conv.h>
+
+#if defined(_WIN32) && !defined(__CYGWIN__)
+# define _GLIBCXX_FILESYSTEM_IS_WINDOWS 1
+# include <algorithm>
+#endif
+
+namespace std _GLIBCXX_VISIBILITY(default)
+{
+namespace experimental
+{
+namespace filesystem
+{
+inline namespace v1
+{
+_GLIBCXX_BEGIN_NAMESPACE_VERSION
+_GLIBCXX_BEGIN_NAMESPACE_CXX11
+
+ /**
+ * @ingroup filesystem
+ * @{
+ */
+
+ /// A filesystem path.
+ class path
+ {
+ template<typename _CharT>
+ struct __is_encoded_char : std::false_type { };
+
+ template<typename _Iter,
+ typename _Iter_traits = std::iterator_traits<_Iter>>
+ using __is_path_iter_src
+ = __and_<__is_encoded_char<typename _Iter_traits::value_type>,
+ std::is_base_of<std::input_iterator_tag,
+ typename _Iter_traits::iterator_category>>;
+
+ template<typename _Iter>
+ static __is_path_iter_src<_Iter>
+ __is_path_src(_Iter, int);
+
+ template<typename _CharT, typename _Traits, typename _Alloc>
+ static __is_encoded_char<_CharT>
+ __is_path_src(const basic_string<_CharT, _Traits, _Alloc>&, int);
+
+ template<typename _Unknown>
+ static std::false_type
+ __is_path_src(const _Unknown&, ...);
+
+ template<typename _Tp1, typename _Tp2>
+ struct __constructible_from;
+
+ template<typename _Iter>
+ struct __constructible_from<_Iter, _Iter>
+ : __is_path_iter_src<_Iter>
+ { };
+
+ template<typename _Source>
+ struct __constructible_from<_Source, void>
+ : decltype(__is_path_src(std::declval<_Source>(), 0))
+ { };
+
+ template<typename _Tp1, typename _Tp2 = void>
+ using _Path = typename
+ std::enable_if<__and_<__not_<is_same<_Tp1, path>>,
+ __constructible_from<_Tp1, _Tp2>>::value,
+ path>::type;
+
+ template<typename _Source>
+ static _Source
+ _S_range_begin(_Source __begin) { return __begin; }
+
+ struct __null_terminated { };
+
+ template<typename _Source>
+ static __null_terminated
+ _S_range_end(_Source) { return {}; }
+
+ template<typename _CharT, typename _Traits, typename _Alloc>
+ static const _CharT*
+ _S_range_begin(const basic_string<_CharT, _Traits, _Alloc>& __str)
+ { return __str.data(); }
+
+ template<typename _CharT, typename _Traits, typename _Alloc>
+ static const _CharT*
+ _S_range_end(const basic_string<_CharT, _Traits, _Alloc>& __str)
+ { return __str.data() + __str.size(); }
+
+ template<typename _Tp,
+ typename _Iter = decltype(_S_range_begin(std::declval<_Tp>())),
+ typename _Val = typename std::iterator_traits<_Iter>::value_type>
+ using __value_type_is_char
+ = typename std::enable_if<std::is_same<_Val, char>::value>::type;
+
+ public:
+#ifdef _GLIBCXX_FILESYSTEM_IS_WINDOWS
+ typedef wchar_t value_type;
+ static constexpr value_type preferred_separator = L'\\';
+#else
+ typedef char value_type;
+ static constexpr value_type preferred_separator = '/';
+#endif
+ typedef std::basic_string<value_type> string_type;
+
+ // constructors and destructor
+
+ path() noexcept { }
+
+ path(const path& __p) = default;
+
+ path(path&& __p) noexcept
+ : _M_pathname(std::move(__p._M_pathname)), _M_type(__p._M_type)
+ {
+ _M_split_cmpts();
+ __p.clear();
+ }
+
+ template<typename _Source,
+ typename _Require = _Path<_Source>>
+ path(_Source const& __source)
+ : _M_pathname(_S_convert(_S_range_begin(__source),
+ _S_range_end(__source)))
+ { _M_split_cmpts(); }
+
+ template<typename _InputIterator,
+ typename _Require = _Path<_InputIterator, _InputIterator>>
+ path(_InputIterator __first, _InputIterator __last)
+ : _M_pathname(_S_convert(__first, __last))
+ { _M_split_cmpts(); }
+
+ template<typename _Source,
+ typename _Require = _Path<_Source>,
+ typename _Require2 = __value_type_is_char<_Source>>
+ path(_Source const& __source, const locale& __loc)
+ : _M_pathname(_S_convert_loc(_S_range_begin(__source),
+ _S_range_end(__source), __loc))
+ { _M_split_cmpts(); }
+
+ template<typename _InputIterator,
+ typename _Require = _Path<_InputIterator, _InputIterator>,
+ typename _Require2 = __value_type_is_char<_InputIterator>>
+ path(_InputIterator __first, _InputIterator __last, const locale& __loc)
+ : _M_pathname(_S_convert_loc(__first, __last, __loc))
+ { _M_split_cmpts(); }
+
+ ~path() = default;
+
+ // assignments
+
+ path& operator=(const path& __p) = default;
+ path& operator=(path&& __p) noexcept;
+
+ template<typename _Source>
+ _Path<_Source>&
+ operator=(_Source const& __source)
+ { return *this = path(__source); }
+
+ template<typename _Source>
+ _Path<_Source>&
+ assign(_Source const& __source)
+ { return *this = path(__source); }
+
+ template<typename _InputIterator>
+ _Path<_InputIterator, _InputIterator>&
+ assign(_InputIterator __first, _InputIterator __last)
+ { return *this = path(__first, __last); }
+
+ // appends
+
+ path& operator/=(const path& __p) { return _M_append(__p._M_pathname); }
+
+ template <class _Source>
+ _Path<_Source>&
+ operator/=(_Source const& __source)
+ { return append(__source); }
+
+ template<typename _Source>
+ _Path<_Source>&
+ append(_Source const& __source)
+ {
+ return _M_append(_S_convert(_S_range_begin(__source),
+ _S_range_end(__source)));
+ }
+
+ template<typename _InputIterator>
+ _Path<_InputIterator, _InputIterator>&
+ append(_InputIterator __first, _InputIterator __last)
+ { return _M_append(_S_convert(__first, __last)); }
+
+ // concatenation
+
+ path& operator+=(const path& __x);
+ path& operator+=(const string_type& __x);
+ path& operator+=(const value_type* __x);
+ path& operator+=(value_type __x);
+
+ template<typename _Source>
+ _Path<_Source>&
+ operator+=(_Source const& __x) { return concat(__x); }
+
+ template<typename _CharT>
+ _Path<_CharT*, _CharT*>&
+ operator+=(_CharT __x);
+
+ template<typename _Source>
+ _Path<_Source>&
+ concat(_Source const& __x)
+ { return *this += _S_convert(_S_range_begin(__x), _S_range_end(__x)); }
+
+ template<typename _InputIterator>
+ _Path<_InputIterator, _InputIterator>&
+ concat(_InputIterator __first, _InputIterator __last)
+ { return *this += _S_convert(__first, __last); }
+
+ // modifiers
+
+ void clear() noexcept { _M_pathname.clear(); _M_split_cmpts(); }
+
+ path& make_preferred();
+ path& remove_filename();
+ path& replace_filename(const path& __replacement);
+ path& replace_extension(const path& __replacement = path());
+
+ void swap(path& __rhs) noexcept;
+
+ // native format observers
+
+ const string_type& native() const noexcept { return _M_pathname; }
+ const value_type* c_str() const noexcept { return _M_pathname.c_str(); }
+ operator string_type() const { return _M_pathname; }
+
+ template<typename _CharT, typename _Traits = std::char_traits<_CharT>,
+ typename _Allocator = std::allocator<_CharT>>
+ std::basic_string<_CharT, _Traits, _Allocator>
+ string(const _Allocator& __a = _Allocator()) const;
+
+ std::string string() const;
+#if _GLIBCXX_USE_WCHAR_T
+ std::wstring wstring() const;
+#endif
+ std::string u8string() const;
+ std::u16string u16string() const;
+ std::u32string u32string() const;
+
+ // generic format observers
+ template<typename _CharT, typename _Traits = std::char_traits<_CharT>,
+ typename _Allocator = std::allocator<_CharT>>
+ std::basic_string<_CharT, _Traits, _Allocator>
+ generic_string(const _Allocator& __a = _Allocator()) const;
+
+ std::string generic_string() const;
+#if _GLIBCXX_USE_WCHAR_T
+ std::wstring generic_wstring() const;
+#endif
+ std::string generic_u8string() const;
+ std::u16string generic_u16string() const;
+ std::u32string generic_u32string() const;
+
+ // compare
+
+ int compare(const path& __p) const noexcept;
+ int compare(const string_type& __s) const;
+ int compare(const value_type* __s) const;
+
+ // decomposition
+
+ path root_name() const;
+ path root_directory() const;
+ path root_path() const;
+ path relative_path() const;
+ path parent_path() const;
+ path filename() const;
+ path stem() const;
+ path extension() const;
+
+ // query
+
+ bool empty() const noexcept { return _M_pathname.empty(); }
+ bool has_root_name() const;
+ bool has_root_directory() const;
+ bool has_root_path() const;
+ bool has_relative_path() const;
+ bool has_parent_path() const;
+ bool has_filename() const;
+ bool has_stem() const;
+ bool has_extension() const;
+ bool is_absolute() const;
+ bool is_relative() const { return !is_absolute(); }
+
+ // iterators
+ class iterator;
+ typedef iterator const_iterator;
+
+ iterator begin() const;
+ iterator end() const;
+
+ private:
+ enum class _Type : unsigned char {
+ _Multi, _Root_name, _Root_dir, _Filename
+ };
+
+ path(string_type __str, _Type __type) : _M_pathname(__str), _M_type(__type)
+ {
+ __glibcxx_assert(!empty());
+ __glibcxx_assert(_M_type != _Type::_Multi);
+ }
+
+ enum class _Split { _Stem, _Extension };
+
+ path& _M_append(const string_type& __str)
+ {
+ if (!_M_pathname.empty() && !_S_is_dir_sep(_M_pathname.back())
+ && !__str.empty() && !_S_is_dir_sep(__str.front()))
+ _M_pathname += preferred_separator;
+ _M_pathname += __str;
+ _M_split_cmpts();
+ return *this;
+ }
+
+ pair<const string_type*, size_t> _M_find_extension() const;
+
+ template<typename _CharT>
+ struct _Cvt;
+
+ static string_type
+ _S_convert(value_type* __src, __null_terminated)
+ { return string_type(__src); }
+
+ static string_type
+ _S_convert(const value_type* __src, __null_terminated)
+ { return string_type(__src); }
+
+ template<typename _Iter>
+ static string_type
+ _S_convert(_Iter __first, _Iter __last)
+ {
+ using __value_type = typename std::iterator_traits<_Iter>::value_type;
+ return _Cvt<__value_type>::_S_convert(__first, __last);
+ }
+
+ template<typename _InputIterator>
+ static string_type
+ _S_convert(_InputIterator __src, __null_terminated)
+ {
+ using _Tp = typename std::iterator_traits<_InputIterator>::value_type;
+ std::basic_string<_Tp> __tmp;
+ while (*__src != _Tp{})
+ __tmp.push_back(*__src++);
+ return _S_convert(__tmp.data(), __tmp.data() + __tmp.size());
+ }
+
+ static string_type
+ _S_convert_loc(const char* __first, const char* __last,
+ const std::locale& __loc);
+
+ template<typename _Iter>
+ static string_type
+ _S_convert_loc(_Iter __first, _Iter __last, const std::locale& __loc)
+ {
+ const std::string __str(__first, __last);
+ return _S_convert_loc(__str.data(), __str.data()+__str.size(), __loc);
+ }
+
+ template<typename _InputIterator>
+ static string_type
+ _S_convert_loc(_InputIterator __src, __null_terminated,
+ const std::locale& __loc)
+ {
+ std::string __tmp;
+ while (*__src != '\0')
+ __tmp.push_back(*__src++);
+ return _S_convert_loc(__tmp.data(), __tmp.data()+__tmp.size(), __loc);
+ }
+
+ bool _S_is_dir_sep(value_type __ch)
+ {
+#ifdef _GLIBCXX_FILESYSTEM_IS_WINDOWS
+ return __ch == L'/' || __ch == preferred_separator;
+#else
+ return __ch == '/';
+#endif
+ }
+
+ void _M_split_cmpts();
+ void _M_trim();
+ void _M_add_root_name(size_t __n);
+ void _M_add_root_dir(size_t __pos);
+ void _M_add_filename(size_t __pos, size_t __n);
+
+ string_type _M_pathname;
+
+ struct _Cmpt;
+ using _List = _GLIBCXX_STD_C::vector<_Cmpt>;
+ _List _M_cmpts; // empty unless _M_type == _Type::_Multi
+ _Type _M_type = _Type::_Multi;
+ };
+
+ inline void swap(path& __lhs, path& __rhs) noexcept { __lhs.swap(__rhs); }
+
+ size_t hash_value(const path& __p) noexcept;
+
+ /// Compare paths
+ inline bool operator<(const path& __lhs, const path& __rhs) noexcept
+ { return __lhs.compare(__rhs) < 0; }
+
+ /// Compare paths
+ inline bool operator<=(const path& __lhs, const path& __rhs) noexcept
+ { return !(__rhs < __lhs); }
+
+ /// Compare paths
+ inline bool operator>(const path& __lhs, const path& __rhs) noexcept
+ { return __rhs < __lhs; }
+
+ /// Compare paths
+ inline bool operator>=(const path& __lhs, const path& __rhs) noexcept
+ { return !(__lhs < __rhs); }
+
+ /// Compare paths
+ inline bool operator==(const path& __lhs, const path& __rhs) noexcept
+ { return __lhs.compare(__rhs) == 0; }
+
+ /// Compare paths
+ inline bool operator!=(const path& __lhs, const path& __rhs) noexcept
+ { return !(__lhs == __rhs); }
+
+ /// Append one path to another
+ inline path operator/(const path& __lhs, const path& __rhs)
+ { return path(__lhs) /= __rhs; }
+
+ /// Write a path to a stream
+ template<typename _CharT, typename _Traits>
+ basic_ostream<_CharT, _Traits>&
+ operator<<(basic_ostream<_CharT, _Traits>& __os, const path& __p)
+ {
+ auto __tmp = __p.string<_CharT, _Traits>();
+ using __quoted_string
+ = std::__detail::_Quoted_string<decltype(__tmp)&, _CharT>;
+ __os << __quoted_string{__tmp, '"', '\\'};
+ return __os;
+ }
+
+ /// Read a path from a stream
+ template<typename _CharT, typename _Traits>
+ basic_istream<_CharT, _Traits>&
+ operator>>(basic_istream<_CharT, _Traits>& __is, path& __p)
+ {
+ basic_string<_CharT, _Traits> __tmp;
+ using __quoted_string
+ = std::__detail::_Quoted_string<decltype(__tmp)&, _CharT>;
+ if (__is >> __quoted_string{ __tmp, '"', '\\' })
+ __p = std::move(__tmp);
+ return __is;
+ }
+
+ // TODO constrain with _Path<Source> and __value_type_is_char
+ template<typename _Source>
+ inline path
+ u8path(const _Source& __source)
+ {
+#ifdef _GLIBCXX_FILESYSTEM_IS_WINDOWS
+ return path{ path::string_type{__source} };
+#else
+ return path{ __source };
+#endif
+ }
+
+ // TODO constrain with _Path<InputIterator, InputIterator> and __value_type_is_char
+ template<typename _InputIterator>
+ inline path
+ u8path(_InputIterator __first, _InputIterator __last)
+ {
+#ifdef _GLIBCXX_FILESYSTEM_IS_WINDOWS
+ return path{ path::string_type{__first, __last} };
+#else
+ return path{ __first, __last };
+#endif
+ }
+
+ class filesystem_error : public std::system_error
+ {
+ public:
+ filesystem_error(const string& __what_arg, error_code __ec)
+ : system_error(__ec, __what_arg) { }
+
+ filesystem_error(const string& __what_arg, const path& __p1,
+ error_code __ec)
+ : system_error(__ec, __what_arg), _M_path1(__p1) { }
+
+ filesystem_error(const string& __what_arg, const path& __p1,
+ const path& __p2, error_code __ec)
+ : system_error(__ec, __what_arg), _M_path1(__p1), _M_path2(__p2)
+ { }
+
+ ~filesystem_error();
+
+ const path& path1() const noexcept { return _M_path1; }
+ const path& path2() const noexcept { return _M_path2; }
+ const char* what() const noexcept { return _M_what.c_str(); }
+
+ private:
+ std::string _M_gen_what();
+
+ path _M_path1;
+ path _M_path2;
+ std::string _M_what = _M_gen_what();
+ };
+
+ struct path::_Cmpt : path
+ {
+ _Cmpt(string_type __s, _Type __t, size_t __pos)
+ : path(std::move(__s), __t), _M_pos(__pos) { }
+
+ _Cmpt() : _M_pos(-1) { }
+
+ size_t _M_pos;
+ };
+
+ template<>
+ struct path::__is_encoded_char<char> : std::true_type
+ { using value_type = char; };
+
+ template<>
+ struct path::__is_encoded_char<wchar_t> : std::true_type
+ { using value_type = wchar_t; };
+
+ template<>
+ struct path::__is_encoded_char<char16_t> : std::true_type
+ { using value_type = char16_t; };
+
+ template<>
+ struct path::__is_encoded_char<char32_t> : std::true_type
+ { using value_type = char32_t; };
+
+ // specialize _Cvt for degenerate 'noconv' case
+ template<>
+ struct path::_Cvt<path::value_type>
+ {
+ template<typename _Iter>
+ static string_type
+ _S_convert(_Iter __first, _Iter __last)
+ { return string_type{__first, __last}; }
+ };
+
+ template<typename _CharT>
+ struct path::_Cvt
+ {
+#ifdef _GLIBCXX_FILESYSTEM_IS_WINDOWS
+ static string_type
+ _S_wconvert(const char* __f, const char* __l, true_type)
+ {
+ using _Cvt = std::codecvt<wchar_t, char, mbstate_t>;
+ const auto& __cvt = std::use_facet<_Cvt>(std::locale{});
+ std::wstring __wstr;
+ if (__str_codecvt_in(__f, __l, __wstr, __cvt))
+ return __wstr;
+ _GLIBCXX_THROW_OR_ABORT(filesystem_error(
+ "Cannot convert character sequence",
+ std::make_error_code(errc::illegal_byte_sequence)));
+ }
+
+ static string_type
+ _S_wconvert(const _CharT* __f, const _CharT* __l, false_type)
+ {
+ std::codecvt_utf8<_CharT> __cvt;
+ std::string __str;
+ if (__str_codecvt_out(__f, __l, __str, __cvt))
+ {
+ const char* __f2 = __str.data();
+ const char* __l2 = __f2 + __str.size();
+ std::codecvt_utf8<wchar_t> __wcvt;
+ std::wstring __wstr;
+ if (__str_codecvt_in(__f2, __l2, __wstr, __wcvt))
+ return __wstr;
+ }
+ _GLIBCXX_THROW_OR_ABORT(filesystem_error(
+ "Cannot convert character sequence",
+ std::make_error_code(errc::illegal_byte_sequence)));
+ }
+
+ static string_type
+ _S_convert(const _CharT* __f, const _CharT* __l)
+ {
+ return _S_wconvert(__f, __l, is_same<_CharT, char>{});
+ }
+#else
+ static string_type
+ _S_convert(const _CharT* __f, const _CharT* __l)
+ {
+ std::codecvt_utf8<_CharT> __cvt;
+ std::string __str;
+ if (__str_codecvt_out(__f, __l, __str, __cvt))
+ return __str;
+ _GLIBCXX_THROW_OR_ABORT(filesystem_error(
+ "Cannot convert character sequence",
+ std::make_error_code(errc::illegal_byte_sequence)));
+ }
+#endif
+
+ static string_type
+ _S_convert(_CharT* __f, _CharT* __l)
+ {
+ return _S_convert(const_cast<const _CharT*>(__f),
+ const_cast<const _CharT*>(__l));
+ }
+
+ template<typename _Iter>
+ static string_type
+ _S_convert(_Iter __first, _Iter __last)
+ {
+ const std::basic_string<_CharT> __str(__first, __last);
+ return _S_convert(__str.data(), __str.data() + __str.size());
+ }
+
+ template<typename _Iter, typename _Cont>
+ static string_type
+ _S_convert(__gnu_cxx::__normal_iterator<_Iter, _Cont> __first,
+ __gnu_cxx::__normal_iterator<_Iter, _Cont> __last)
+ { return _S_convert(__first.base(), __last.base()); }
+ };
+
+ /// An iterator for the components of a path
+ class path::iterator
+ {
+ public:
+ using difference_type = std::ptrdiff_t;
+ using value_type = path;
+ using reference = const path&;
+ using pointer = const path*;
+ using iterator_category = std::bidirectional_iterator_tag;
+
+ iterator() : _M_path(nullptr), _M_cur(), _M_at_end() { }
+
+ iterator(const iterator&) = default;
+ iterator& operator=(const iterator&) = default;
+
+ reference operator*() const;
+ pointer operator->() const { return std::__addressof(**this); }
+
+ iterator& operator++();
+ iterator operator++(int) { auto __tmp = *this; ++_M_cur; return __tmp; }
+
+ iterator& operator--();
+ iterator operator--(int) { auto __tmp = *this; --_M_cur; return __tmp; }
+
+ friend bool operator==(const iterator& __lhs, const iterator& __rhs)
+ { return __lhs._M_equals(__rhs); }
+
+ friend bool operator!=(const iterator& __lhs, const iterator& __rhs)
+ { return !__lhs._M_equals(__rhs); }
+
+ private:
+ friend class path;
+
+ iterator(const path* __path, path::_List::const_iterator __iter)
+ : _M_path(__path), _M_cur(__iter), _M_at_end()
+ { }
+
+ iterator(const path* __path, bool __at_end)
+ : _M_path(__path), _M_cur(), _M_at_end(__at_end)
+ { }
+
+ bool _M_equals(iterator) const;
+
+ const path* _M_path;
+ path::_List::const_iterator _M_cur;
+ bool _M_at_end; // only used when type != _Multi
+ };
+
+
+ inline path&
+ path::operator=(path&& __p) noexcept
+ {
+ _M_pathname = std::move(__p._M_pathname);
+ _M_cmpts = std::move(__p._M_cmpts);
+ _M_type = __p._M_type;
+ __p.clear();
+ return *this;
+ }
+
+ inline path&
+ path::operator+=(const path& __p)
+ {
+ return operator+=(__p.native());
+ }
+
+ inline path&
+ path::operator+=(const string_type& __x)
+ {
+ _M_pathname += __x;
+ _M_split_cmpts();
+ return *this;
+ }
+
+ inline path&
+ path::operator+=(const value_type* __x)
+ {
+ _M_pathname += __x;
+ _M_split_cmpts();
+ return *this;
+ }
+
+ inline path&
+ path::operator+=(value_type __x)
+ {
+ _M_pathname += __x;
+ _M_split_cmpts();
+ return *this;
+ }
+
+ template<typename _CharT>
+ inline path::_Path<_CharT*, _CharT*>&
+ path::operator+=(_CharT __x)
+ {
+ auto* __addr = std::__addressof(__x);
+ return concat(__addr, __addr + 1);
+ }
+
+ inline path&
+ path::make_preferred()
+ {
+#ifdef _GLIBCXX_FILESYSTEM_IS_WINDOWS
+ std::replace(_M_pathname.begin(), _M_pathname.end(), L'/',
+ preferred_separator);
+#endif
+ return *this;
+ }
+
+ inline void path::swap(path& __rhs) noexcept
+ {
+ _M_pathname.swap(__rhs._M_pathname);
+ _M_cmpts.swap(__rhs._M_cmpts);
+ std::swap(_M_type, __rhs._M_type);
+ }
+
+ template<typename _CharT, typename _Traits, typename _Allocator>
+ inline std::basic_string<_CharT, _Traits, _Allocator>
+ path::string(const _Allocator& __a) const
+ {
+ if (is_same<_CharT, value_type>::value)
+ return { _M_pathname.begin(), _M_pathname.end(), __a };
+
+ const value_type* __first = _M_pathname.data();
+ const value_type* __last = __first + _M_pathname.size();
+
+#ifdef _GLIBCXX_FILESYSTEM_IS_WINDOWS
+ using _CharAlloc = __alloc_rebind<_Allocator, char>;
+ using _String = basic_string<char, char_traits<char>, _CharAlloc>;
+ using _WString = basic_string<_CharT, _Traits, _Allocator>;
+
+ // use codecvt_utf8<wchar_t> to convert native string to UTF-8
+ codecvt_utf8<value_type> __cvt;
+ _String __u8str{_CharAlloc{__a}};
+ if (__str_codecvt_out(__first, __last, __u8str, __cvt))
+ {
+ struct
+ {
+ const _String*
+ operator()(const _String& __from, _String&, true_type)
+ { return std::__addressof(__from); }
+
+ _WString*
+ operator()(const _String& __from, _WString& __to, false_type)
+ {
+ // use codecvt_utf8<_CharT> to convert UTF-8 to wide string
+ codecvt_utf8<_CharT> __cvt;
+ const char* __f = __from.data();
+ const char* __l = __f + __from.size();
+ if (__str_codecvt_in(__f, __l, __to, __cvt))
+ return std::__addressof(__to);
+ return nullptr;
+ }
+ } __dispatch;
+ _WString __wstr;
+ if (auto* __p = __dispatch(__u8str, __wstr, is_same<_CharT, char>{}))
+ return *__p;
+ }
+#else
+ codecvt_utf8<_CharT> __cvt;
+ basic_string<_CharT, _Traits, _Allocator> __wstr{__a};
+ if (__str_codecvt_in(__first, __last, __wstr, __cvt))
+ return __wstr;
+#endif
+ _GLIBCXX_THROW_OR_ABORT(filesystem_error(
+ "Cannot convert character sequence",
+ std::make_error_code(errc::illegal_byte_sequence)));
+ }
+
+ inline std::string
+ path::string() const { return string<char>(); }
+
+#if _GLIBCXX_USE_WCHAR_T
+ inline std::wstring
+ path::wstring() const { return string<wchar_t>(); }
+#endif
+
+ inline std::string
+ path::u8string() const
+ {
+#ifdef _GLIBCXX_FILESYSTEM_IS_WINDOWS
+ std::string __str;
+ // convert from native encoding to UTF-8
+ codecvt_utf8<value_type> __cvt;
+ const value_type* __first = _M_pathname.data();
+ const value_type* __last = __first + _M_pathname.size();
+ if (__str_codecvt_out(__first, __last, __str, __cvt))
+ return __str;
+ _GLIBCXX_THROW_OR_ABORT(filesystem_error(
+ "Cannot convert character sequence",
+ std::make_error_code(errc::illegal_byte_sequence)));
+#else
+ return _M_pathname;
+#endif
+ }
+
+ inline std::u16string
+ path::u16string() const { return string<char16_t>(); }
+
+ inline std::u32string
+ path::u32string() const { return string<char32_t>(); }
+
+#ifndef _GLIBCXX_FILESYSTEM_IS_WINDOWS
+ template<typename _CharT, typename _Traits, typename _Allocator>
+ inline std::basic_string<_CharT, _Traits, _Allocator>
+ path::generic_string(const _Allocator& __a) const
+ { return string<_CharT, _Traits, _Allocator>(__a); }
+
+ inline std::string
+ path::generic_string() const { return string(); }
+
+#if _GLIBCXX_USE_WCHAR_T
+ inline std::wstring
+ path::generic_wstring() const { return wstring(); }
+#endif
+
+ inline std::string
+ path::generic_u8string() const { return u8string(); }
+
+ inline std::u16string
+ path::generic_u16string() const { return u16string(); }
+
+ inline std::u32string
+ path::generic_u32string() const { return u32string(); }
+#endif
+
+ inline int
+ path::compare(const string_type& __s) const { return compare(path(__s)); }
+
+ inline int
+ path::compare(const value_type* __s) const { return compare(path(__s)); }
+
+ inline path
+ path::filename() const { return empty() ? path() : *--end(); }
+
+ inline path
+ path::stem() const
+ {
+ auto ext = _M_find_extension();
+ if (ext.first && ext.second != 0)
+ return path{ext.first->substr(0, ext.second)};
+ return {};
+ }
+
+ inline path
+ path::extension() const
+ {
+ auto ext = _M_find_extension();
+ if (ext.first && ext.second != string_type::npos)
+ return path{ext.first->substr(ext.second)};
+ return {};
+ }
+
+ inline bool
+ path::has_stem() const
+ {
+ auto ext = _M_find_extension();
+ return ext.first && ext.second != 0;
+ }
+
+ inline bool
+ path::has_extension() const
+ {
+ auto ext = _M_find_extension();
+ return ext.first && ext.second != string_type::npos;
+ }
+
+ inline bool
+ path::is_absolute() const
+ {
+#ifdef _GLIBCXX_FILESYSTEM_IS_WINDOWS
+ return has_root_name();
+#else
+ return has_root_directory();
+#endif
+ }
+
+ inline path::iterator
+ path::begin() const
+ {
+ if (_M_type == _Type::_Multi)
+ return iterator(this, _M_cmpts.begin());
+ return iterator(this, false);
+ }
+
+ inline path::iterator
+ path::end() const
+ {
+ if (_M_type == _Type::_Multi)
+ return iterator(this, _M_cmpts.end());
+ return iterator(this, true);
+ }
+
+ inline path::iterator&
+ path::iterator::operator++()
+ {
+ __glibcxx_assert(_M_path != nullptr);
+ if (_M_path->_M_type == _Type::_Multi)
+ {
+ __glibcxx_assert(_M_cur != _M_path->_M_cmpts.end());
+ ++_M_cur;
+ }
+ else
+ {
+ __glibcxx_assert(!_M_at_end);
+ _M_at_end = true;
+ }
+ return *this;
+ }
+
+ inline path::iterator&
+ path::iterator::operator--()
+ {
+ __glibcxx_assert(_M_path != nullptr);
+ if (_M_path->_M_type == _Type::_Multi)
+ {
+ __glibcxx_assert(_M_cur != _M_path->_M_cmpts.begin());
+ --_M_cur;
+ }
+ else
+ {
+ __glibcxx_assert(_M_at_end);
+ _M_at_end = false;
+ }
+ return *this;
+ }
+
+ inline path::iterator::reference
+ path::iterator::operator*() const
+ {
+ __glibcxx_assert(_M_path != nullptr);
+ if (_M_path->_M_type == _Type::_Multi)
+ {
+ __glibcxx_assert(_M_cur != _M_path->_M_cmpts.end());
+ return *_M_cur;
+ }
+ return *_M_path;
+ }
+
+ inline bool
+ path::iterator::_M_equals(iterator __rhs) const
+ {
+ if (_M_path != __rhs._M_path)
+ return false;
+ if (_M_path == nullptr)
+ return true;
+ if (_M_path->_M_type == path::_Type::_Multi)
+ return _M_cur == __rhs._M_cur;
+ return _M_at_end == __rhs._M_at_end;
+ }
+
+ // @} group filesystem
+_GLIBCXX_END_NAMESPACE_CXX11
+_GLIBCXX_END_NAMESPACE_VERSION
+} // namespace v1
+} // namespace filesystem
+} // namespace experimental
+} // namespace std
+
+#endif // C++11
+
+#endif // _GLIBCXX_EXPERIMENTAL_FS_PATH_H
--- /dev/null
+// Components for manipulating non-owning sequences of characters -*- C++ -*-
+
+// Copyright (C) 2013-2015 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// Under Section 7 of GPL version 3, you are granted additional
+// permissions described in the GCC Runtime Library Exception, version
+// 3.1, as published by the Free Software Foundation.
+
+// You should have received a copy of the GNU General Public License and
+// a copy of the GCC Runtime Library Exception along with this program;
+// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
+// <http://www.gnu.org/licenses/>.
+
+/** @file experimental/string_view.tcc
+ * This is an internal header file, included by other library headers.
+ * Do not attempt to use it directly. @headername{string_view}
+ */
+
+//
+// N3762 basic_string_view library
+//
+
+#ifndef _GLIBCXX_EXPERIMENTAL_STRING_VIEW_TCC
+#define _GLIBCXX_EXPERIMENTAL_STRING_VIEW_TCC 1
+
+#pragma GCC system_header
+
+#if __cplusplus <= 201103L
+# include <bits/c++14_warning.h>
+#else
+
+namespace std _GLIBCXX_VISIBILITY(default)
+{
+namespace experimental
+{
+_GLIBCXX_BEGIN_NAMESPACE_VERSION
+
+ template<typename _CharT, typename _Traits>
+ typename basic_string_view<_CharT, _Traits>::size_type
+ basic_string_view<_CharT, _Traits>::
+ find(const _CharT* __str, size_type __pos, size_type __n) const noexcept
+ {
+ __glibcxx_requires_string_len(__str, __n);
+
+ if (__n == 0)
+ return __pos <= this->_M_len ? __pos : npos;
+
+ if (__n <= this->_M_len)
+ {
+ for (; __pos <= this->_M_len - __n; ++__pos)
+ if (traits_type::eq(this->_M_str[__pos], __str[0])
+ && traits_type::compare(this->_M_str + __pos + 1,
+ __str + 1, __n - 1) == 0)
+ return __pos;
+ }
+ return npos;
+ }
+
+ template<typename _CharT, typename _Traits>
+ typename basic_string_view<_CharT, _Traits>::size_type
+ basic_string_view<_CharT, _Traits>::
+ find(_CharT __c, size_type __pos) const noexcept
+ {
+ size_type __ret = npos;
+ if (__pos < this->_M_len)
+ {
+ const size_type __n = this->_M_len - __pos;
+ const _CharT* __p = traits_type::find(this->_M_str + __pos, __n, __c);
+ if (__p)
+ __ret = __p - this->_M_str;
+ }
+ return __ret;
+ }
+
+ template<typename _CharT, typename _Traits>
+ typename basic_string_view<_CharT, _Traits>::size_type
+ basic_string_view<_CharT, _Traits>::
+ rfind(const _CharT* __str, size_type __pos, size_type __n) const noexcept
+ {
+ __glibcxx_requires_string_len(__str, __n);
+
+ if (__n <= this->_M_len)
+ {
+ __pos = std::min(size_type(this->_M_len - __n), __pos);
+ do
+ {
+ if (traits_type::compare(this->_M_str + __pos, __str, __n) == 0)
+ return __pos;
+ }
+ while (__pos-- > 0);
+ }
+ return npos;
+ }
+
+ template<typename _CharT, typename _Traits>
+ typename basic_string_view<_CharT, _Traits>::size_type
+ basic_string_view<_CharT, _Traits>::
+ rfind(_CharT __c, size_type __pos) const noexcept
+ {
+ size_type __size = this->_M_len;
+ if (__size > 0)
+ {
+ if (--__size > __pos)
+ __size = __pos;
+ for (++__size; __size-- > 0; )
+ if (traits_type::eq(this->_M_str[__size], __c))
+ return __size;
+ }
+ return npos;
+ }
+
+ template<typename _CharT, typename _Traits>
+ typename basic_string_view<_CharT, _Traits>::size_type
+ basic_string_view<_CharT, _Traits>::
+ find_first_of(const _CharT* __str, size_type __pos, size_type __n) const
+ {
+ __glibcxx_requires_string_len(__str, __n);
+ for (; __n && __pos < this->_M_len; ++__pos)
+ {
+ const _CharT* __p = traits_type::find(__str, __n,
+ this->_M_str[__pos]);
+ if (__p)
+ return __pos;
+ }
+ return npos;
+ }
+
+ template<typename _CharT, typename _Traits>
+ typename basic_string_view<_CharT, _Traits>::size_type
+ basic_string_view<_CharT, _Traits>::
+ find_last_of(const _CharT* __str, size_type __pos, size_type __n) const
+ {
+ __glibcxx_requires_string_len(__str, __n);
+ size_type __size = this->size();
+ if (__size && __n)
+ {
+ if (--__size > __pos)
+ __size = __pos;
+ do
+ {
+ if (traits_type::find(__str, __n, this->_M_str[__size]))
+ return __size;
+ }
+ while (__size-- != 0);
+ }
+ return npos;
+ }
+
+ template<typename _CharT, typename _Traits>
+ typename basic_string_view<_CharT, _Traits>::size_type
+ basic_string_view<_CharT, _Traits>::
+ find_first_not_of(const _CharT* __str, size_type __pos, size_type __n) const
+ {
+ __glibcxx_requires_string_len(__str, __n);
+ for (; __pos < this->_M_len; ++__pos)
+ if (!traits_type::find(__str, __n, this->_M_str[__pos]))
+ return __pos;
+ return npos;
+ }
+
+ template<typename _CharT, typename _Traits>
+ typename basic_string_view<_CharT, _Traits>::size_type
+ basic_string_view<_CharT, _Traits>::
+ find_first_not_of(_CharT __c, size_type __pos) const noexcept
+ {
+ for (; __pos < this->_M_len; ++__pos)
+ if (!traits_type::eq(this->_M_str[__pos], __c))
+ return __pos;
+ return npos;
+ }
+
+ template<typename _CharT, typename _Traits>
+ typename basic_string_view<_CharT, _Traits>::size_type
+ basic_string_view<_CharT, _Traits>::
+ find_last_not_of(const _CharT* __str, size_type __pos, size_type __n) const
+ {
+ __glibcxx_requires_string_len(__str, __n);
+ size_type __size = this->_M_len;
+ if (__size)
+ {
+ if (--__size > __pos)
+ __size = __pos;
+ do
+ {
+ if (!traits_type::find(__str, __n, this->_M_str[__size]))
+ return __size;
+ }
+ while (__size--);
+ }
+ return npos;
+ }
+
+ template<typename _CharT, typename _Traits>
+ typename basic_string_view<_CharT, _Traits>::size_type
+ basic_string_view<_CharT, _Traits>::
+ find_last_not_of(_CharT __c, size_type __pos) const noexcept
+ {
+ size_type __size = this->_M_len;
+ if (__size)
+ {
+ if (--__size > __pos)
+ __size = __pos;
+ do
+ {
+ if (!traits_type::eq(this->_M_str[__size], __c))
+ return __size;
+ }
+ while (__size--);
+ }
+ return npos;
+ }
+
+_GLIBCXX_END_NAMESPACE_VERSION
+} // namespace experimental
+} // namespace std
+
+#endif // __cplusplus <= 201103L
+
+#endif // _GLIBCXX_EXPERIMENTAL_STRING_VIEW_TCC
+++ /dev/null
-// <experimental/erase_if.h> -*- C++ -*-
-
-// Copyright (C) 2015 Free Software Foundation, Inc.
-//
-// This file is part of the GNU ISO C++ Library. This library is free
-// software; you can redistribute it and/or modify it under the
-// terms of the GNU General Public License as published by the
-// Free Software Foundation; either version 3, or (at your option)
-// any later version.
-
-// This library is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// GNU General Public License for more details.
-
-// Under Section 7 of GPL version 3, you are granted additional
-// permissions described in the GCC Runtime Library Exception, version
-// 3.1, as published by the Free Software Foundation.
-
-// You should have received a copy of the GNU General Public License and
-// a copy of the GCC Runtime Library Exception along with this program;
-// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
-// <http://www.gnu.org/licenses/>.
-
-/** @file experimental/erase_if.h
- * This is an internal header file, included by other library headers.
- * Do not attempt to use it directly.
- */
-
-#ifndef _GLIBCXX_EXPERIMENTAL_ERASE_IF_H
-#define _GLIBCXX_EXPERIMENTAL_ERASE_IF_H 1
-
-#pragma GCC system_header
-
-#if __cplusplus <= 201103L
-# include <bits/c++14_warning.h>
-#else
-
-namespace std
-{
-namespace experimental
-{
-inline namespace fundamentals_v2
-{
-
- namespace __detail
- {
- template<typename _Container, typename _Predicate>
- void
- __erase_nodes_if(_Container& __cont, _Predicate __pred)
- {
- for (auto __iter = __cont.begin(), __last = __cont.end();
- __iter != __last;)
- {
- if (__pred(*__iter))
- __iter = __cont.erase(__iter);
- else
- ++__iter;
- }
- }
- }
-
-
-} // inline namespace fundamentals_v2
-} // namespace experimental
-} // namespace std
-
-#endif // C++14
-
-#endif // _GLIBCXX_EXPERIMENTAL_ERASE_IF_H
# include <bits/c++0x_warning.h>
#else
-#include <experimental/fs_fwd.h>
-#include <experimental/fs_path.h>
-#include <experimental/fs_dir.h>
-#include <experimental/fs_ops.h>
+#include <experimental/bits/fs_fwd.h>
+#include <experimental/bits/fs_path.h>
+#include <experimental/bits/fs_dir.h>
+#include <experimental/bits/fs_ops.h>
#define __cpp_lib_experimental_filesystem 201406
+++ /dev/null
-// Filesystem directory utilities -*- C++ -*-
-
-// Copyright (C) 2014-2015 Free Software Foundation, Inc.
-//
-// This file is part of the GNU ISO C++ Library. This library is free
-// software; you can redistribute it and/or modify it under the
-// terms of the GNU General Public License as published by the
-// Free Software Foundation; either version 3, or (at your option)
-// any later version.
-
-// This library is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// GNU General Public License for more details.
-
-// Under Section 7 of GPL version 3, you are granted additional
-// permissions described in the GCC Runtime Library Exception, version
-// 3.1, as published by the Free Software Foundation.
-
-// You should have received a copy of the GNU General Public License and
-// a copy of the GCC Runtime Library Exception along with this program;
-// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
-// <http://www.gnu.org/licenses/>.
-
-/** @file experimental/fs_dir.h
- * This is an internal header file, included by other library headers.
- * Do not attempt to use it directly. @headername{experimental/filesystem}
- */
-
-#ifndef _GLIBCXX_EXPERIMENTAL_FS_DIR_H
-#define _GLIBCXX_EXPERIMENTAL_FS_DIR_H 1
-
-#if __cplusplus < 201103L
-# include <bits/c++0x_warning.h>
-#else
-# include <typeinfo>
-# include <ext/concurrence.h>
-# include <bits/unique_ptr.h>
-# include <bits/shared_ptr.h>
-
-namespace std _GLIBCXX_VISIBILITY(default)
-{
-namespace experimental
-{
-namespace filesystem
-{
-inline namespace v1
-{
-_GLIBCXX_BEGIN_NAMESPACE_VERSION
-
- /**
- * @ingroup filesystem
- * @{
- */
-
- class file_status
- {
- public:
- // constructors
- explicit
- file_status(file_type __ft = file_type::none,
- perms __prms = perms::unknown) noexcept
- : _M_type(__ft), _M_perms(__prms) { }
-
- file_status(const file_status&) noexcept = default;
- file_status(file_status&&) noexcept = default;
- ~file_status() = default;
-
- file_status& operator=(const file_status&) noexcept = default;
- file_status& operator=(file_status&&) noexcept = default;
-
- // observers
- file_type type() const noexcept { return _M_type; }
- perms permissions() const noexcept { return _M_perms; }
-
- // modifiers
- void type(file_type __ft) noexcept { _M_type = __ft; }
- void permissions(perms __prms) noexcept { _M_perms = __prms; }
-
- private:
- file_type _M_type;
- perms _M_perms;
- };
-
-_GLIBCXX_BEGIN_NAMESPACE_CXX11
-
- class directory_entry
- {
- public:
- // constructors and destructor
- directory_entry() noexcept = default;
- directory_entry(const directory_entry&) = default;
- directory_entry(directory_entry&&) noexcept = default;
- explicit directory_entry(const filesystem::path& __p) : _M_path(__p) { }
- ~directory_entry() = default;
-
- // modifiers
- directory_entry& operator=(const directory_entry&) = default;
- directory_entry& operator=(directory_entry&&) noexcept = default;
-
- void assign(const filesystem::path& __p) { _M_path = __p; }
-
- void
- replace_filename(const filesystem::path& __p)
- { _M_path = _M_path.parent_path() / __p; }
-
- // observers
- const filesystem::path& path() const noexcept { return _M_path; }
- operator const filesystem::path&() const noexcept { return _M_path; }
-
- file_status
- status() const
- { return filesystem::status(_M_path); }
-
- file_status
- status(error_code& __ec) const noexcept
- { return filesystem::status(_M_path, __ec); }
-
- file_status
- symlink_status() const
- { return filesystem::symlink_status(_M_path); }
-
- file_status
- symlink_status(error_code& __ec) const noexcept
- { return filesystem::symlink_status(_M_path, __ec); }
-
- bool
- operator< (const directory_entry& __rhs) const noexcept
- { return _M_path < __rhs._M_path; }
-
- bool
- operator==(const directory_entry& __rhs) const noexcept
- { return _M_path == __rhs._M_path; }
-
- bool
- operator!=(const directory_entry& __rhs) const noexcept
- { return _M_path != __rhs._M_path; }
-
- bool
- operator<=(const directory_entry& __rhs) const noexcept
- { return _M_path <= __rhs._M_path; }
-
- bool
- operator> (const directory_entry& __rhs) const noexcept
- { return _M_path > __rhs._M_path; }
-
- bool
- operator>=(const directory_entry& __rhs) const noexcept
- { return _M_path >= __rhs._M_path; }
-
- private:
- filesystem::path _M_path;
- };
-
- struct _Dir;
- class recursive_directory_iterator;
-
- class directory_iterator
- {
- public:
- typedef directory_entry value_type;
- typedef ptrdiff_t difference_type;
- typedef const directory_entry* pointer;
- typedef const directory_entry& reference;
- typedef input_iterator_tag iterator_category;
-
- directory_iterator() noexcept = default;
-
- explicit
- directory_iterator(const path& __p)
- : directory_iterator(__p, directory_options::none, nullptr) { }
-
- directory_iterator(const path& __p, directory_options __options)
- : directory_iterator(__p, __options, nullptr) { }
-
- directory_iterator(const path& __p, error_code& __ec) noexcept
- : directory_iterator(__p, directory_options::none, __ec) { }
-
- directory_iterator(const path& __p,
- directory_options __options, error_code& __ec) noexcept
- : directory_iterator(__p, __options, &__ec) { }
-
- directory_iterator(const directory_iterator& __rhs) = default;
-
- directory_iterator(directory_iterator&& __rhs) noexcept = default;
-
- ~directory_iterator() = default;
-
- directory_iterator& operator=(const directory_iterator& __rhs) = default;
- directory_iterator& operator=(directory_iterator&& __rhs) noexcept = default;
-
- const directory_entry& operator*() const;
- const directory_entry* operator->() const { return &**this; }
- directory_iterator& operator++();
- directory_iterator& increment(error_code& __ec) noexcept;
-
- directory_iterator operator++(int)
- {
- auto __tmp = *this;
- ++*this;
- return __tmp;
- }
-
- private:
- directory_iterator(const path&, directory_options, error_code*);
-
- friend bool
- operator==(const directory_iterator& __lhs,
- const directory_iterator& __rhs);
-
- friend class recursive_directory_iterator;
-
- std::shared_ptr<_Dir> _M_dir;
- };
-
- inline directory_iterator
- begin(directory_iterator __iter) { return __iter; }
-
- inline directory_iterator
- end(directory_iterator) { return directory_iterator(); }
-
- inline bool
- operator==(const directory_iterator& __lhs, const directory_iterator& __rhs)
- {
- return !__rhs._M_dir.owner_before(__lhs._M_dir)
- && !__lhs._M_dir.owner_before(__rhs._M_dir);
- }
-
- inline bool
- operator!=(const directory_iterator& __lhs, const directory_iterator& __rhs)
- { return !(__lhs == __rhs); }
-
- class recursive_directory_iterator
- {
- public:
- typedef directory_entry value_type;
- typedef ptrdiff_t difference_type;
- typedef const directory_entry* pointer;
- typedef const directory_entry& reference;
- typedef input_iterator_tag iterator_category;
-
- recursive_directory_iterator() noexcept = default;
-
- explicit
- recursive_directory_iterator(const path& __p)
- : recursive_directory_iterator(__p, directory_options::none, nullptr) { }
-
- recursive_directory_iterator(const path& __p, directory_options __options)
- : recursive_directory_iterator(__p, __options, nullptr) { }
-
- recursive_directory_iterator(const path& __p,
- directory_options __options,
- error_code& __ec) noexcept
- : recursive_directory_iterator(__p, __options, &__ec) { }
-
- recursive_directory_iterator(const path& __p, error_code& __ec) noexcept
- : recursive_directory_iterator(__p, directory_options::none, &__ec) { }
-
- recursive_directory_iterator(
- const recursive_directory_iterator&) = default;
-
- recursive_directory_iterator(
- recursive_directory_iterator&&) noexcept = default;
-
- ~recursive_directory_iterator();
-
- // observers
- directory_options options() const { return _M_options; }
- int depth() const;
- bool recursion_pending() const { return _M_pending; }
-
- const directory_entry& operator*() const;
- const directory_entry* operator->() const { return &**this; }
-
- // modifiers
- recursive_directory_iterator&
- operator=(const recursive_directory_iterator& __rhs) noexcept;
- recursive_directory_iterator&
- operator=(recursive_directory_iterator&& __rhs) noexcept;
-
- recursive_directory_iterator& operator++();
- recursive_directory_iterator& increment(error_code& __ec) noexcept;
-
- recursive_directory_iterator operator++(int)
- {
- auto __tmp = *this;
- ++*this;
- return __tmp;
- }
-
- void pop();
-
- void disable_recursion_pending() { _M_pending = false; }
-
- private:
- recursive_directory_iterator(const path&, directory_options, error_code*);
-
- friend bool
- operator==(const recursive_directory_iterator& __lhs,
- const recursive_directory_iterator& __rhs);
-
- struct _Dir_stack;
- std::shared_ptr<_Dir_stack> _M_dirs;
- directory_options _M_options;
- bool _M_pending;
- };
-
- inline recursive_directory_iterator
- begin(recursive_directory_iterator __iter) { return __iter; }
-
- inline recursive_directory_iterator
- end(recursive_directory_iterator) { return recursive_directory_iterator(); }
-
- inline bool
- operator==(const recursive_directory_iterator& __lhs,
- const recursive_directory_iterator& __rhs)
- {
- return !__rhs._M_dirs.owner_before(__lhs._M_dirs)
- && !__lhs._M_dirs.owner_before(__rhs._M_dirs);
- }
-
- inline bool
- operator!=(const recursive_directory_iterator& __lhs,
- const recursive_directory_iterator& __rhs)
- { return !(__lhs == __rhs); }
-
-_GLIBCXX_END_NAMESPACE_CXX11
-
- // @} group filesystem
-_GLIBCXX_END_NAMESPACE_VERSION
-} // namespace v1
-} // namespace filesystem
-} // namespace experimental
-} // namespace std
-
-#endif // C++11
-
-#endif // _GLIBCXX_EXPERIMENTAL_FS_DIR_H
+++ /dev/null
-// Filesystem declarations -*- C++ -*-
-
-// Copyright (C) 2014-2015 Free Software Foundation, Inc.
-//
-// This file is part of the GNU ISO C++ Library. This library is free
-// software; you can redistribute it and/or modify it under the
-// terms of the GNU General Public License as published by the
-// Free Software Foundation; either version 3, or (at your option)
-// any later version.
-
-// This library is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// GNU General Public License for more details.
-
-// Under Section 7 of GPL version 3, you are granted additional
-// permissions described in the GCC Runtime Library Exception, version
-// 3.1, as published by the Free Software Foundation.
-
-// You should have received a copy of the GNU General Public License and
-// a copy of the GCC Runtime Library Exception along with this program;
-// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
-// <http://www.gnu.org/licenses/>.
-
-/** @file experimental/filesystem
- * This is a TS C++ Library header.
- */
-
-#ifndef _GLIBCXX_EXPERIMENTAL_FS_FWD_H
-#define _GLIBCXX_EXPERIMENTAL_FS_FWD_H 1
-
-#if __cplusplus < 201103L
-# include <bits/c++0x_warning.h>
-#else
-
-#include <system_error>
-#include <cstdint>
-#include <chrono>
-
-namespace std _GLIBCXX_VISIBILITY(default)
-{
-namespace experimental
-{
-namespace filesystem
-{
-inline namespace v1
-{
-_GLIBCXX_BEGIN_NAMESPACE_VERSION
-
-#if _GLIBCXX_USE_CXX11_ABI
- inline namespace __cxx11 __attribute__((__abi_tag__ ("cxx11"))) { }
-#endif
-
- /**
- * @defgroup filesystem
- * @ingroup experimental
- *
- * Utilities for performing operations on file systems and their components,
- * such as paths, regular files, and directories.
- *
- * @{
- */
-
- class file_status;
-_GLIBCXX_BEGIN_NAMESPACE_CXX11
- class path;
- class filesystem_error;
- class directory_entry;
- class directory_iterator;
- class recursive_directory_iterator;
-_GLIBCXX_END_NAMESPACE_CXX11
-
- struct space_info
- {
- uintmax_t capacity;
- uintmax_t free;
- uintmax_t available;
- };
-
- enum class file_type : signed char {
- none = 0, not_found = -1, regular = 1, directory = 2, symlink = 3,
- block = 4, character = 5, fifo = 6, socket = 7, unknown = 8
- };
-
- /// Bitmask type
- enum class copy_options : unsigned short {
- none = 0,
- skip_existing = 1, overwrite_existing = 2, update_existing = 4,
- recursive = 8,
- copy_symlinks = 16, skip_symlinks = 32,
- directories_only = 64, create_symlinks = 128, create_hard_links = 256
- };
-
- constexpr copy_options
- operator&(copy_options __x, copy_options __y)
- {
- using __utype = typename std::underlying_type<copy_options>::type;
- return static_cast<copy_options>(
- static_cast<__utype>(__x) & static_cast<__utype>(__y));
- }
-
- constexpr copy_options
- operator|(copy_options __x, copy_options __y)
- {
- using __utype = typename std::underlying_type<copy_options>::type;
- return static_cast<copy_options>(
- static_cast<__utype>(__x) | static_cast<__utype>(__y));
- }
-
- constexpr copy_options
- operator^(copy_options __x, copy_options __y)
- {
- using __utype = typename std::underlying_type<copy_options>::type;
- return static_cast<copy_options>(
- static_cast<__utype>(__x) ^ static_cast<__utype>(__y));
- }
-
- constexpr copy_options
- operator~(copy_options __x)
- {
- using __utype = typename std::underlying_type<copy_options>::type;
- return static_cast<copy_options>(~static_cast<__utype>(__x));
- }
-
- inline copy_options&
- operator&=(copy_options& __x, copy_options __y)
- { return __x = __x & __y; }
-
- inline copy_options&
- operator|=(copy_options& __x, copy_options __y)
- { return __x = __x | __y; }
-
- inline copy_options&
- operator^=(copy_options& __x, copy_options __y)
- { return __x = __x ^ __y; }
-
-
- /// Bitmask type
- enum class perms : unsigned {
- none = 0,
- owner_read = 0400,
- owner_write = 0200,
- owner_exec = 0100,
- owner_all = 0700,
- group_read = 040,
- group_write = 020,
- group_exec = 010,
- group_all = 070,
- others_read = 04,
- others_write = 02,
- others_exec = 01,
- others_all = 07,
- all = 0777,
- set_uid = 04000,
- set_gid = 02000,
- sticky_bit = 01000,
- mask = 07777,
- unknown = 0xFFFF,
- add_perms = 0x10000,
- remove_perms = 0x20000,
- resolve_symlinks = 0x40000
- };
-
- constexpr perms
- operator&(perms __x, perms __y)
- {
- using __utype = typename std::underlying_type<perms>::type;
- return static_cast<perms>(
- static_cast<__utype>(__x) & static_cast<__utype>(__y));
- }
-
- constexpr perms
- operator|(perms __x, perms __y)
- {
- using __utype = typename std::underlying_type<perms>::type;
- return static_cast<perms>(
- static_cast<__utype>(__x) | static_cast<__utype>(__y));
- }
-
- constexpr perms
- operator^(perms __x, perms __y)
- {
- using __utype = typename std::underlying_type<perms>::type;
- return static_cast<perms>(
- static_cast<__utype>(__x) ^ static_cast<__utype>(__y));
- }
-
- constexpr perms
- operator~(perms __x)
- {
- using __utype = typename std::underlying_type<perms>::type;
- return static_cast<perms>(~static_cast<__utype>(__x));
- }
-
- inline perms&
- operator&=(perms& __x, perms __y)
- { return __x = __x & __y; }
-
- inline perms&
- operator|=(perms& __x, perms __y)
- { return __x = __x | __y; }
-
- inline perms&
- operator^=(perms& __x, perms __y)
- { return __x = __x ^ __y; }
-
- // Bitmask type
- enum class directory_options : unsigned char {
- none = 0, follow_directory_symlink = 1, skip_permission_denied = 2
- };
-
- constexpr directory_options
- operator&(directory_options __x, directory_options __y)
- {
- using __utype = typename std::underlying_type<directory_options>::type;
- return static_cast<directory_options>(
- static_cast<__utype>(__x) & static_cast<__utype>(__y));
- }
-
- constexpr directory_options
- operator|(directory_options __x, directory_options __y)
- {
- using __utype = typename std::underlying_type<directory_options>::type;
- return static_cast<directory_options>(
- static_cast<__utype>(__x) | static_cast<__utype>(__y));
- }
-
- constexpr directory_options
- operator^(directory_options __x, directory_options __y)
- {
- using __utype = typename std::underlying_type<directory_options>::type;
- return static_cast<directory_options>(
- static_cast<__utype>(__x) ^ static_cast<__utype>(__y));
- }
-
- constexpr directory_options
- operator~(directory_options __x)
- {
- using __utype = typename std::underlying_type<directory_options>::type;
- return static_cast<directory_options>(~static_cast<__utype>(__x));
- }
-
- inline directory_options&
- operator&=(directory_options& __x, directory_options __y)
- { return __x = __x & __y; }
-
- inline directory_options&
- operator|=(directory_options& __x, directory_options __y)
- { return __x = __x | __y; }
-
- inline directory_options&
- operator^=(directory_options& __x, directory_options __y)
- { return __x = __x ^ __y; }
-
- typedef chrono::time_point<chrono::system_clock> file_time_type;
-
- // operational functions
-
- void copy(const path& __from, const path& __to, copy_options __options);
- void copy(const path& __from, const path& __to, copy_options __options,
- error_code&) noexcept;
-
- bool copy_file(const path& __from, const path& __to, copy_options __option);
- bool copy_file(const path& __from, const path& __to, copy_options __option,
- error_code&) noexcept;
-
- path current_path();
-
- file_status status(const path&);
- file_status status(const path&, error_code&) noexcept;
-
- bool status_known(file_status) noexcept;
-
- file_status symlink_status(const path&);
- file_status symlink_status(const path&, error_code&) noexcept;
-
- bool is_regular_file(file_status) noexcept;
- bool is_symlink(file_status) noexcept;
-
- // @} group filesystem
-_GLIBCXX_END_NAMESPACE_VERSION
-} // namespace v1
-} // namespace filesystem
-} // namespace experimental
-} // namespace std
-
-#endif // C++11
-
-#endif // _GLIBCXX_EXPERIMENTAL_FS_FWD_H
+++ /dev/null
-// Filesystem operational functions -*- C++ -*-
-
-// Copyright (C) 2014-2015 Free Software Foundation, Inc.
-//
-// This file is part of the GNU ISO C++ Library. This library is free
-// software; you can redistribute it and/or modify it under the
-// terms of the GNU General Public License as published by the
-// Free Software Foundation; either version 3, or (at your __option)
-// any later version.
-
-// This library is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// GNU General Public License for more details.
-
-// Under Section 7 of GPL version 3, you are granted additional
-// permissions described in the GCC Runtime Library Exception, version
-// 3.1, as published by the Free Software Foundation.
-
-// You should have received a copy of the GNU General Public License and
-// a copy of the GCC Runtime Library Exception along with this program;
-// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
-// <http://www.gnu.org/licenses/>.
-
-/** @file experimental/filesystem
- * This is a TS C++ Library header.
- */
-
-#ifndef _GLIBCXX_EXPERIMENTAL_FS_OPS_H
-#define _GLIBCXX_EXPERIMENTAL_FS_OPS_H 1
-
-#if __cplusplus < 201103L
-# include <bits/c++0x_warning.h>
-#else
-
-#include <cstdint>
-
-namespace std _GLIBCXX_VISIBILITY(default)
-{
-namespace experimental
-{
-namespace filesystem
-{
-inline namespace v1
-{
-_GLIBCXX_BEGIN_NAMESPACE_VERSION
-
- /**
- * @ingroup filesystem
- * @{
- */
-
- path absolute(const path& __p, const path& __base = current_path());
-
- path canonical(const path& __p, const path& __base = current_path());
- path canonical(const path& __p, error_code& __ec);
- path canonical(const path& __p, const path& __base, error_code& __ec);
-
- inline void
- copy(const path& __from, const path& __to)
- { copy(__from, __to, copy_options::none); }
-
- inline void
- copy(const path& __from, const path& __to, error_code& __ec) noexcept
- { copy(__from, __to, copy_options::none, __ec); }
-
- void copy(const path& __from, const path& __to, copy_options __options);
- void copy(const path& __from, const path& __to, copy_options __options,
- error_code& __ec) noexcept;
-
- inline bool
- copy_file(const path& __from, const path& __to)
- { return copy_file(__from, __to, copy_options::none); }
-
- inline bool
- copy_file(const path& __from, const path& __to, error_code& __ec) noexcept
- { return copy_file(__from, __to, copy_options::none, __ec); }
-
- bool copy_file(const path& __from, const path& __to, copy_options __option);
- bool copy_file(const path& __from, const path& __to, copy_options __option,
- error_code& __ec) noexcept;
-
- void copy_symlink(const path& __existing_symlink, const path& __new_symlink);
- void copy_symlink(const path& __existing_symlink, const path& __new_symlink,
- error_code& __ec) noexcept;
-
- bool create_directories(const path& __p);
- bool create_directories(const path& __p, error_code& __ec) noexcept;
-
- bool create_directory(const path& __p);
- bool create_directory(const path& __p, error_code& __ec) noexcept;
-
- bool create_directory(const path& __p, const path& attributes);
- bool create_directory(const path& __p, const path& attributes,
- error_code& __ec) noexcept;
-
- void create_directory_symlink(const path& __to, const path& __new_symlink);
- void create_directory_symlink(const path& __to, const path& __new_symlink,
- error_code& __ec) noexcept;
-
- void create_hard_link(const path& __to, const path& __new_hard_link);
- void create_hard_link(const path& __to, const path& __new_hard_link,
- error_code& __ec) noexcept;
-
- void create_symlink(const path& __to, const path& __new_symlink);
- void create_symlink(const path& __to, const path& __new_symlink,
- error_code& __ec) noexcept;
-
- path current_path();
- path current_path(error_code& __ec);
- void current_path(const path& __p);
- void current_path(const path& __p, error_code& __ec) noexcept;
-
- inline bool
- exists(file_status __s) noexcept
- { return status_known(__s) && __s.type() != file_type::not_found; }
-
- inline bool
- exists(const path& __p)
- { return exists(status(__p)); }
-
- inline bool
- exists(const path& __p, error_code& __ec) noexcept
- { return exists(status(__p, __ec)); }
-
- bool
- equivalent(const path& __p1, const path& __p2);
-
- bool
- equivalent(const path& __p1, const path& __p2, error_code& __ec) noexcept;
-
- uintmax_t file_size(const path& __p);
- uintmax_t file_size(const path& __p, error_code& __ec) noexcept;
-
- uintmax_t hard_link_count(const path& __p);
- uintmax_t hard_link_count(const path& __p, error_code& __ec) noexcept;
-
- inline bool
- is_block_file(file_status __s) noexcept
- { return __s.type() == file_type::block; }
-
- inline bool
- is_block_file(const path& __p)
- { return is_block_file(status(__p)); }
-
- inline bool
- is_block_file(const path& __p, error_code& __ec) noexcept
- { return is_block_file(status(__p, __ec)); }
-
- inline bool
- is_character_file(file_status __s) noexcept
- { return __s.type() == file_type::character; }
-
- inline bool
- is_character_file(const path& __p)
- { return is_character_file(status(__p)); }
-
- inline bool
- is_character_file(const path& __p, error_code& __ec) noexcept
- { return is_character_file(status(__p, __ec)); }
-
- inline bool
- is_directory(file_status __s) noexcept
- { return __s.type() == file_type::directory; }
-
- inline bool
- is_directory(const path& __p)
- { return is_directory(status(__p)); }
-
- inline bool
- is_directory(const path& __p, error_code& __ec) noexcept
- { return is_directory(status(__p, __ec)); }
-
- bool is_empty(const path& __p);
- bool is_empty(const path& __p, error_code& __ec) noexcept;
-
- inline bool
- is_fifo(file_status __s) noexcept
- { return __s.type() == file_type::fifo; }
-
- inline bool
- is_fifo(const path& __p)
- { return is_fifo(status(__p)); }
-
- inline bool
- is_fifo(const path& __p, error_code& __ec) noexcept
- { return is_fifo(status(__p, __ec)); }
-
- inline bool
- is_other(file_status __s) noexcept
- {
- return exists(__s) && !is_regular_file(__s) && !is_directory(__s)
- && !is_symlink(__s);
- }
-
- inline bool
- is_other(const path& __p)
- { return is_other(status(__p)); }
-
- inline bool
- is_other(const path& __p, error_code& __ec) noexcept
- { return is_other(status(__p, __ec)); }
-
- inline bool
- is_regular_file(file_status __s) noexcept
- { return __s.type() == file_type::regular; }
-
- inline bool
- is_regular_file(const path& __p)
- { return is_regular_file(status(__p)); }
-
- inline bool
- is_regular_file(const path& __p, error_code& __ec) noexcept
- { return is_regular_file(status(__p, __ec)); }
-
- inline bool
- is_socket(file_status __s) noexcept
- { return __s.type() == file_type::socket; }
-
- inline bool
- is_socket(const path& __p)
- { return is_socket(status(__p)); }
-
- inline bool
- is_socket(const path& __p, error_code& __ec) noexcept
- { return is_socket(status(__p, __ec)); }
-
- inline bool
- is_symlink(file_status __s) noexcept
- { return __s.type() == file_type::symlink; }
-
- inline bool
- is_symlink(const path& __p)
- { return is_symlink(symlink_status(__p)); }
-
- inline bool
- is_symlink(const path& __p, error_code& __ec) noexcept
- { return is_symlink(symlink_status(__p, __ec)); }
-
- file_time_type last_write_time(const path& __p);
- file_time_type last_write_time(const path& __p, error_code& __ec) noexcept;
- void last_write_time(const path& __p, file_time_type __new_time);
- void last_write_time(const path& __p, file_time_type __new_time,
- error_code& __ec) noexcept;
-
- void permissions(const path& __p, perms __prms);
- void permissions(const path& __p, perms __prms, error_code& __ec) noexcept;
-
- path read_symlink(const path& __p);
- path read_symlink(const path& __p, error_code& __ec);
-
- bool remove(const path& __p);
- bool remove(const path& __p, error_code& __ec) noexcept;
-
- uintmax_t remove_all(const path& __p);
- uintmax_t remove_all(const path& __p, error_code& __ec) noexcept;
-
- void rename(const path& __from, const path& __to);
- void rename(const path& __from, const path& __to, error_code& __ec) noexcept;
-
- void resize_file(const path& __p, uintmax_t __size);
- void resize_file(const path& __p, uintmax_t __size, error_code& __ec) noexcept;
-
- space_info space(const path& __p);
- space_info space(const path& __p, error_code& __ec) noexcept;
-
- file_status status(const path& __p);
- file_status status(const path& __p, error_code& __ec) noexcept;
-
- inline bool status_known(file_status __s) noexcept
- { return __s.type() != file_type::none; }
-
- file_status symlink_status(const path& __p);
- file_status symlink_status(const path& __p, error_code& __ec) noexcept;
-
- path system_complete(const path& __p);
- path system_complete(const path& __p, error_code& __ec);
-
- path temp_directory_path();
- path temp_directory_path(error_code& __ec);
-
- // @} group filesystem
-_GLIBCXX_END_NAMESPACE_VERSION
-} // namespace v1
-} // namespace filesystem
-} // namespace experimental
-} // namespace std
-
-#endif // C++11
-
-#endif // _GLIBCXX_EXPERIMENTAL_FS_OPS_H
+++ /dev/null
-// Class filesystem::path -*- C++ -*-
-
-// Copyright (C) 2014-2015 Free Software Foundation, Inc.
-//
-// This file is part of the GNU ISO C++ Library. This library is free
-// software; you can redistribute it and/or modify it under the
-// terms of the GNU General Public License as published by the
-// Free Software Foundation; either version 3, or (at your option)
-// any later version.
-
-// This library is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// GNU General Public License for more details.
-
-// Under Section 7 of GPL version 3, you are granted additional
-// permissions described in the GCC Runtime Library Exception, version
-// 3.1, as published by the Free Software Foundation.
-
-// You should have received a copy of the GNU General Public License and
-// a copy of the GCC Runtime Library Exception along with this program;
-// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
-// <http://www.gnu.org/licenses/>.
-
-/** @file experimental/fs_path.h
- * This is an internal header file, included by other library headers.
- * Do not attempt to use it directly. @headername{experimental/filesystem}
- */
-
-#ifndef _GLIBCXX_EXPERIMENTAL_FS_PATH_H
-#define _GLIBCXX_EXPERIMENTAL_FS_PATH_H 1
-
-#if __cplusplus < 201103L
-# include <bits/c++0x_warning.h>
-#else
-
-#include <utility>
-#include <type_traits>
-#include <vector>
-#include <locale>
-#include <iosfwd>
-#include <codecvt>
-#include <system_error>
-#include <bits/stl_algobase.h>
-#include <bits/quoted_string.h>
-#include <bits/locale_conv.h>
-
-#if defined(_WIN32) && !defined(__CYGWIN__)
-# define _GLIBCXX_FILESYSTEM_IS_WINDOWS 1
-# include <algorithm>
-#endif
-
-namespace std _GLIBCXX_VISIBILITY(default)
-{
-namespace experimental
-{
-namespace filesystem
-{
-inline namespace v1
-{
-_GLIBCXX_BEGIN_NAMESPACE_VERSION
-_GLIBCXX_BEGIN_NAMESPACE_CXX11
-
- /**
- * @ingroup filesystem
- * @{
- */
-
- /// A filesystem path.
- class path
- {
- template<typename _CharT>
- struct __is_encoded_char : std::false_type { };
-
- template<typename _Iter,
- typename _Iter_traits = std::iterator_traits<_Iter>>
- using __is_path_iter_src
- = __and_<__is_encoded_char<typename _Iter_traits::value_type>,
- std::is_base_of<std::input_iterator_tag,
- typename _Iter_traits::iterator_category>>;
-
- template<typename _Iter>
- static __is_path_iter_src<_Iter>
- __is_path_src(_Iter, int);
-
- template<typename _CharT, typename _Traits, typename _Alloc>
- static __is_encoded_char<_CharT>
- __is_path_src(const basic_string<_CharT, _Traits, _Alloc>&, int);
-
- template<typename _Unknown>
- static std::false_type
- __is_path_src(const _Unknown&, ...);
-
- template<typename _Tp1, typename _Tp2>
- struct __constructible_from;
-
- template<typename _Iter>
- struct __constructible_from<_Iter, _Iter>
- : __is_path_iter_src<_Iter>
- { };
-
- template<typename _Source>
- struct __constructible_from<_Source, void>
- : decltype(__is_path_src(std::declval<_Source>(), 0))
- { };
-
- template<typename _Tp1, typename _Tp2 = void>
- using _Path = typename
- std::enable_if<__and_<__not_<is_same<_Tp1, path>>,
- __constructible_from<_Tp1, _Tp2>>::value,
- path>::type;
-
- template<typename _Source>
- static _Source
- _S_range_begin(_Source __begin) { return __begin; }
-
- struct __null_terminated { };
-
- template<typename _Source>
- static __null_terminated
- _S_range_end(_Source) { return {}; }
-
- template<typename _CharT, typename _Traits, typename _Alloc>
- static const _CharT*
- _S_range_begin(const basic_string<_CharT, _Traits, _Alloc>& __str)
- { return __str.data(); }
-
- template<typename _CharT, typename _Traits, typename _Alloc>
- static const _CharT*
- _S_range_end(const basic_string<_CharT, _Traits, _Alloc>& __str)
- { return __str.data() + __str.size(); }
-
- template<typename _Tp,
- typename _Iter = decltype(_S_range_begin(std::declval<_Tp>())),
- typename _Val = typename std::iterator_traits<_Iter>::value_type>
- using __value_type_is_char
- = typename std::enable_if<std::is_same<_Val, char>::value>::type;
-
- public:
-#ifdef _GLIBCXX_FILESYSTEM_IS_WINDOWS
- typedef wchar_t value_type;
- static constexpr value_type preferred_separator = L'\\';
-#else
- typedef char value_type;
- static constexpr value_type preferred_separator = '/';
-#endif
- typedef std::basic_string<value_type> string_type;
-
- // constructors and destructor
-
- path() noexcept { }
-
- path(const path& __p) = default;
-
- path(path&& __p) noexcept
- : _M_pathname(std::move(__p._M_pathname)), _M_type(__p._M_type)
- {
- _M_split_cmpts();
- __p.clear();
- }
-
- template<typename _Source,
- typename _Require = _Path<_Source>>
- path(_Source const& __source)
- : _M_pathname(_S_convert(_S_range_begin(__source),
- _S_range_end(__source)))
- { _M_split_cmpts(); }
-
- template<typename _InputIterator,
- typename _Require = _Path<_InputIterator, _InputIterator>>
- path(_InputIterator __first, _InputIterator __last)
- : _M_pathname(_S_convert(__first, __last))
- { _M_split_cmpts(); }
-
- template<typename _Source,
- typename _Require = _Path<_Source>,
- typename _Require2 = __value_type_is_char<_Source>>
- path(_Source const& __source, const locale& __loc)
- : _M_pathname(_S_convert_loc(_S_range_begin(__source),
- _S_range_end(__source), __loc))
- { _M_split_cmpts(); }
-
- template<typename _InputIterator,
- typename _Require = _Path<_InputIterator, _InputIterator>,
- typename _Require2 = __value_type_is_char<_InputIterator>>
- path(_InputIterator __first, _InputIterator __last, const locale& __loc)
- : _M_pathname(_S_convert_loc(__first, __last, __loc))
- { _M_split_cmpts(); }
-
- ~path() = default;
-
- // assignments
-
- path& operator=(const path& __p) = default;
- path& operator=(path&& __p) noexcept;
-
- template<typename _Source>
- _Path<_Source>&
- operator=(_Source const& __source)
- { return *this = path(__source); }
-
- template<typename _Source>
- _Path<_Source>&
- assign(_Source const& __source)
- { return *this = path(__source); }
-
- template<typename _InputIterator>
- _Path<_InputIterator, _InputIterator>&
- assign(_InputIterator __first, _InputIterator __last)
- { return *this = path(__first, __last); }
-
- // appends
-
- path& operator/=(const path& __p) { return _M_append(__p._M_pathname); }
-
- template <class _Source>
- _Path<_Source>&
- operator/=(_Source const& __source)
- { return append(__source); }
-
- template<typename _Source>
- _Path<_Source>&
- append(_Source const& __source)
- {
- return _M_append(_S_convert(_S_range_begin(__source),
- _S_range_end(__source)));
- }
-
- template<typename _InputIterator>
- _Path<_InputIterator, _InputIterator>&
- append(_InputIterator __first, _InputIterator __last)
- { return _M_append(_S_convert(__first, __last)); }
-
- // concatenation
-
- path& operator+=(const path& __x);
- path& operator+=(const string_type& __x);
- path& operator+=(const value_type* __x);
- path& operator+=(value_type __x);
-
- template<typename _Source>
- _Path<_Source>&
- operator+=(_Source const& __x) { return concat(__x); }
-
- template<typename _CharT>
- _Path<_CharT*, _CharT*>&
- operator+=(_CharT __x);
-
- template<typename _Source>
- _Path<_Source>&
- concat(_Source const& __x)
- { return *this += _S_convert(_S_range_begin(__x), _S_range_end(__x)); }
-
- template<typename _InputIterator>
- _Path<_InputIterator, _InputIterator>&
- concat(_InputIterator __first, _InputIterator __last)
- { return *this += _S_convert(__first, __last); }
-
- // modifiers
-
- void clear() noexcept { _M_pathname.clear(); _M_split_cmpts(); }
-
- path& make_preferred();
- path& remove_filename();
- path& replace_filename(const path& __replacement);
- path& replace_extension(const path& __replacement = path());
-
- void swap(path& __rhs) noexcept;
-
- // native format observers
-
- const string_type& native() const noexcept { return _M_pathname; }
- const value_type* c_str() const noexcept { return _M_pathname.c_str(); }
- operator string_type() const { return _M_pathname; }
-
- template<typename _CharT, typename _Traits = std::char_traits<_CharT>,
- typename _Allocator = std::allocator<_CharT>>
- std::basic_string<_CharT, _Traits, _Allocator>
- string(const _Allocator& __a = _Allocator()) const;
-
- std::string string() const;
-#if _GLIBCXX_USE_WCHAR_T
- std::wstring wstring() const;
-#endif
- std::string u8string() const;
- std::u16string u16string() const;
- std::u32string u32string() const;
-
- // generic format observers
- template<typename _CharT, typename _Traits = std::char_traits<_CharT>,
- typename _Allocator = std::allocator<_CharT>>
- std::basic_string<_CharT, _Traits, _Allocator>
- generic_string(const _Allocator& __a = _Allocator()) const;
-
- std::string generic_string() const;
-#if _GLIBCXX_USE_WCHAR_T
- std::wstring generic_wstring() const;
-#endif
- std::string generic_u8string() const;
- std::u16string generic_u16string() const;
- std::u32string generic_u32string() const;
-
- // compare
-
- int compare(const path& __p) const noexcept;
- int compare(const string_type& __s) const;
- int compare(const value_type* __s) const;
-
- // decomposition
-
- path root_name() const;
- path root_directory() const;
- path root_path() const;
- path relative_path() const;
- path parent_path() const;
- path filename() const;
- path stem() const;
- path extension() const;
-
- // query
-
- bool empty() const noexcept { return _M_pathname.empty(); }
- bool has_root_name() const;
- bool has_root_directory() const;
- bool has_root_path() const;
- bool has_relative_path() const;
- bool has_parent_path() const;
- bool has_filename() const;
- bool has_stem() const;
- bool has_extension() const;
- bool is_absolute() const;
- bool is_relative() const { return !is_absolute(); }
-
- // iterators
- class iterator;
- typedef iterator const_iterator;
-
- iterator begin() const;
- iterator end() const;
-
- private:
- enum class _Type : unsigned char {
- _Multi, _Root_name, _Root_dir, _Filename
- };
-
- path(string_type __str, _Type __type) : _M_pathname(__str), _M_type(__type)
- {
- __glibcxx_assert(!empty());
- __glibcxx_assert(_M_type != _Type::_Multi);
- }
-
- enum class _Split { _Stem, _Extension };
-
- path& _M_append(const string_type& __str)
- {
- if (!_M_pathname.empty() && !_S_is_dir_sep(_M_pathname.back())
- && !__str.empty() && !_S_is_dir_sep(__str.front()))
- _M_pathname += preferred_separator;
- _M_pathname += __str;
- _M_split_cmpts();
- return *this;
- }
-
- pair<const string_type*, size_t> _M_find_extension() const;
-
- template<typename _CharT>
- struct _Cvt;
-
- static string_type
- _S_convert(value_type* __src, __null_terminated)
- { return string_type(__src); }
-
- static string_type
- _S_convert(const value_type* __src, __null_terminated)
- { return string_type(__src); }
-
- template<typename _Iter>
- static string_type
- _S_convert(_Iter __first, _Iter __last)
- {
- using __value_type = typename std::iterator_traits<_Iter>::value_type;
- return _Cvt<__value_type>::_S_convert(__first, __last);
- }
-
- template<typename _InputIterator>
- static string_type
- _S_convert(_InputIterator __src, __null_terminated)
- {
- using _Tp = typename std::iterator_traits<_InputIterator>::value_type;
- std::basic_string<_Tp> __tmp;
- while (*__src != _Tp{})
- __tmp.push_back(*__src++);
- return _S_convert(__tmp.data(), __tmp.data() + __tmp.size());
- }
-
- static string_type
- _S_convert_loc(const char* __first, const char* __last,
- const std::locale& __loc);
-
- template<typename _Iter>
- static string_type
- _S_convert_loc(_Iter __first, _Iter __last, const std::locale& __loc)
- {
- const std::string __str(__first, __last);
- return _S_convert_loc(__str.data(), __str.data()+__str.size(), __loc);
- }
-
- template<typename _InputIterator>
- static string_type
- _S_convert_loc(_InputIterator __src, __null_terminated,
- const std::locale& __loc)
- {
- std::string __tmp;
- while (*__src != '\0')
- __tmp.push_back(*__src++);
- return _S_convert_loc(__tmp.data(), __tmp.data()+__tmp.size(), __loc);
- }
-
- bool _S_is_dir_sep(value_type __ch)
- {
-#ifdef _GLIBCXX_FILESYSTEM_IS_WINDOWS
- return __ch == L'/' || __ch == preferred_separator;
-#else
- return __ch == '/';
-#endif
- }
-
- void _M_split_cmpts();
- void _M_trim();
- void _M_add_root_name(size_t __n);
- void _M_add_root_dir(size_t __pos);
- void _M_add_filename(size_t __pos, size_t __n);
-
- string_type _M_pathname;
-
- struct _Cmpt;
- using _List = _GLIBCXX_STD_C::vector<_Cmpt>;
- _List _M_cmpts; // empty unless _M_type == _Type::_Multi
- _Type _M_type = _Type::_Multi;
- };
-
- inline void swap(path& __lhs, path& __rhs) noexcept { __lhs.swap(__rhs); }
-
- size_t hash_value(const path& __p) noexcept;
-
- /// Compare paths
- inline bool operator<(const path& __lhs, const path& __rhs) noexcept
- { return __lhs.compare(__rhs) < 0; }
-
- /// Compare paths
- inline bool operator<=(const path& __lhs, const path& __rhs) noexcept
- { return !(__rhs < __lhs); }
-
- /// Compare paths
- inline bool operator>(const path& __lhs, const path& __rhs) noexcept
- { return __rhs < __lhs; }
-
- /// Compare paths
- inline bool operator>=(const path& __lhs, const path& __rhs) noexcept
- { return !(__lhs < __rhs); }
-
- /// Compare paths
- inline bool operator==(const path& __lhs, const path& __rhs) noexcept
- { return __lhs.compare(__rhs) == 0; }
-
- /// Compare paths
- inline bool operator!=(const path& __lhs, const path& __rhs) noexcept
- { return !(__lhs == __rhs); }
-
- /// Append one path to another
- inline path operator/(const path& __lhs, const path& __rhs)
- { return path(__lhs) /= __rhs; }
-
- /// Write a path to a stream
- template<typename _CharT, typename _Traits>
- basic_ostream<_CharT, _Traits>&
- operator<<(basic_ostream<_CharT, _Traits>& __os, const path& __p)
- {
- auto __tmp = __p.string<_CharT, _Traits>();
- using __quoted_string
- = std::__detail::_Quoted_string<decltype(__tmp)&, _CharT>;
- __os << __quoted_string{__tmp, '"', '\\'};
- return __os;
- }
-
- /// Read a path from a stream
- template<typename _CharT, typename _Traits>
- basic_istream<_CharT, _Traits>&
- operator>>(basic_istream<_CharT, _Traits>& __is, path& __p)
- {
- basic_string<_CharT, _Traits> __tmp;
- using __quoted_string
- = std::__detail::_Quoted_string<decltype(__tmp)&, _CharT>;
- if (__is >> __quoted_string{ __tmp, '"', '\\' })
- __p = std::move(__tmp);
- return __is;
- }
-
- // TODO constrain with _Path<Source> and __value_type_is_char
- template<typename _Source>
- inline path
- u8path(const _Source& __source)
- {
-#ifdef _GLIBCXX_FILESYSTEM_IS_WINDOWS
- return path{ path::string_type{__source} };
-#else
- return path{ __source };
-#endif
- }
-
- // TODO constrain with _Path<InputIterator, InputIterator> and __value_type_is_char
- template<typename _InputIterator>
- inline path
- u8path(_InputIterator __first, _InputIterator __last)
- {
-#ifdef _GLIBCXX_FILESYSTEM_IS_WINDOWS
- return path{ path::string_type{__first, __last} };
-#else
- return path{ __first, __last };
-#endif
- }
-
- class filesystem_error : public std::system_error
- {
- public:
- filesystem_error(const string& __what_arg, error_code __ec)
- : system_error(__ec, __what_arg) { }
-
- filesystem_error(const string& __what_arg, const path& __p1,
- error_code __ec)
- : system_error(__ec, __what_arg), _M_path1(__p1) { }
-
- filesystem_error(const string& __what_arg, const path& __p1,
- const path& __p2, error_code __ec)
- : system_error(__ec, __what_arg), _M_path1(__p1), _M_path2(__p2)
- { }
-
- ~filesystem_error();
-
- const path& path1() const noexcept { return _M_path1; }
- const path& path2() const noexcept { return _M_path2; }
- const char* what() const noexcept { return _M_what.c_str(); }
-
- private:
- std::string _M_gen_what();
-
- path _M_path1;
- path _M_path2;
- std::string _M_what = _M_gen_what();
- };
-
- struct path::_Cmpt : path
- {
- _Cmpt(string_type __s, _Type __t, size_t __pos)
- : path(std::move(__s), __t), _M_pos(__pos) { }
-
- _Cmpt() : _M_pos(-1) { }
-
- size_t _M_pos;
- };
-
- template<>
- struct path::__is_encoded_char<char> : std::true_type
- { using value_type = char; };
-
- template<>
- struct path::__is_encoded_char<wchar_t> : std::true_type
- { using value_type = wchar_t; };
-
- template<>
- struct path::__is_encoded_char<char16_t> : std::true_type
- { using value_type = char16_t; };
-
- template<>
- struct path::__is_encoded_char<char32_t> : std::true_type
- { using value_type = char32_t; };
-
- // specialize _Cvt for degenerate 'noconv' case
- template<>
- struct path::_Cvt<path::value_type>
- {
- template<typename _Iter>
- static string_type
- _S_convert(_Iter __first, _Iter __last)
- { return string_type{__first, __last}; }
- };
-
- template<typename _CharT>
- struct path::_Cvt
- {
-#ifdef _GLIBCXX_FILESYSTEM_IS_WINDOWS
- static string_type
- _S_wconvert(const char* __f, const char* __l, true_type)
- {
- using _Cvt = std::codecvt<wchar_t, char, mbstate_t>;
- const auto& __cvt = std::use_facet<_Cvt>(std::locale{});
- std::wstring __wstr;
- if (__str_codecvt_in(__f, __l, __wstr, __cvt))
- return __wstr;
- _GLIBCXX_THROW_OR_ABORT(filesystem_error(
- "Cannot convert character sequence",
- std::make_error_code(errc::illegal_byte_sequence)));
- }
-
- static string_type
- _S_wconvert(const _CharT* __f, const _CharT* __l, false_type)
- {
- std::codecvt_utf8<_CharT> __cvt;
- std::string __str;
- if (__str_codecvt_out(__f, __l, __str, __cvt))
- {
- const char* __f2 = __str.data();
- const char* __l2 = __f2 + __str.size();
- std::codecvt_utf8<wchar_t> __wcvt;
- std::wstring __wstr;
- if (__str_codecvt_in(__f2, __l2, __wstr, __wcvt))
- return __wstr;
- }
- _GLIBCXX_THROW_OR_ABORT(filesystem_error(
- "Cannot convert character sequence",
- std::make_error_code(errc::illegal_byte_sequence)));
- }
-
- static string_type
- _S_convert(const _CharT* __f, const _CharT* __l)
- {
- return _S_wconvert(__f, __l, is_same<_CharT, char>{});
- }
-#else
- static string_type
- _S_convert(const _CharT* __f, const _CharT* __l)
- {
- std::codecvt_utf8<_CharT> __cvt;
- std::string __str;
- if (__str_codecvt_out(__f, __l, __str, __cvt))
- return __str;
- _GLIBCXX_THROW_OR_ABORT(filesystem_error(
- "Cannot convert character sequence",
- std::make_error_code(errc::illegal_byte_sequence)));
- }
-#endif
-
- static string_type
- _S_convert(_CharT* __f, _CharT* __l)
- {
- return _S_convert(const_cast<const _CharT*>(__f),
- const_cast<const _CharT*>(__l));
- }
-
- template<typename _Iter>
- static string_type
- _S_convert(_Iter __first, _Iter __last)
- {
- const std::basic_string<_CharT> __str(__first, __last);
- return _S_convert(__str.data(), __str.data() + __str.size());
- }
-
- template<typename _Iter, typename _Cont>
- static string_type
- _S_convert(__gnu_cxx::__normal_iterator<_Iter, _Cont> __first,
- __gnu_cxx::__normal_iterator<_Iter, _Cont> __last)
- { return _S_convert(__first.base(), __last.base()); }
- };
-
- /// An iterator for the components of a path
- class path::iterator
- {
- public:
- using difference_type = std::ptrdiff_t;
- using value_type = path;
- using reference = const path&;
- using pointer = const path*;
- using iterator_category = std::bidirectional_iterator_tag;
-
- iterator() : _M_path(nullptr), _M_cur(), _M_at_end() { }
-
- iterator(const iterator&) = default;
- iterator& operator=(const iterator&) = default;
-
- reference operator*() const;
- pointer operator->() const { return std::__addressof(**this); }
-
- iterator& operator++();
- iterator operator++(int) { auto __tmp = *this; ++_M_cur; return __tmp; }
-
- iterator& operator--();
- iterator operator--(int) { auto __tmp = *this; --_M_cur; return __tmp; }
-
- friend bool operator==(const iterator& __lhs, const iterator& __rhs)
- { return __lhs._M_equals(__rhs); }
-
- friend bool operator!=(const iterator& __lhs, const iterator& __rhs)
- { return !__lhs._M_equals(__rhs); }
-
- private:
- friend class path;
-
- iterator(const path* __path, path::_List::const_iterator __iter)
- : _M_path(__path), _M_cur(__iter), _M_at_end()
- { }
-
- iterator(const path* __path, bool __at_end)
- : _M_path(__path), _M_cur(), _M_at_end(__at_end)
- { }
-
- bool _M_equals(iterator) const;
-
- const path* _M_path;
- path::_List::const_iterator _M_cur;
- bool _M_at_end; // only used when type != _Multi
- };
-
-
- inline path&
- path::operator=(path&& __p) noexcept
- {
- _M_pathname = std::move(__p._M_pathname);
- _M_cmpts = std::move(__p._M_cmpts);
- _M_type = __p._M_type;
- __p.clear();
- return *this;
- }
-
- inline path&
- path::operator+=(const path& __p)
- {
- return operator+=(__p.native());
- }
-
- inline path&
- path::operator+=(const string_type& __x)
- {
- _M_pathname += __x;
- _M_split_cmpts();
- return *this;
- }
-
- inline path&
- path::operator+=(const value_type* __x)
- {
- _M_pathname += __x;
- _M_split_cmpts();
- return *this;
- }
-
- inline path&
- path::operator+=(value_type __x)
- {
- _M_pathname += __x;
- _M_split_cmpts();
- return *this;
- }
-
- template<typename _CharT>
- inline path::_Path<_CharT*, _CharT*>&
- path::operator+=(_CharT __x)
- {
- auto* __addr = std::__addressof(__x);
- return concat(__addr, __addr + 1);
- }
-
- inline path&
- path::make_preferred()
- {
-#ifdef _GLIBCXX_FILESYSTEM_IS_WINDOWS
- std::replace(_M_pathname.begin(), _M_pathname.end(), L'/',
- preferred_separator);
-#endif
- return *this;
- }
-
- inline void path::swap(path& __rhs) noexcept
- {
- _M_pathname.swap(__rhs._M_pathname);
- _M_cmpts.swap(__rhs._M_cmpts);
- std::swap(_M_type, __rhs._M_type);
- }
-
- template<typename _CharT, typename _Traits, typename _Allocator>
- inline std::basic_string<_CharT, _Traits, _Allocator>
- path::string(const _Allocator& __a) const
- {
- if (is_same<_CharT, value_type>::value)
- return { _M_pathname.begin(), _M_pathname.end(), __a };
-
- const value_type* __first = _M_pathname.data();
- const value_type* __last = __first + _M_pathname.size();
-
-#ifdef _GLIBCXX_FILESYSTEM_IS_WINDOWS
- using _CharAlloc = __alloc_rebind<_Allocator, char>;
- using _String = basic_string<char, char_traits<char>, _CharAlloc>;
- using _WString = basic_string<_CharT, _Traits, _Allocator>;
-
- // use codecvt_utf8<wchar_t> to convert native string to UTF-8
- codecvt_utf8<value_type> __cvt;
- _String __u8str{_CharAlloc{__a}};
- if (__str_codecvt_out(__first, __last, __u8str, __cvt))
- {
- struct
- {
- const _String*
- operator()(const _String& __from, _String&, true_type)
- { return std::__addressof(__from); }
-
- _WString*
- operator()(const _String& __from, _WString& __to, false_type)
- {
- // use codecvt_utf8<_CharT> to convert UTF-8 to wide string
- codecvt_utf8<_CharT> __cvt;
- const char* __f = __from.data();
- const char* __l = __f + __from.size();
- if (__str_codecvt_in(__f, __l, __to, __cvt))
- return std::__addressof(__to);
- return nullptr;
- }
- } __dispatch;
- _WString __wstr;
- if (auto* __p = __dispatch(__u8str, __wstr, is_same<_CharT, char>{}))
- return *__p;
- }
-#else
- codecvt_utf8<_CharT> __cvt;
- basic_string<_CharT, _Traits, _Allocator> __wstr{__a};
- if (__str_codecvt_in(__first, __last, __wstr, __cvt))
- return __wstr;
-#endif
- _GLIBCXX_THROW_OR_ABORT(filesystem_error(
- "Cannot convert character sequence",
- std::make_error_code(errc::illegal_byte_sequence)));
- }
-
- inline std::string
- path::string() const { return string<char>(); }
-
-#if _GLIBCXX_USE_WCHAR_T
- inline std::wstring
- path::wstring() const { return string<wchar_t>(); }
-#endif
-
- inline std::string
- path::u8string() const
- {
-#ifdef _GLIBCXX_FILESYSTEM_IS_WINDOWS
- std::string __str;
- // convert from native encoding to UTF-8
- codecvt_utf8<value_type> __cvt;
- const value_type* __first = _M_pathname.data();
- const value_type* __last = __first + _M_pathname.size();
- if (__str_codecvt_out(__first, __last, __str, __cvt))
- return __str;
- _GLIBCXX_THROW_OR_ABORT(filesystem_error(
- "Cannot convert character sequence",
- std::make_error_code(errc::illegal_byte_sequence)));
-#else
- return _M_pathname;
-#endif
- }
-
- inline std::u16string
- path::u16string() const { return string<char16_t>(); }
-
- inline std::u32string
- path::u32string() const { return string<char32_t>(); }
-
-#ifndef _GLIBCXX_FILESYSTEM_IS_WINDOWS
- template<typename _CharT, typename _Traits, typename _Allocator>
- inline std::basic_string<_CharT, _Traits, _Allocator>
- path::generic_string(const _Allocator& __a) const
- { return string<_CharT, _Traits, _Allocator>(__a); }
-
- inline std::string
- path::generic_string() const { return string(); }
-
-#if _GLIBCXX_USE_WCHAR_T
- inline std::wstring
- path::generic_wstring() const { return wstring(); }
-#endif
-
- inline std::string
- path::generic_u8string() const { return u8string(); }
-
- inline std::u16string
- path::generic_u16string() const { return u16string(); }
-
- inline std::u32string
- path::generic_u32string() const { return u32string(); }
-#endif
-
- inline int
- path::compare(const string_type& __s) const { return compare(path(__s)); }
-
- inline int
- path::compare(const value_type* __s) const { return compare(path(__s)); }
-
- inline path
- path::filename() const { return empty() ? path() : *--end(); }
-
- inline path
- path::stem() const
- {
- auto ext = _M_find_extension();
- if (ext.first && ext.second != 0)
- return path{ext.first->substr(0, ext.second)};
- return {};
- }
-
- inline path
- path::extension() const
- {
- auto ext = _M_find_extension();
- if (ext.first && ext.second != string_type::npos)
- return path{ext.first->substr(ext.second)};
- return {};
- }
-
- inline bool
- path::has_stem() const
- {
- auto ext = _M_find_extension();
- return ext.first && ext.second != 0;
- }
-
- inline bool
- path::has_extension() const
- {
- auto ext = _M_find_extension();
- return ext.first && ext.second != string_type::npos;
- }
-
- inline bool
- path::is_absolute() const
- {
-#ifdef _GLIBCXX_FILESYSTEM_IS_WINDOWS
- return has_root_name();
-#else
- return has_root_directory();
-#endif
- }
-
- inline path::iterator
- path::begin() const
- {
- if (_M_type == _Type::_Multi)
- return iterator(this, _M_cmpts.begin());
- return iterator(this, false);
- }
-
- inline path::iterator
- path::end() const
- {
- if (_M_type == _Type::_Multi)
- return iterator(this, _M_cmpts.end());
- return iterator(this, true);
- }
-
- inline path::iterator&
- path::iterator::operator++()
- {
- __glibcxx_assert(_M_path != nullptr);
- if (_M_path->_M_type == _Type::_Multi)
- {
- __glibcxx_assert(_M_cur != _M_path->_M_cmpts.end());
- ++_M_cur;
- }
- else
- {
- __glibcxx_assert(!_M_at_end);
- _M_at_end = true;
- }
- return *this;
- }
-
- inline path::iterator&
- path::iterator::operator--()
- {
- __glibcxx_assert(_M_path != nullptr);
- if (_M_path->_M_type == _Type::_Multi)
- {
- __glibcxx_assert(_M_cur != _M_path->_M_cmpts.begin());
- --_M_cur;
- }
- else
- {
- __glibcxx_assert(_M_at_end);
- _M_at_end = false;
- }
- return *this;
- }
-
- inline path::iterator::reference
- path::iterator::operator*() const
- {
- __glibcxx_assert(_M_path != nullptr);
- if (_M_path->_M_type == _Type::_Multi)
- {
- __glibcxx_assert(_M_cur != _M_path->_M_cmpts.end());
- return *_M_cur;
- }
- return *_M_path;
- }
-
- inline bool
- path::iterator::_M_equals(iterator __rhs) const
- {
- if (_M_path != __rhs._M_path)
- return false;
- if (_M_path == nullptr)
- return true;
- if (_M_path->_M_type == path::_Type::_Multi)
- return _M_cur == __rhs._M_cur;
- return _M_at_end == __rhs._M_at_end;
- }
-
- // @} group filesystem
-_GLIBCXX_END_NAMESPACE_CXX11
-_GLIBCXX_END_NAMESPACE_VERSION
-} // namespace v1
-} // namespace filesystem
-} // namespace experimental
-} // namespace std
-
-#endif // C++11
-
-#endif // _GLIBCXX_EXPERIMENTAL_FS_PATH_H
#else
#include <map>
-#include <experimental/erase_if.h>
+#include <experimental/bits/erase_if.h>
namespace std _GLIBCXX_VISIBILITY(default)
{
#else
#include <set>
-#include <experimental/erase_if.h>
+#include <experimental/bits/erase_if.h>
namespace std _GLIBCXX_VISIBILITY(default)
{
} // namespace experimental
} // namespace std
-#include <experimental/string_view.tcc>
+#include <experimental/bits/string_view.tcc>
#endif // __cplusplus <= 201103L
+++ /dev/null
-// Components for manipulating non-owning sequences of characters -*- C++ -*-
-
-// Copyright (C) 2013-2015 Free Software Foundation, Inc.
-//
-// This file is part of the GNU ISO C++ Library. This library is free
-// software; you can redistribute it and/or modify it under the
-// terms of the GNU General Public License as published by the
-// Free Software Foundation; either version 3, or (at your option)
-// any later version.
-
-// This library is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// GNU General Public License for more details.
-
-// Under Section 7 of GPL version 3, you are granted additional
-// permissions described in the GCC Runtime Library Exception, version
-// 3.1, as published by the Free Software Foundation.
-
-// You should have received a copy of the GNU General Public License and
-// a copy of the GCC Runtime Library Exception along with this program;
-// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
-// <http://www.gnu.org/licenses/>.
-
-/** @file experimental/string_view.tcc
- * This is an internal header file, included by other library headers.
- * Do not attempt to use it directly. @headername{string_view}
- */
-
-//
-// N3762 basic_string_view library
-//
-
-#ifndef _GLIBCXX_EXPERIMENTAL_STRING_VIEW_TCC
-#define _GLIBCXX_EXPERIMENTAL_STRING_VIEW_TCC 1
-
-#pragma GCC system_header
-
-#if __cplusplus <= 201103L
-# include <bits/c++14_warning.h>
-#else
-
-namespace std _GLIBCXX_VISIBILITY(default)
-{
-namespace experimental
-{
-_GLIBCXX_BEGIN_NAMESPACE_VERSION
-
- template<typename _CharT, typename _Traits>
- typename basic_string_view<_CharT, _Traits>::size_type
- basic_string_view<_CharT, _Traits>::
- find(const _CharT* __str, size_type __pos, size_type __n) const noexcept
- {
- __glibcxx_requires_string_len(__str, __n);
-
- if (__n == 0)
- return __pos <= this->_M_len ? __pos : npos;
-
- if (__n <= this->_M_len)
- {
- for (; __pos <= this->_M_len - __n; ++__pos)
- if (traits_type::eq(this->_M_str[__pos], __str[0])
- && traits_type::compare(this->_M_str + __pos + 1,
- __str + 1, __n - 1) == 0)
- return __pos;
- }
- return npos;
- }
-
- template<typename _CharT, typename _Traits>
- typename basic_string_view<_CharT, _Traits>::size_type
- basic_string_view<_CharT, _Traits>::
- find(_CharT __c, size_type __pos) const noexcept
- {
- size_type __ret = npos;
- if (__pos < this->_M_len)
- {
- const size_type __n = this->_M_len - __pos;
- const _CharT* __p = traits_type::find(this->_M_str + __pos, __n, __c);
- if (__p)
- __ret = __p - this->_M_str;
- }
- return __ret;
- }
-
- template<typename _CharT, typename _Traits>
- typename basic_string_view<_CharT, _Traits>::size_type
- basic_string_view<_CharT, _Traits>::
- rfind(const _CharT* __str, size_type __pos, size_type __n) const noexcept
- {
- __glibcxx_requires_string_len(__str, __n);
-
- if (__n <= this->_M_len)
- {
- __pos = std::min(size_type(this->_M_len - __n), __pos);
- do
- {
- if (traits_type::compare(this->_M_str + __pos, __str, __n) == 0)
- return __pos;
- }
- while (__pos-- > 0);
- }
- return npos;
- }
-
- template<typename _CharT, typename _Traits>
- typename basic_string_view<_CharT, _Traits>::size_type
- basic_string_view<_CharT, _Traits>::
- rfind(_CharT __c, size_type __pos) const noexcept
- {
- size_type __size = this->_M_len;
- if (__size > 0)
- {
- if (--__size > __pos)
- __size = __pos;
- for (++__size; __size-- > 0; )
- if (traits_type::eq(this->_M_str[__size], __c))
- return __size;
- }
- return npos;
- }
-
- template<typename _CharT, typename _Traits>
- typename basic_string_view<_CharT, _Traits>::size_type
- basic_string_view<_CharT, _Traits>::
- find_first_of(const _CharT* __str, size_type __pos, size_type __n) const
- {
- __glibcxx_requires_string_len(__str, __n);
- for (; __n && __pos < this->_M_len; ++__pos)
- {
- const _CharT* __p = traits_type::find(__str, __n,
- this->_M_str[__pos]);
- if (__p)
- return __pos;
- }
- return npos;
- }
-
- template<typename _CharT, typename _Traits>
- typename basic_string_view<_CharT, _Traits>::size_type
- basic_string_view<_CharT, _Traits>::
- find_last_of(const _CharT* __str, size_type __pos, size_type __n) const
- {
- __glibcxx_requires_string_len(__str, __n);
- size_type __size = this->size();
- if (__size && __n)
- {
- if (--__size > __pos)
- __size = __pos;
- do
- {
- if (traits_type::find(__str, __n, this->_M_str[__size]))
- return __size;
- }
- while (__size-- != 0);
- }
- return npos;
- }
-
- template<typename _CharT, typename _Traits>
- typename basic_string_view<_CharT, _Traits>::size_type
- basic_string_view<_CharT, _Traits>::
- find_first_not_of(const _CharT* __str, size_type __pos, size_type __n) const
- {
- __glibcxx_requires_string_len(__str, __n);
- for (; __pos < this->_M_len; ++__pos)
- if (!traits_type::find(__str, __n, this->_M_str[__pos]))
- return __pos;
- return npos;
- }
-
- template<typename _CharT, typename _Traits>
- typename basic_string_view<_CharT, _Traits>::size_type
- basic_string_view<_CharT, _Traits>::
- find_first_not_of(_CharT __c, size_type __pos) const noexcept
- {
- for (; __pos < this->_M_len; ++__pos)
- if (!traits_type::eq(this->_M_str[__pos], __c))
- return __pos;
- return npos;
- }
-
- template<typename _CharT, typename _Traits>
- typename basic_string_view<_CharT, _Traits>::size_type
- basic_string_view<_CharT, _Traits>::
- find_last_not_of(const _CharT* __str, size_type __pos, size_type __n) const
- {
- __glibcxx_requires_string_len(__str, __n);
- size_type __size = this->_M_len;
- if (__size)
- {
- if (--__size > __pos)
- __size = __pos;
- do
- {
- if (!traits_type::find(__str, __n, this->_M_str[__size]))
- return __size;
- }
- while (__size--);
- }
- return npos;
- }
-
- template<typename _CharT, typename _Traits>
- typename basic_string_view<_CharT, _Traits>::size_type
- basic_string_view<_CharT, _Traits>::
- find_last_not_of(_CharT __c, size_type __pos) const noexcept
- {
- size_type __size = this->_M_len;
- if (__size)
- {
- if (--__size > __pos)
- __size = __pos;
- do
- {
- if (!traits_type::eq(this->_M_str[__size], __c))
- return __size;
- }
- while (__size--);
- }
- return npos;
- }
-
-_GLIBCXX_END_NAMESPACE_VERSION
-} // namespace experimental
-} // namespace std
-
-#endif // __cplusplus <= 201103L
-
-#endif // _GLIBCXX_EXPERIMENTAL_STRING_VIEW_TCC
#else
#include <unordered_map>
-#include <experimental/erase_if.h>
+#include <experimental/bits/erase_if.h>
namespace std _GLIBCXX_VISIBILITY(default)
{
#else
#include <unordered_set>
-#include <experimental/erase_if.h>
+#include <experimental/bits/erase_if.h>
namespace std _GLIBCXX_VISIBILITY(default)
{