This commit is contained in:
2026-03-23 20:54:41 +08:00
commit e13b3650e9
4596 changed files with 1015768 additions and 0 deletions

View File

@@ -0,0 +1,153 @@
// boost/filesystem/v3/config.hpp ----------------------------------------------------//
// Copyright Beman Dawes 2003
// Copyright Andrey Semashev 2021-2023
// Distributed under the Boost Software License, Version 1.0.
// See http://www.boost.org/LICENSE_1_0.txt
// Library home page: http://www.boost.org/libs/filesystem
//--------------------------------------------------------------------------------------//
#ifndef BOOST_FILESYSTEM_CONFIG_HPP
#define BOOST_FILESYSTEM_CONFIG_HPP
// This header implements separate compilation features as described in
// http://www.boost.org/more/separate_compilation.html
#include <boost/config.hpp>
#include <boost/system/api_config.hpp> // for BOOST_POSIX_API or BOOST_WINDOWS_API
#include <boost/detail/workaround.hpp>
#if defined(BOOST_FILESYSTEM_VERSION) && BOOST_FILESYSTEM_VERSION != 3 && BOOST_FILESYSTEM_VERSION != 4
#error Compiling Boost.Filesystem file with BOOST_FILESYSTEM_VERSION defined != 3 or 4
#endif
#if defined(BOOST_FILESYSTEM_SOURCE)
#undef BOOST_FILESYSTEM_VERSION
#define BOOST_FILESYSTEM_VERSION 4
#elif !defined(BOOST_FILESYSTEM_VERSION)
#define BOOST_FILESYSTEM_VERSION 3
#endif
#define BOOST_FILESYSTEM_VERSIONED_SYM(sym) BOOST_JOIN(sym, BOOST_JOIN(_v, BOOST_FILESYSTEM_VERSION))
#define BOOST_FILESYSTEM_VERSION_NAMESPACE BOOST_JOIN(v, BOOST_FILESYSTEM_VERSION)
#if BOOST_FILESYSTEM_VERSION == 4
#undef BOOST_FILESYSTEM_DEPRECATED
#if !defined(BOOST_FILESYSTEM_NO_DEPRECATED)
#define BOOST_FILESYSTEM_NO_DEPRECATED
#endif
#endif
#define BOOST_FILESYSTEM_I18N // aid users wishing to compile several versions
// BOOST_FILESYSTEM_DEPRECATED needed for source compiles -----------------------------//
#ifdef BOOST_FILESYSTEM_SOURCE
#define BOOST_FILESYSTEM_DEPRECATED
#undef BOOST_FILESYSTEM_NO_DEPRECATED // fixes #9454, src bld fails if NO_DEP defined
#endif
#if defined(BOOST_FILESYSTEM_DEPRECATED) && defined(BOOST_FILESYSTEM_NO_DEPRECATED)
#error Both BOOST_FILESYSTEM_DEPRECATED and BOOST_FILESYSTEM_NO_DEPRECATED are defined
#endif
// throw an exception ----------------------------------------------------------------//
//
// Exceptions were originally thrown via boost::throw_exception().
// As throw_exception() became more complex, it caused user error reporting
// to be harder to interpret, since the exception reported became much more complex.
// The immediate fix was to throw directly, wrapped in a macro to make any later change
// easier.
#define BOOST_FILESYSTEM_THROW(EX) throw EX
#if defined(BOOST_NO_STD_WSTRING)
#error Configuration not supported: Boost.Filesystem V3 and later requires std::wstring support
#endif
// Deprecated symbols markup -----------------------------------------------------------//
#if !defined(BOOST_FILESYSTEM_ALLOW_DEPRECATED)
#define BOOST_FILESYSTEM_DETAIL_DEPRECATED(msg) BOOST_DEPRECATED(msg)
#else
#define BOOST_FILESYSTEM_DETAIL_DEPRECATED(msg)
#endif
// This header implements separate compilation features as described in
// http://www.boost.org/more/separate_compilation.html
// normalize macros ------------------------------------------------------------------//
#if !defined(BOOST_FILESYSTEM_DYN_LINK) && !defined(BOOST_FILESYSTEM_STATIC_LINK) && !defined(BOOST_ALL_DYN_LINK) && !defined(BOOST_ALL_STATIC_LINK)
#define BOOST_FILESYSTEM_STATIC_LINK
#endif
#if defined(BOOST_ALL_DYN_LINK) && !defined(BOOST_FILESYSTEM_DYN_LINK)
#define BOOST_FILESYSTEM_DYN_LINK
#elif defined(BOOST_ALL_STATIC_LINK) && !defined(BOOST_FILESYSTEM_STATIC_LINK)
#define BOOST_FILESYSTEM_STATIC_LINK
#endif
#if defined(BOOST_FILESYSTEM_DYN_LINK) && defined(BOOST_FILESYSTEM_STATIC_LINK)
#error Must not define both BOOST_FILESYSTEM_DYN_LINK and BOOST_FILESYSTEM_STATIC_LINK
#endif
#if defined(BOOST_ALL_NO_LIB) && !defined(BOOST_FILESYSTEM_NO_LIB)
#define BOOST_FILESYSTEM_NO_LIB
#endif
// enable dynamic linking ------------------------------------------------------------//
#if defined(BOOST_ALL_DYN_LINK) || defined(BOOST_FILESYSTEM_DYN_LINK)
#if defined(BOOST_FILESYSTEM_SOURCE)
#define BOOST_FILESYSTEM_DECL BOOST_SYMBOL_EXPORT
#else
#define BOOST_FILESYSTEM_DECL BOOST_SYMBOL_IMPORT
#endif
#else
#define BOOST_FILESYSTEM_DECL
#endif
// enable automatic library variant selection ----------------------------------------//
#if !defined(BOOST_FILESYSTEM_SOURCE) && !defined(BOOST_ALL_NO_LIB) && !defined(BOOST_FILESYSTEM_NO_LIB)
//
// Set the name of our library, this will get undef'ed by auto_link.hpp
// once it's done with it:
//
#define BOOST_LIB_NAME boost_filesystem
//
// If we're importing code from a dll, then tell auto_link.hpp about it:
//
#if defined(BOOST_ALL_DYN_LINK) || defined(BOOST_FILESYSTEM_DYN_LINK)
#define BOOST_DYN_LINK
#endif
//
// And include the header that does the work:
//
#include <boost/config/auto_link.hpp>
#endif // auto-linking disabled
#if defined(BOOST_NO_CXX11_RVALUE_REFERENCES) ||\
(defined(BOOST_LIBSTDCXX_VERSION) && (BOOST_LIBSTDCXX_VERSION < 50000)) ||\
(defined(BOOST_MSSTL_VERSION) && (BOOST_MSSTL_VERSION < 100))
// Indicates that the standard library fstream types do not support move constructor/assignment.
#define BOOST_FILESYSTEM_DETAIL_NO_CXX11_MOVABLE_FSTREAMS
#endif
#if !defined(BOOST_NO_CXX17_HDR_STRING_VIEW) && \
(\
(defined(BOOST_DINKUMWARE_STDLIB) && defined(_HAS_CXX23) && (_HAS_CXX23 != 0) && defined(_MSVC_STL_UPDATE) && (_MSVC_STL_UPDATE < 202208L)) || \
(defined(BOOST_LIBSTDCXX_VERSION) && (BOOST_LIBSTDCXX_VERSION < 110400 || (BOOST_LIBSTDCXX_VERSION >= 120000 && BOOST_LIBSTDCXX_VERSION < 120200)) && (BOOST_CXX_VERSION > 202002L))\
)
// Indicates that std::string_view has implicit constructor from ranges that was present in an early C++23 draft (N4892).
// This was later rectified by marking the constructor explicit (https://wg21.link/p2499). Unfortunately, some compilers
// were released with the constructor being implicit.
#define BOOST_FILESYSTEM_DETAIL_CXX23_STRING_VIEW_HAS_IMPLICIT_RANGE_CTOR
#endif
#endif // BOOST_FILESYSTEM_CONFIG_HPP

View File

@@ -0,0 +1,87 @@
// boost/filesystem/cstdio.hpp ------------------------------------------------------//
// Copyright Andrey Semashev 2023
// Distributed under the Boost Software License, Version 1.0.
// See http://www.boost.org/LICENSE_1_0.txt
// Library home page: http://www.boost.org/libs/filesystem
//--------------------------------------------------------------------------------------//
#ifndef BOOST_FILESYSTEM_CSTDIO_HPP
#define BOOST_FILESYSTEM_CSTDIO_HPP
#include <boost/filesystem/config.hpp>
#include <boost/filesystem/path.hpp>
#include <cstdio>
#if defined(BOOST_WINDOWS_API)
#include <wchar.h>
#include <cstddef>
#include <cstring>
#include <cstdlib>
#endif
#include <boost/filesystem/detail/header.hpp> // must be the last #include
namespace boost {
namespace filesystem {
#if defined(BOOST_WINDOWS_API)
inline std::FILE* fopen(filesystem::path const& p, const char* mode)
{
#if defined(__CYGWIN__) || (defined(__MINGW32__) && !defined(__MINGW64_VERSION_MAJOR) && defined(__STRICT_ANSI__))
// Cygwin and MinGW32 in strict ANSI mode do not declare _wfopen
return std::fopen(p.string().c_str(), mode);
#else
// mode should only contain ASCII characters and is likely short
struct small_array
{
wchar_t buf[128u];
wchar_t* p;
small_array() noexcept : p(buf) {}
~small_array() noexcept
{
if (BOOST_UNLIKELY(p != buf))
std::free(p);
}
}
wmode;
std::size_t wmode_len = std::mbstowcs(wmode.p, mode, sizeof(wmode.buf) / sizeof(wchar_t));
if (BOOST_UNLIKELY(wmode_len >= (sizeof(wmode.buf) / sizeof(wchar_t))))
{
wmode_len = std::mbstowcs(nullptr, mode, 0u);
// Check for size overflow, including (size_t)-1, which indicates mbstowcs error
if (BOOST_UNLIKELY(wmode_len >= (static_cast< std::size_t >(-1) / sizeof(wchar_t))))
return nullptr;
wmode.p = static_cast< wchar_t* >(std::malloc((wmode_len + 1u) * sizeof(wchar_t)));
if (BOOST_UNLIKELY(!wmode.p))
return nullptr;
std::size_t wmode_len2 = std::mbstowcs(wmode.p, mode, wmode_len + 1u);
if (BOOST_UNLIKELY(wmode_len2 > wmode_len))
return nullptr;
}
return ::_wfopen(p.c_str(), wmode.p);
#endif
}
#else // defined(BOOST_WINDOWS_API)
inline std::FILE* fopen(filesystem::path const& p, const char* mode)
{
return std::fopen(p.c_str(), mode);
}
#endif // defined(BOOST_WINDOWS_API)
} // namespace filesystem
} // namespace boost
#include <boost/filesystem/detail/footer.hpp>
#endif // BOOST_FILESYSTEM_CSTDIO_HPP

View File

@@ -0,0 +1,23 @@
/*
* Copyright Andrey Semashev 2021.
* Distributed under the Boost Software License, Version 1.0.
* (See accompanying file LICENSE_1_0.txt or copy at
* http://www.boost.org/LICENSE_1_0.txt)
*/
#if !defined(BOOST_FILESYSTEM_ENABLE_WARNINGS)
#if defined(_MSC_VER) && !defined(__clang__)
#pragma warning(pop)
#elif (defined(__GNUC__) && !(defined(__INTEL_COMPILER) || defined(__ICL) || defined(__ICC) || defined(__ECC)) \
&& (__GNUC__ * 100 + __GNUC_MINOR__) >= 406) || defined(__clang__)
#pragma GCC diagnostic pop
#endif
#endif // !defined(BOOST_FILESYSTEM_ENABLE_WARNINGS)
#include <boost/config/abi_suffix.hpp>

View File

@@ -0,0 +1,54 @@
/*
* Copyright Andrey Semashev 2021.
* Distributed under the Boost Software License, Version 1.0.
* (See accompanying file LICENSE_1_0.txt or copy at
* http://www.boost.org/LICENSE_1_0.txt)
*/
#include <boost/config/abi_prefix.hpp>
#if !defined(BOOST_FILESYSTEM_ENABLE_WARNINGS)
#if defined(_MSC_VER) && !defined(__clang__)
#pragma warning(push, 3)
// 'm_A' : class 'A' needs to have dll-interface to be used by clients of class 'B'
#pragma warning(disable: 4251)
// non dll-interface class 'A' used as base for dll-interface class 'B'
#pragma warning(disable: 4275)
// 'int' : forcing value to bool 'true' or 'false' (performance warning)
#pragma warning(disable: 4800)
// unreferenced formal parameter
#pragma warning(disable: 4100)
// conditional expression is constant
#pragma warning(disable: 4127)
// function marked as __forceinline not inlined
#pragma warning(disable: 4714)
// decorated name length exceeded, name was truncated
#pragma warning(disable: 4503)
// 'X': This function or variable may be unsafe. Consider using Y instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. See online help for details.
#pragma warning(disable: 4996)
// qualifier applied to function type has no meaning; ignored
#pragma warning(disable: 4180)
// qualifier applied to reference type; ignored
#pragma warning(disable: 4181)
#elif (defined(__GNUC__) && !(defined(__INTEL_COMPILER) || defined(__ICL) || defined(__ICC) || defined(__ECC)) \
&& (__GNUC__ * 100 + __GNUC_MINOR__) >= 406) || defined(__clang__)
// Note: clang-cl goes here as well, as it seems to support gcc-style warning control pragmas.
#pragma GCC diagnostic push
// unused parameter 'arg'
#pragma GCC diagnostic ignored "-Wunused-parameter"
// unused function 'foo'
#pragma GCC diagnostic ignored "-Wunused-function"
#if defined(__clang__)
// template argument uses unnamed type
#pragma clang diagnostic ignored "-Wunnamed-type-template-args"
#endif // defined(__clang__)
#endif
#endif // !defined(BOOST_FILESYSTEM_ENABLE_WARNINGS)

View File

@@ -0,0 +1,763 @@
// filesystem path_traits.hpp --------------------------------------------------------//
// Copyright Beman Dawes 2009
// Copyright Andrey Semashev 2022-2024
// Distributed under the Boost Software License, Version 1.0.
// See http://www.boost.org/LICENSE_1_0.txt
// Library home page: http://www.boost.org/libs/filesystem
#ifndef BOOST_FILESYSTEM_DETAIL_PATH_TRAITS_HPP
#define BOOST_FILESYSTEM_DETAIL_PATH_TRAITS_HPP
#include <boost/filesystem/config.hpp>
#include <cstddef>
#include <cstring> // for strlen
#include <cwchar> // for mbstate_t, wcslen
#include <locale>
#include <string>
#include <iterator>
#include <type_traits>
#if !defined(BOOST_NO_CXX17_HDR_STRING_VIEW)
#include <string_view>
#endif
#include <boost/assert.hpp>
#include <boost/system/error_category.hpp>
#include <boost/iterator/is_iterator.hpp>
#include <boost/filesystem/detail/type_traits/negation.hpp>
#include <boost/filesystem/detail/type_traits/conjunction.hpp>
#if defined(BOOST_FILESYSTEM_DETAIL_CXX23_STRING_VIEW_HAS_IMPLICIT_RANGE_CTOR)
#include <boost/filesystem/detail/type_traits/disjunction.hpp>
#endif
#if defined(BOOST_FILESYSTEM_DEPRECATED) && BOOST_FILESYSTEM_VERSION < 4
#include <vector>
#include <list>
#endif
#include <boost/filesystem/detail/header.hpp> // must be the last #include
namespace boost {
template< typename, typename > class basic_string_view;
namespace container {
template< typename, typename, typename > class basic_string;
} // namespace container
namespace filesystem {
BOOST_FILESYSTEM_DECL system::error_category const& codecvt_error_category() noexcept;
class path;
class directory_entry;
namespace detail {
namespace path_traits {
#if defined(BOOST_WINDOWS_API)
typedef wchar_t path_native_char_type;
#define BOOST_FILESYSTEM_DETAIL_IS_CHAR_NATIVE false
#define BOOST_FILESYSTEM_DETAIL_IS_WCHAR_T_NATIVE true
#else
typedef char path_native_char_type;
#define BOOST_FILESYSTEM_DETAIL_IS_CHAR_NATIVE true
#define BOOST_FILESYSTEM_DETAIL_IS_WCHAR_T_NATIVE false
#endif
typedef std::codecvt< wchar_t, char, std::mbstate_t > codecvt_type;
struct unknown_type_tag {};
struct ntcts_type_tag {};
struct char_ptr_tag : ntcts_type_tag {};
struct char_array_tag : ntcts_type_tag {};
struct string_class_tag {};
struct std_string_tag : string_class_tag {};
struct boost_container_string_tag : string_class_tag {};
struct std_string_view_tag : string_class_tag {};
struct boost_string_view_tag : string_class_tag {};
struct range_type_tag {};
struct directory_entry_tag {};
//! The traits define a number of properties of a path source
template< typename T >
struct path_source_traits
{
//! The kind of the path source. Useful for dispatching.
typedef unknown_type_tag tag_type;
//! Character type that the source contains
typedef void char_type;
//! Indicates whether the source is natively supported by \c path::string_type as arguments for constructors/assignment/appending
static BOOST_CONSTEXPR_OR_CONST bool is_native = false;
};
template< >
struct path_source_traits< char* >
{
typedef char_ptr_tag tag_type;
typedef char char_type;
static BOOST_CONSTEXPR_OR_CONST bool is_native = BOOST_FILESYSTEM_DETAIL_IS_CHAR_NATIVE;
};
template< >
struct path_source_traits< const char* >
{
typedef char_ptr_tag tag_type;
typedef char char_type;
static BOOST_CONSTEXPR_OR_CONST bool is_native = BOOST_FILESYSTEM_DETAIL_IS_CHAR_NATIVE;
};
template< >
struct path_source_traits< wchar_t* >
{
typedef char_ptr_tag tag_type;
typedef wchar_t char_type;
static BOOST_CONSTEXPR_OR_CONST bool is_native = BOOST_FILESYSTEM_DETAIL_IS_WCHAR_T_NATIVE;
};
template< >
struct path_source_traits< const wchar_t* >
{
typedef char_ptr_tag tag_type;
typedef wchar_t char_type;
static BOOST_CONSTEXPR_OR_CONST bool is_native = BOOST_FILESYSTEM_DETAIL_IS_WCHAR_T_NATIVE;
};
template< >
struct path_source_traits< char[] >
{
typedef char_array_tag tag_type;
typedef char char_type;
static BOOST_CONSTEXPR_OR_CONST bool is_native = BOOST_FILESYSTEM_DETAIL_IS_CHAR_NATIVE;
};
template< >
struct path_source_traits< const char[] >
{
typedef char_array_tag tag_type;
typedef char char_type;
static BOOST_CONSTEXPR_OR_CONST bool is_native = BOOST_FILESYSTEM_DETAIL_IS_CHAR_NATIVE;
};
template< >
struct path_source_traits< wchar_t[] >
{
typedef char_array_tag tag_type;
typedef wchar_t char_type;
static BOOST_CONSTEXPR_OR_CONST bool is_native = BOOST_FILESYSTEM_DETAIL_IS_WCHAR_T_NATIVE;
};
template< >
struct path_source_traits< const wchar_t[] >
{
typedef char_array_tag tag_type;
typedef wchar_t char_type;
static BOOST_CONSTEXPR_OR_CONST bool is_native = BOOST_FILESYSTEM_DETAIL_IS_WCHAR_T_NATIVE;
};
template< std::size_t N >
struct path_source_traits< char[N] >
{
typedef char_array_tag tag_type;
typedef char char_type;
static BOOST_CONSTEXPR_OR_CONST bool is_native = BOOST_FILESYSTEM_DETAIL_IS_CHAR_NATIVE;
};
template< std::size_t N >
struct path_source_traits< const char[N] >
{
typedef char_array_tag tag_type;
typedef char char_type;
static BOOST_CONSTEXPR_OR_CONST bool is_native = BOOST_FILESYSTEM_DETAIL_IS_CHAR_NATIVE;
};
template< std::size_t N >
struct path_source_traits< wchar_t[N] >
{
typedef char_array_tag tag_type;
typedef wchar_t char_type;
static BOOST_CONSTEXPR_OR_CONST bool is_native = BOOST_FILESYSTEM_DETAIL_IS_WCHAR_T_NATIVE;
};
template< std::size_t N >
struct path_source_traits< const wchar_t[N] >
{
typedef char_array_tag tag_type;
typedef wchar_t char_type;
static BOOST_CONSTEXPR_OR_CONST bool is_native = BOOST_FILESYSTEM_DETAIL_IS_WCHAR_T_NATIVE;
};
template< >
struct path_source_traits< std::string >
{
typedef std_string_tag tag_type;
typedef char char_type;
static BOOST_CONSTEXPR_OR_CONST bool is_native = BOOST_FILESYSTEM_DETAIL_IS_CHAR_NATIVE;
};
template< >
struct path_source_traits< std::wstring >
{
typedef std_string_tag tag_type;
typedef wchar_t char_type;
static BOOST_CONSTEXPR_OR_CONST bool is_native = BOOST_FILESYSTEM_DETAIL_IS_WCHAR_T_NATIVE;
};
template< >
struct path_source_traits< boost::container::basic_string< char, std::char_traits< char >, void > >
{
typedef boost_container_string_tag tag_type;
typedef char char_type;
static BOOST_CONSTEXPR_OR_CONST bool is_native = false;
};
template< >
struct path_source_traits< boost::container::basic_string< wchar_t, std::char_traits< wchar_t >, void > >
{
typedef boost_container_string_tag tag_type;
typedef wchar_t char_type;
static BOOST_CONSTEXPR_OR_CONST bool is_native = false;
};
#if !defined(BOOST_NO_CXX17_HDR_STRING_VIEW)
template< >
struct path_source_traits< std::string_view >
{
typedef std_string_view_tag tag_type;
typedef char char_type;
static BOOST_CONSTEXPR_OR_CONST bool is_native = BOOST_FILESYSTEM_DETAIL_IS_CHAR_NATIVE;
};
template< >
struct path_source_traits< std::wstring_view >
{
typedef std_string_view_tag tag_type;
typedef wchar_t char_type;
static BOOST_CONSTEXPR_OR_CONST bool is_native = BOOST_FILESYSTEM_DETAIL_IS_WCHAR_T_NATIVE;
};
#endif // !defined(BOOST_NO_CXX17_HDR_STRING_VIEW)
template< >
struct path_source_traits< boost::basic_string_view< char, std::char_traits< char > > >
{
typedef boost_string_view_tag tag_type;
typedef char char_type;
static BOOST_CONSTEXPR_OR_CONST bool is_native = false;
};
template< >
struct path_source_traits< boost::basic_string_view< wchar_t, std::char_traits< wchar_t > > >
{
typedef boost_string_view_tag tag_type;
typedef wchar_t char_type;
static BOOST_CONSTEXPR_OR_CONST bool is_native = false;
};
#if defined(BOOST_FILESYSTEM_DEPRECATED) && BOOST_FILESYSTEM_VERSION < 4
template< >
struct
BOOST_FILESYSTEM_DETAIL_DEPRECATED("Boost.Filesystem path construction/assignment/appending from containers is deprecated, use strings or iterators instead.")
path_source_traits< std::vector< char > >
{
// Since C++11 this could be string_class_tag as std::vector gained data() member
typedef range_type_tag tag_type;
typedef char char_type;
static BOOST_CONSTEXPR_OR_CONST bool is_native = false;
};
template< >
struct
BOOST_FILESYSTEM_DETAIL_DEPRECATED("Boost.Filesystem path construction/assignment/appending from containers is deprecated, use strings or iterators instead.")
path_source_traits< std::vector< wchar_t > >
{
// Since C++11 this could be string_class_tag as std::vector gained data() member
typedef range_type_tag tag_type;
typedef wchar_t char_type;
static BOOST_CONSTEXPR_OR_CONST bool is_native = false;
};
template< >
struct
BOOST_FILESYSTEM_DETAIL_DEPRECATED("Boost.Filesystem path construction/assignment/appending from containers is deprecated, use strings or iterators instead.")
path_source_traits< std::list< char > >
{
typedef range_type_tag tag_type;
typedef char char_type;
static BOOST_CONSTEXPR_OR_CONST bool is_native = false;
};
template< >
struct
BOOST_FILESYSTEM_DETAIL_DEPRECATED("Boost.Filesystem path construction/assignment/appending from containers is deprecated, use strings or iterators instead.")
path_source_traits< std::list< wchar_t > >
{
typedef range_type_tag tag_type;
typedef wchar_t char_type;
static BOOST_CONSTEXPR_OR_CONST bool is_native = false;
};
#endif // defined(BOOST_FILESYSTEM_DEPRECATED) && BOOST_FILESYSTEM_VERSION < 4
template< >
struct path_source_traits< directory_entry >
{
typedef directory_entry_tag tag_type;
typedef path_native_char_type char_type;
static BOOST_CONSTEXPR_OR_CONST bool is_native = false;
};
#undef BOOST_FILESYSTEM_DETAIL_IS_CHAR_NATIVE
#undef BOOST_FILESYSTEM_DETAIL_IS_WCHAR_T_NATIVE
//! The trait tests if the type is a known path Source tag
template< typename Tag >
struct is_known_path_source_tag :
public std::true_type
{
};
template< >
struct is_known_path_source_tag< unknown_type_tag > :
public std::false_type
{
};
//! The trait tests if the type is compatible with path Source requirements
template< typename T >
struct is_path_source :
public is_known_path_source_tag< typename path_source_traits< T >::tag_type >::type
{
};
//! The trait indicates whether the type is a path Source that is natively supported by path::string_type as the source for construction/assignment/appending
template< typename T >
struct is_native_path_source :
public std::integral_constant< bool, path_source_traits< T >::is_native >
{
};
//! The trait indicates whether the type is one of the supported path character types
template< typename T >
struct is_path_char_type :
public std::false_type
{
};
template< >
struct is_path_char_type< char > :
public std::true_type
{
};
template< >
struct is_path_char_type< wchar_t > :
public std::true_type
{
};
template< typename Iterator >
struct is_iterator_to_path_chars :
public is_path_char_type< typename std::iterator_traits< Iterator >::value_type >::type
{
};
//! The trait indicates whether the type is an iterator over a sequence of path characters
template< typename Iterator >
struct is_path_source_iterator :
public std::integral_constant<
bool,
detail::conjunction<
boost::iterators::is_iterator< Iterator >,
is_iterator_to_path_chars< Iterator >
>::value
>
{
};
//! The trait indicates whether the type is a pointer to a sequence of native path characters
template< typename T >
struct is_native_char_ptr :
public std::false_type
{
};
template< >
struct is_native_char_ptr< path_native_char_type* > :
public std::true_type
{
};
template< >
struct is_native_char_ptr< const path_native_char_type* > :
public std::true_type
{
};
//! Converts character encoding using the supplied codecvt facet. If \a cvt is \c nullptr then \c path::codecvt() will be used.
BOOST_FILESYSTEM_DECL
void convert(const char* from, const char* from_end, std::wstring& to, const codecvt_type* cvt = nullptr);
//! \overload convert
BOOST_FILESYSTEM_DECL
void convert(const wchar_t* from, const wchar_t* from_end, std::string& to, const codecvt_type* cvt = nullptr);
// Source dispatch -----------------------------------------------------------------//
template< typename Source, typename Callback >
typename Callback::result_type dispatch(Source const& source, Callback cb, const codecvt_type* cvt = nullptr);
template< typename Callback >
BOOST_FORCEINLINE typename Callback::result_type dispatch(const char* source, Callback cb, const codecvt_type* cvt, ntcts_type_tag)
{
return cb(source, source + std::strlen(source), cvt);
}
template< typename Callback >
BOOST_FORCEINLINE typename Callback::result_type dispatch(const wchar_t* source, Callback cb, const codecvt_type* cvt, ntcts_type_tag)
{
return cb(source, source + std::wcslen(source), cvt);
}
template< typename Source, typename Callback >
BOOST_FORCEINLINE typename Callback::result_type dispatch(Source const& source, Callback cb, const codecvt_type* cvt, string_class_tag)
{
return cb(source.data(), source.data() + source.size(), cvt);
}
template< typename Source, typename Callback >
BOOST_FORCEINLINE typename Callback::result_type dispatch(Source const& source, Callback cb, const codecvt_type* cvt, range_type_tag)
{
std::basic_string< typename Source::value_type > src(source.begin(), source.end());
return cb(src.data(), src.data() + src.size(), cvt);
}
#if defined(BOOST_FILESYSTEM_DEPRECATED) && BOOST_FILESYSTEM_VERSION < 4
template< typename Callback >
BOOST_FORCEINLINE typename Callback::result_type dispatch(std::vector< char > const& source, Callback cb, const codecvt_type* cvt, range_type_tag)
{
const char* data = nullptr, *data_end = nullptr;
if (!source.empty())
{
data = &source[0];
data_end = data + source.size();
}
return cb(data, data_end, cvt);
}
template< typename Callback >
BOOST_FORCEINLINE typename Callback::result_type dispatch(std::vector< wchar_t > const& source, Callback cb, const codecvt_type* cvt, range_type_tag)
{
const wchar_t* data = nullptr, *data_end = nullptr;
if (!source.empty())
{
data = &source[0];
data_end = data + source.size();
}
return cb(data, data_end, cvt);
}
#endif // defined(BOOST_FILESYSTEM_DEPRECATED) && BOOST_FILESYSTEM_VERSION < 4
// Defined in directory.hpp to avoid circular header dependencies
template< typename Callback >
typename Callback::result_type dispatch(directory_entry const& de, Callback cb, const codecvt_type* cvt, directory_entry_tag);
template< typename Source, typename Callback >
BOOST_FORCEINLINE typename Callback::result_type dispatch(Source const& source, Callback cb, const codecvt_type* cvt)
{
return path_traits::dispatch(source, cb, cvt,
typename path_traits::path_source_traits< typename std::remove_cv< Source >::type >::tag_type());
}
typedef char yes_type;
struct no_type { char buf[2]; };
#if !defined(BOOST_FILESYSTEM_DETAIL_CXX23_STRING_VIEW_HAS_IMPLICIT_RANGE_CTOR)
namespace is_convertible_to_path_source_impl {
yes_type check_convertible(const char*);
yes_type check_convertible(const wchar_t*);
yes_type check_convertible(std::string const&);
yes_type check_convertible(std::wstring const&);
yes_type check_convertible(boost::container::basic_string< char, std::char_traits< char >, void > const&);
yes_type check_convertible(boost::container::basic_string< wchar_t, std::char_traits< wchar_t >, void > const&);
#if !defined(BOOST_NO_CXX17_HDR_STRING_VIEW)
yes_type check_convertible(std::string_view const&);
yes_type check_convertible(std::wstring_view const&);
#endif
yes_type check_convertible(boost::basic_string_view< char, std::char_traits< char > > const&);
yes_type check_convertible(boost::basic_string_view< wchar_t, std::char_traits< wchar_t > > const&);
no_type check_convertible(std::nullptr_t);
no_type check_convertible(...);
} // namespace is_convertible_to_path_source_impl
template< typename T >
struct check_is_convertible_to_path_source :
public std::integral_constant<
bool,
sizeof(is_convertible_to_path_source_impl::check_convertible(std::declval< T const& >())) == sizeof(yes_type)
>
{
};
/*!
* \brief The type trait indicates whether the type has a conversion path to one of the path source types.
*
* \note The type trait returns `false` if the type is convertible to `path`. This prevents testing other
* conversion paths and forces the conversion to `path` to be chosen instead, to invoke a non-template
* member of `path` accepting a `path` argument.
*/
template< typename T >
struct is_convertible_to_path_source :
public std::integral_constant<
bool,
detail::conjunction<
detail::negation< std::is_convertible< T, path > >,
check_is_convertible_to_path_source< T >
>::value
>
{
};
#else // !defined(BOOST_FILESYSTEM_DETAIL_CXX23_STRING_VIEW_HAS_IMPLICIT_RANGE_CTOR)
// Note: We use separate checks for convertibility to std::string_view and other types to avoid ambiguity with an implicit range constructor
// of std::string_view in the early C++23 draft (N4892). If a user's type is convertible to e.g. std::string and also satisfies
// ranges::contiguous_range and ranges::sized_range concepts then the conversion is ambiguous: the type is convertible to std::string
// through the conversion operator in the user's class and is also convertible to std::string_view through the implicit conversion
// constructor in std::string_view. The solution is to check convertibility to std::string_view separately first.
namespace is_convertible_to_std_string_view_impl {
yes_type check_convertible(std::string_view const&);
yes_type check_convertible(std::wstring_view const&);
no_type check_convertible(std::nullptr_t);
no_type check_convertible(...);
} // namespace is_convertible_to_std_string_view_impl
template< typename T >
struct check_is_convertible_to_std_string_view :
public std::integral_constant<
bool,
sizeof(is_convertible_to_std_string_view_impl::check_convertible(std::declval< T const& >())) == sizeof(yes_type)
>
{
};
namespace is_convertible_to_path_source_non_std_string_view_impl {
yes_type check_convertible(const char*);
yes_type check_convertible(const wchar_t*);
yes_type check_convertible(std::string const&);
yes_type check_convertible(std::wstring const&);
yes_type check_convertible(boost::container::basic_string< char, std::char_traits< char >, void > const&);
yes_type check_convertible(boost::container::basic_string< wchar_t, std::char_traits< wchar_t >, void > const&);
yes_type check_convertible(boost::basic_string_view< char, std::char_traits< char > > const&);
yes_type check_convertible(boost::basic_string_view< wchar_t, std::char_traits< wchar_t > > const&);
no_type check_convertible(std::nullptr_t);
no_type check_convertible(...);
} // namespace is_convertible_to_path_source_non_std_string_view_impl
template< typename T >
struct check_is_convertible_to_path_source_non_std_string_view :
public std::integral_constant<
bool,
sizeof(is_convertible_to_path_source_non_std_string_view_impl::check_convertible(std::declval< T const& >())) == sizeof(yes_type)
>
{
};
/*!
* \brief The type trait indicates whether the type has a conversion path to one of the path source types.
*
* \note The type trait returns `false` if the type is convertible to `path`. This prevents testing other
* conversion paths and forces the conversion to `path` to be chosen instead, to invoke a non-template
* member of `path` accepting a `path` argument.
*/
template< typename T >
struct is_convertible_to_path_source :
public std::integral_constant<
bool,
detail::conjunction<
detail::negation< std::is_convertible< T, path > >,
detail::disjunction<
check_is_convertible_to_std_string_view< T >,
check_is_convertible_to_path_source_non_std_string_view< T >
>
>::value
>
{
};
#endif // !defined(BOOST_FILESYSTEM_DETAIL_CXX23_STRING_VIEW_HAS_IMPLICIT_RANGE_CTOR)
//! The type trait makes \a T dependent on the second template argument. Used to delay type resolution and name binding.
template< typename T, typename >
struct make_dependent
{
typedef T type;
};
template< typename Source, typename Callback >
BOOST_FORCEINLINE typename Callback::result_type dispatch_convertible_impl(const char* source, Callback cb, const codecvt_type* cvt)
{
typedef typename path_traits::make_dependent< const char*, Source >::type source_t;
return path_traits::dispatch(static_cast< source_t >(source), cb, cvt);
}
template< typename Source, typename Callback >
BOOST_FORCEINLINE typename Callback::result_type dispatch_convertible_impl(const wchar_t* source, Callback cb, const codecvt_type* cvt)
{
typedef typename path_traits::make_dependent< const wchar_t*, Source >::type source_t;
return path_traits::dispatch(static_cast< source_t >(source), cb, cvt);
}
template< typename Source, typename Callback >
BOOST_FORCEINLINE typename Callback::result_type dispatch_convertible_impl(std::string const& source, Callback cb, const codecvt_type* cvt)
{
typedef typename path_traits::make_dependent< std::string, Source >::type source_t;
return path_traits::dispatch(static_cast< source_t const& >(source), cb, cvt);
}
template< typename Source, typename Callback >
BOOST_FORCEINLINE typename Callback::result_type dispatch_convertible_impl(std::wstring const& source, Callback cb, const codecvt_type* cvt)
{
typedef typename path_traits::make_dependent< std::wstring, Source >::type source_t;
return path_traits::dispatch(static_cast< source_t const& >(source), cb, cvt);
}
template< typename Source, typename Callback >
BOOST_FORCEINLINE typename Callback::result_type dispatch_convertible_impl
(
boost::container::basic_string< char, std::char_traits< char >, void > const& source,
Callback cb,
const codecvt_type* cvt
)
{
typedef typename path_traits::make_dependent< boost::container::basic_string< char, std::char_traits< char >, void >, Source >::type source_t;
return path_traits::dispatch(static_cast< source_t const& >(source), cb, cvt);
}
template< typename Source, typename Callback >
BOOST_FORCEINLINE typename Callback::result_type dispatch_convertible_impl
(
boost::container::basic_string< wchar_t, std::char_traits< wchar_t >, void > const& source,
Callback cb,
const codecvt_type* cvt
)
{
typedef typename path_traits::make_dependent< boost::container::basic_string< wchar_t, std::char_traits< wchar_t >, void >, Source >::type source_t;
return path_traits::dispatch(static_cast< source_t const& >(source), cb, cvt);
}
template< typename Source, typename Callback >
BOOST_FORCEINLINE typename Callback::result_type dispatch_convertible_impl
(
boost::basic_string_view< char, std::char_traits< char > > const& source,
Callback cb,
const codecvt_type* cvt
)
{
typedef typename path_traits::make_dependent< boost::basic_string_view< char, std::char_traits< char > >, Source >::type source_t;
return path_traits::dispatch(static_cast< source_t const& >(source), cb, cvt);
}
template< typename Source, typename Callback >
BOOST_FORCEINLINE typename Callback::result_type dispatch_convertible_impl
(
boost::basic_string_view< wchar_t, std::char_traits< wchar_t > > const& source,
Callback cb,
const codecvt_type* cvt
)
{
typedef typename path_traits::make_dependent< boost::basic_string_view< wchar_t, std::char_traits< wchar_t > >, Source >::type source_t;
return path_traits::dispatch(static_cast< source_t const& >(source), cb, cvt);
}
#if !defined(BOOST_FILESYSTEM_DETAIL_CXX23_STRING_VIEW_HAS_IMPLICIT_RANGE_CTOR)
#if !defined(BOOST_NO_CXX17_HDR_STRING_VIEW)
template< typename Source, typename Callback >
BOOST_FORCEINLINE typename Callback::result_type dispatch_convertible_impl(std::string_view const& source, Callback cb, const codecvt_type* cvt)
{
typedef typename path_traits::make_dependent< std::string_view, Source >::type source_t;
return path_traits::dispatch(static_cast< source_t const& >(source), cb, cvt);
}
template< typename Source, typename Callback >
BOOST_FORCEINLINE typename Callback::result_type dispatch_convertible_impl(std::wstring_view const& source, Callback cb, const codecvt_type* cvt)
{
typedef typename path_traits::make_dependent< std::wstring_view, Source >::type source_t;
return path_traits::dispatch(static_cast< source_t const& >(source), cb, cvt);
}
#endif // !defined(BOOST_NO_CXX17_HDR_STRING_VIEW)
template< typename Source, typename Callback >
BOOST_FORCEINLINE typename Callback::result_type dispatch_convertible(Source const& source, Callback cb, const codecvt_type* cvt = nullptr)
{
typedef typename std::remove_cv< Source >::type source_t;
return path_traits::dispatch_convertible_impl< source_t >(source, cb, cvt);
}
#else // !defined(BOOST_FILESYSTEM_DETAIL_CXX23_STRING_VIEW_HAS_IMPLICIT_RANGE_CTOR)
template< typename Source, typename Callback >
BOOST_FORCEINLINE typename Callback::result_type dispatch_convertible_sv_impl(std::string_view const& source, Callback cb, const codecvt_type* cvt)
{
typedef typename path_traits::make_dependent< std::string_view, Source >::type source_t;
return path_traits::dispatch(static_cast< source_t const& >(source), cb, cvt);
}
template< typename Source, typename Callback >
BOOST_FORCEINLINE typename Callback::result_type dispatch_convertible_sv_impl(std::wstring_view const& source, Callback cb, const codecvt_type* cvt)
{
typedef typename path_traits::make_dependent< std::wstring_view, Source >::type source_t;
return path_traits::dispatch(static_cast< source_t const& >(source), cb, cvt);
}
template< typename Source, typename Callback >
BOOST_FORCEINLINE typename std::enable_if<
!check_is_convertible_to_std_string_view< typename std::remove_cv< Source >::type >::value,
typename Callback::result_type
>::type dispatch_convertible(Source const& source, Callback cb, const codecvt_type* cvt = nullptr)
{
typedef typename std::remove_cv< Source >::type source_t;
return path_traits::dispatch_convertible_impl< source_t >(source, cb, cvt);
}
template< typename Source, typename Callback >
BOOST_FORCEINLINE typename std::enable_if<
check_is_convertible_to_std_string_view< typename std::remove_cv< Source >::type >::value,
typename Callback::result_type
>::type dispatch_convertible(Source const& source, Callback cb, const codecvt_type* cvt = nullptr)
{
typedef typename std::remove_cv< Source >::type source_t;
return path_traits::dispatch_convertible_sv_impl< source_t >(source, cb, cvt);
}
#endif // !defined(BOOST_FILESYSTEM_DETAIL_CXX23_STRING_VIEW_HAS_IMPLICIT_RANGE_CTOR)
} // namespace path_traits
} // namespace detail
} // namespace filesystem
} // namespace boost
#include <boost/filesystem/detail/footer.hpp>
#endif // BOOST_FILESYSTEM_DETAIL_PATH_TRAITS_HPP

View File

@@ -0,0 +1,49 @@
/*
* Distributed under the Boost Software License, Version 1.0.
* (See accompanying file LICENSE_1_0.txt or copy at
* https://www.boost.org/LICENSE_1_0.txt)
*
* Copyright (c) 2024 Andrey Semashev
*/
/*!
* \file filesystem/detail/type_traits/conjunction.hpp
*
* This header contains definition of \c conjunction type trait.
*/
#ifndef BOOST_FILESYSTEM_DETAIL_TYPE_TRAITS_CONJUNCTION_HPP_INCLUDED_
#define BOOST_FILESYSTEM_DETAIL_TYPE_TRAITS_CONJUNCTION_HPP_INCLUDED_
#include <type_traits>
#include <boost/filesystem/config.hpp>
#if (defined(__cpp_lib_logical_traits) && (__cpp_lib_logical_traits >= 201510l)) || \
(defined(BOOST_MSSTL_VERSION) && (BOOST_MSSTL_VERSION >= 140) && (_MSC_FULL_VER >= 190023918) && (BOOST_CXX_VERSION >= 201703l))
namespace boost {
namespace filesystem {
namespace detail {
using std::conjunction;
} // namespace detail
} // namespace filesystem
} // namespace boost
#else
#include <boost/type_traits/conjunction.hpp>
namespace boost {
namespace filesystem {
namespace detail {
using boost::conjunction;
} // namespace detail
} // namespace filesystem
} // namespace boost
#endif
#endif // BOOST_FILESYSTEM_DETAIL_TYPE_TRAITS_CONJUNCTION_HPP_INCLUDED_

View File

@@ -0,0 +1,49 @@
/*
* Distributed under the Boost Software License, Version 1.0.
* (See accompanying file LICENSE_1_0.txt or copy at
* https://www.boost.org/LICENSE_1_0.txt)
*
* Copyright (c) 2024 Andrey Semashev
*/
/*!
* \file filesystem/detail/type_traits/disjunction.hpp
*
* This header contains definition of \c disjunction type trait.
*/
#ifndef BOOST_FILESYSTEM_DETAIL_TYPE_TRAITS_DISJUNCTION_HPP_INCLUDED_
#define BOOST_FILESYSTEM_DETAIL_TYPE_TRAITS_DISJUNCTION_HPP_INCLUDED_
#include <type_traits>
#include <boost/filesystem/config.hpp>
#if (defined(__cpp_lib_logical_traits) && (__cpp_lib_logical_traits >= 201510l)) || \
(defined(BOOST_MSSTL_VERSION) && (BOOST_MSSTL_VERSION >= 140) && (_MSC_FULL_VER >= 190023918) && (BOOST_CXX_VERSION >= 201703l))
namespace boost {
namespace filesystem {
namespace detail {
using std::disjunction;
} // namespace detail
} // namespace filesystem
} // namespace boost
#else
#include <boost/type_traits/disjunction.hpp>
namespace boost {
namespace filesystem {
namespace detail {
using boost::disjunction;
} // namespace detail
} // namespace filesystem
} // namespace boost
#endif
#endif // BOOST_FILESYSTEM_DETAIL_TYPE_TRAITS_DISJUNCTION_HPP_INCLUDED_

View File

@@ -0,0 +1,49 @@
/*
* Distributed under the Boost Software License, Version 1.0.
* (See accompanying file LICENSE_1_0.txt or copy at
* https://www.boost.org/LICENSE_1_0.txt)
*
* Copyright (c) 2024 Andrey Semashev
*/
/*!
* \file filesystem/detail/type_traits/negation.hpp
*
* This header contains definition of \c negation type trait.
*/
#ifndef BOOST_FILESYSTEM_DETAIL_TYPE_TRAITS_NEGATION_HPP_INCLUDED_
#define BOOST_FILESYSTEM_DETAIL_TYPE_TRAITS_NEGATION_HPP_INCLUDED_
#include <type_traits>
#include <boost/filesystem/config.hpp>
#if (defined(__cpp_lib_logical_traits) && (__cpp_lib_logical_traits >= 201510l)) || \
(defined(BOOST_MSSTL_VERSION) && (BOOST_MSSTL_VERSION >= 140) && (_MSC_FULL_VER >= 190023918) && (BOOST_CXX_VERSION >= 201703l))
namespace boost {
namespace filesystem {
namespace detail {
using std::negation;
} // namespace detail
} // namespace filesystem
} // namespace boost
#else
#include <boost/type_traits/negation.hpp>
namespace boost {
namespace filesystem {
namespace detail {
using boost::negation;
} // namespace detail
} // namespace filesystem
} // namespace boost
#endif
#endif // BOOST_FILESYSTEM_DETAIL_TYPE_TRAITS_NEGATION_HPP_INCLUDED_

View File

@@ -0,0 +1,33 @@
// Copyright (c) 2001 Ronald Garcia, Indiana University (garcia@osl.iu.edu)
// Andrew Lumsdaine, Indiana University (lums@osl.iu.edu).
// Distributed under the Boost Software License, Version 1.0.
// (See http://www.boost.org/LICENSE_1_0.txt)
#ifndef BOOST_FILESYSTEM_UTF8_CODECVT_FACET_HPP
#define BOOST_FILESYSTEM_UTF8_CODECVT_FACET_HPP
#include <boost/filesystem/config.hpp>
#include <boost/filesystem/detail/header.hpp>
#define BOOST_UTF8_BEGIN_NAMESPACE \
namespace boost { \
namespace filesystem { \
namespace detail {
#define BOOST_UTF8_END_NAMESPACE \
} \
} \
}
#define BOOST_UTF8_DECL BOOST_FILESYSTEM_DECL
#include <boost/detail/utf8_codecvt_facet.hpp>
#undef BOOST_UTF8_BEGIN_NAMESPACE
#undef BOOST_UTF8_END_NAMESPACE
#undef BOOST_UTF8_DECL
#include <boost/filesystem/detail/footer.hpp>
#endif // BOOST_FILESYSTEM_UTF8_CODECVT_FACET_HPP

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,92 @@
// boost/filesystem/exception.hpp -----------------------------------------------------//
// Copyright Beman Dawes 2003
// Copyright Andrey Semashev 2019
// Distributed under the Boost Software License, Version 1.0.
// See http://www.boost.org/LICENSE_1_0.txt
// Library home page: http://www.boost.org/libs/filesystem
#ifndef BOOST_FILESYSTEM_EXCEPTION_HPP
#define BOOST_FILESYSTEM_EXCEPTION_HPP
#include <boost/filesystem/config.hpp>
#include <boost/filesystem/path.hpp>
#include <string>
#include <boost/system/error_code.hpp>
#include <boost/system/system_error.hpp>
#include <boost/smart_ptr/intrusive_ptr.hpp>
#include <boost/smart_ptr/intrusive_ref_counter.hpp>
#include <boost/filesystem/detail/header.hpp> // must be the last #include
namespace boost {
namespace filesystem {
//--------------------------------------------------------------------------------------//
// //
// class filesystem_error //
// //
//--------------------------------------------------------------------------------------//
class BOOST_SYMBOL_VISIBLE filesystem_error :
public system::system_error
{
// see http://www.boost.org/more/error_handling.html for design rationale
public:
BOOST_FILESYSTEM_DECL filesystem_error(const char* what_arg, system::error_code ec);
BOOST_FILESYSTEM_DECL filesystem_error(std::string const& what_arg, system::error_code ec);
BOOST_FILESYSTEM_DECL filesystem_error(const char* what_arg, path const& path1_arg, system::error_code ec);
BOOST_FILESYSTEM_DECL filesystem_error(std::string const& what_arg, path const& path1_arg, system::error_code ec);
BOOST_FILESYSTEM_DECL filesystem_error(const char* what_arg, path const& path1_arg, path const& path2_arg, system::error_code ec);
BOOST_FILESYSTEM_DECL filesystem_error(std::string const& what_arg, path const& path1_arg, path const& path2_arg, system::error_code ec);
BOOST_FILESYSTEM_DECL filesystem_error(filesystem_error const& that);
BOOST_FILESYSTEM_DECL filesystem_error& operator=(filesystem_error const& that);
BOOST_FILESYSTEM_DECL ~filesystem_error() noexcept;
path const& path1() const noexcept
{
return m_imp_ptr.get() ? m_imp_ptr->m_path1 : get_empty_path();
}
path const& path2() const noexcept
{
return m_imp_ptr.get() ? m_imp_ptr->m_path2 : get_empty_path();
}
BOOST_FILESYSTEM_DECL const char* what() const noexcept override;
private:
BOOST_FILESYSTEM_DECL static path const& get_empty_path() noexcept;
private:
struct impl :
public boost::intrusive_ref_counter< impl >
{
path m_path1; // may be empty()
path m_path2; // may be empty()
std::string m_what; // not built until needed
impl() = default;
explicit impl(path const& path1) :
m_path1(path1)
{
}
impl(path const& path1, path const& path2) :
m_path1(path1), m_path2(path2)
{
}
};
boost::intrusive_ptr< impl > m_imp_ptr;
};
} // namespace filesystem
} // namespace boost
#include <boost/filesystem/detail/footer.hpp>
#endif // BOOST_FILESYSTEM_EXCEPTION_HPP

View File

@@ -0,0 +1,252 @@
// boost/filesystem/file_status.hpp --------------------------------------------------//
// Copyright Beman Dawes 2002-2009
// Copyright Jan Langer 2002
// Copyright Dietmar Kuehl 2001
// Copyright Vladimir Prus 2002
// Copyright Andrey Semashev 2019
// Distributed under the Boost Software License, Version 1.0.
// See http://www.boost.org/LICENSE_1_0.txt
// Library home page: http://www.boost.org/libs/filesystem
//--------------------------------------------------------------------------------------//
#ifndef BOOST_FILESYSTEM_FILE_STATUS_HPP
#define BOOST_FILESYSTEM_FILE_STATUS_HPP
#include <boost/filesystem/config.hpp>
#include <boost/detail/bitmask.hpp>
#include <boost/filesystem/detail/header.hpp> // must be the last #include
//--------------------------------------------------------------------------------------//
namespace boost {
namespace filesystem {
//--------------------------------------------------------------------------------------//
// file_type //
//--------------------------------------------------------------------------------------//
enum file_type
{
status_error,
file_not_found,
regular_file,
directory_file,
// the following may not apply to some operating systems or file systems
symlink_file,
block_file,
character_file,
fifo_file,
socket_file,
reparse_file, // Windows: FILE_ATTRIBUTE_REPARSE_POINT that is not a symlink
type_unknown // file does exist, but isn't one of the above types or
// we don't have strong enough permission to find its type
};
//--------------------------------------------------------------------------------------//
// perms //
//--------------------------------------------------------------------------------------//
enum perms
{
no_perms = 0, // file_not_found is no_perms rather than perms_not_known
// POSIX equivalent macros given in comments.
// Values are from POSIX and are given in octal per the POSIX standard.
// permission bits
owner_read = 0400, // S_IRUSR, Read permission, owner
owner_write = 0200, // S_IWUSR, Write permission, owner
owner_exe = 0100, // S_IXUSR, Execute/search permission, owner
owner_all = 0700, // S_IRWXU, Read, write, execute/search by owner
group_read = 040, // S_IRGRP, Read permission, group
group_write = 020, // S_IWGRP, Write permission, group
group_exe = 010, // S_IXGRP, Execute/search permission, group
group_all = 070, // S_IRWXG, Read, write, execute/search by group
others_read = 04, // S_IROTH, Read permission, others
others_write = 02, // S_IWOTH, Write permission, others
others_exe = 01, // S_IXOTH, Execute/search permission, others
others_all = 07, // S_IRWXO, Read, write, execute/search by others
all_all = 0777, // owner_all|group_all|others_all
// other POSIX bits
set_uid_on_exe = 04000, // S_ISUID, Set-user-ID on execution
set_gid_on_exe = 02000, // S_ISGID, Set-group-ID on execution
sticky_bit = 01000, // S_ISVTX,
// (POSIX XSI) On directories, restricted deletion flag
// (V7) 'sticky bit': save swapped text even after use
// (SunOS) On non-directories: don't cache this file
// (SVID-v4.2) On directories: restricted deletion flag
// Also see http://en.wikipedia.org/wiki/Sticky_bit
perms_mask = 07777, // all_all|set_uid_on_exe|set_gid_on_exe|sticky_bit
perms_not_known = 0xFFFF, // present when directory_entry cache not loaded
// options for permissions() function
add_perms = 0x1000, // adds the given permission bits to the current bits
remove_perms = 0x2000, // removes the given permission bits from the current bits;
// choose add_perms or remove_perms, not both; if neither add_perms
// nor remove_perms is given, replace the current bits with
// the given bits.
symlink_perms = 0x4000, // on POSIX, don't resolve symlinks; implied on Windows
// BOOST_BITMASK op~ casts to int32_least_t, producing invalid enum values
_detail_extend_perms_32_1 = 0x7fffffff,
_detail_extend_perms_32_2 = -0x7fffffff - 1
};
BOOST_BITMASK(perms)
//--------------------------------------------------------------------------------------//
// file_status //
//--------------------------------------------------------------------------------------//
class file_status
{
public:
BOOST_CONSTEXPR file_status() noexcept :
m_value(status_error),
m_perms(perms_not_known)
{
}
explicit BOOST_CONSTEXPR file_status(file_type v) noexcept :
m_value(v),
m_perms(perms_not_known)
{
}
BOOST_CONSTEXPR file_status(file_type v, perms prms) noexcept :
m_value(v),
m_perms(prms)
{
}
BOOST_CONSTEXPR file_status(file_status const& rhs) noexcept :
m_value(rhs.m_value),
m_perms(rhs.m_perms)
{
}
BOOST_CXX14_CONSTEXPR file_status& operator=(file_status const& rhs) noexcept
{
m_value = rhs.m_value;
m_perms = rhs.m_perms;
return *this;
}
// Note: std::move is not constexpr in C++11, that's why we're not using it here
BOOST_CONSTEXPR file_status(file_status&& rhs) noexcept :
m_value(static_cast< file_type&& >(rhs.m_value)),
m_perms(static_cast< perms&& >(rhs.m_perms))
{
}
BOOST_CXX14_CONSTEXPR file_status& operator=(file_status&& rhs) noexcept
{
m_value = static_cast< file_type&& >(rhs.m_value);
m_perms = static_cast< perms&& >(rhs.m_perms);
return *this;
}
// observers
BOOST_CONSTEXPR file_type type() const noexcept { return m_value; }
BOOST_CONSTEXPR perms permissions() const noexcept { return m_perms; }
// modifiers
BOOST_CXX14_CONSTEXPR void type(file_type v) noexcept { m_value = v; }
BOOST_CXX14_CONSTEXPR void permissions(perms prms) noexcept { m_perms = prms; }
BOOST_CONSTEXPR bool operator==(file_status const& rhs) const noexcept
{
return type() == rhs.type() && permissions() == rhs.permissions();
}
BOOST_CONSTEXPR bool operator!=(file_status const& rhs) const noexcept
{
return !(*this == rhs);
}
private:
file_type m_value;
perms m_perms;
};
inline BOOST_CONSTEXPR bool type_present(file_status f) noexcept
{
return f.type() != filesystem::status_error;
}
inline BOOST_CONSTEXPR bool permissions_present(file_status f) noexcept
{
return f.permissions() != filesystem::perms_not_known;
}
inline BOOST_CONSTEXPR bool status_known(file_status f) noexcept
{
return filesystem::type_present(f) && filesystem::permissions_present(f);
}
inline BOOST_CONSTEXPR bool exists(file_status f) noexcept
{
return f.type() != filesystem::status_error && f.type() != filesystem::file_not_found;
}
inline BOOST_CONSTEXPR bool is_regular_file(file_status f) noexcept
{
return f.type() == filesystem::regular_file;
}
inline BOOST_CONSTEXPR bool is_directory(file_status f) noexcept
{
return f.type() == filesystem::directory_file;
}
inline BOOST_CONSTEXPR bool is_symlink(file_status f) noexcept
{
return f.type() == filesystem::symlink_file;
}
inline BOOST_CONSTEXPR bool is_block_file(file_status f) noexcept
{
return f.type() == filesystem::block_file;
}
inline BOOST_CONSTEXPR bool is_character_file(file_status f) noexcept
{
return f.type() == filesystem::character_file;
}
inline BOOST_CONSTEXPR bool is_fifo(file_status f) noexcept
{
return f.type() == filesystem::fifo_file;
}
inline BOOST_CONSTEXPR bool is_socket(file_status f) noexcept
{
return f.type() == filesystem::socket_file;
}
inline BOOST_CONSTEXPR bool is_reparse_file(file_status f) noexcept
{
return f.type() == filesystem::reparse_file;
}
inline BOOST_CONSTEXPR bool is_other(file_status f) noexcept
{
return filesystem::exists(f) && !filesystem::is_regular_file(f) && !filesystem::is_directory(f) && !filesystem::is_symlink(f);
}
} // namespace filesystem
} // namespace boost
#include <boost/filesystem/detail/footer.hpp> // pops abi_prefix.hpp pragmas
#endif // BOOST_FILESYSTEM_FILE_STATUS_HPP

View File

@@ -0,0 +1,257 @@
// boost/filesystem/fstream.hpp ------------------------------------------------------//
// Copyright Beman Dawes 2002
// Copyright Andrey Semashev 2021-2023
// Distributed under the Boost Software License, Version 1.0.
// See http://www.boost.org/LICENSE_1_0.txt
// Library home page: http://www.boost.org/libs/filesystem
//--------------------------------------------------------------------------------------//
#ifndef BOOST_FILESYSTEM_FSTREAM_HPP
#define BOOST_FILESYSTEM_FSTREAM_HPP
#include <boost/filesystem/config.hpp>
#include <boost/filesystem/path.hpp>
#include <iosfwd>
#include <fstream>
#include <boost/filesystem/detail/header.hpp> // must be the last #include
#if defined(BOOST_WINDOWS_API)
// On Windows, except for standard libaries known to have wchar_t overloads for
// file stream I/O, use path::string() to get a narrow character c_str()
#if (defined(_CPPLIB_VER) && _CPPLIB_VER >= 405 && !defined(_STLPORT_VERSION)) || \
(defined(_LIBCPP_VERSION) && _LIBCPP_VERSION >= 7000 && defined(_LIBCPP_HAS_OPEN_WITH_WCHAR))
// Use wide characters directly
// Note: We don't use C++17 std::filesystem::path as a means to pass wide paths
// to file streams because of various problems:
// - std::filesystem is available in gcc 8 but it is broken there (fails to compile path definition
// on Windows). Compilation errors seem to be fixed since gcc 9.
// - In gcc 10.2 and clang 8.0.1 on Cygwin64, the path attempts to convert the wide string to narrow
// and fails in runtime. This may be system locale dependent, and performing character code conversion
// is against the purpose of using std::filesystem::path anyway.
// - Other std::filesystem implementations were not tested, so it is not known if they actually work
// with wide paths.
#define BOOST_FILESYSTEM_C_STR(p) p.c_str()
#else
// Use narrow characters, since wide not available
#define BOOST_FILESYSTEM_C_STR(p) p.string().c_str()
#endif
#endif // defined(BOOST_WINDOWS_API)
#if !defined(BOOST_FILESYSTEM_C_STR)
#define BOOST_FILESYSTEM_C_STR(p) p.c_str()
#endif
#if defined(BOOST_MSVC)
#pragma warning(push)
// 'boost::filesystem::basic_fstream<Char>' : inherits 'std::basic_istream<_Elem,_Traits>::std::basic_istream<_Elem,_Traits>::_Add_vtordisp1' via dominance
#pragma warning(disable : 4250)
#endif
namespace boost {
namespace filesystem {
//--------------------------------------------------------------------------------------//
// basic_filebuf //
//--------------------------------------------------------------------------------------//
template< class Char, class Traits = std::char_traits< Char > >
class basic_filebuf :
public std::basic_filebuf< Char, Traits >
{
private:
typedef std::basic_filebuf< Char, Traits > base_type;
public:
basic_filebuf() = default;
#if !defined(BOOST_FILESYSTEM_DETAIL_NO_CXX11_MOVABLE_FSTREAMS)
basic_filebuf(basic_filebuf&&) = default;
basic_filebuf& operator= (basic_filebuf&&) = default;
#endif // !defined(BOOST_FILESYSTEM_DETAIL_NO_CXX11_MOVABLE_FSTREAMS)
basic_filebuf(basic_filebuf const&) = delete;
basic_filebuf const& operator= (basic_filebuf const&) = delete;
public:
basic_filebuf* open(path const& p, std::ios_base::openmode mode)
{
return base_type::open(BOOST_FILESYSTEM_C_STR(p), mode) ? this : nullptr;
}
};
//--------------------------------------------------------------------------------------//
// basic_ifstream //
//--------------------------------------------------------------------------------------//
template< class Char, class Traits = std::char_traits< Char > >
class basic_ifstream :
public std::basic_ifstream< Char, Traits >
{
private:
typedef std::basic_ifstream< Char, Traits > base_type;
public:
basic_ifstream() = default;
// use two signatures, rather than one signature with default second
// argument, to workaround VC++ 7.1 bug (ID VSWhidbey 38416)
explicit basic_ifstream(path const& p) :
base_type(BOOST_FILESYSTEM_C_STR(p), std::ios_base::in) {}
basic_ifstream(path const& p, std::ios_base::openmode mode) :
base_type(BOOST_FILESYSTEM_C_STR(p), mode) {}
#if !defined(BOOST_FILESYSTEM_DETAIL_NO_CXX11_MOVABLE_FSTREAMS)
basic_ifstream(basic_ifstream&& that) :
base_type(static_cast< base_type&& >(that)) {}
basic_ifstream& operator= (basic_ifstream&& that)
{
*static_cast< base_type* >(this) = static_cast< base_type&& >(that);
return *this;
}
#endif
basic_ifstream(basic_ifstream const&) = delete;
basic_ifstream const& operator= (basic_ifstream const&) = delete;
public:
void open(path const& p)
{
base_type::open(BOOST_FILESYSTEM_C_STR(p), std::ios_base::in);
}
void open(path const& p, std::ios_base::openmode mode)
{
base_type::open(BOOST_FILESYSTEM_C_STR(p), mode);
}
};
//--------------------------------------------------------------------------------------//
// basic_ofstream //
//--------------------------------------------------------------------------------------//
template< class Char, class Traits = std::char_traits< Char > >
class basic_ofstream :
public std::basic_ofstream< Char, Traits >
{
private:
typedef std::basic_ofstream< Char, Traits > base_type;
public:
basic_ofstream() = default;
// use two signatures, rather than one signature with default second
// argument, to workaround VC++ 7.1 bug (ID VSWhidbey 38416)
explicit basic_ofstream(path const& p) :
base_type(BOOST_FILESYSTEM_C_STR(p), std::ios_base::out) {}
basic_ofstream(path const& p, std::ios_base::openmode mode) :
base_type(BOOST_FILESYSTEM_C_STR(p), mode) {}
#if !defined(BOOST_FILESYSTEM_DETAIL_NO_CXX11_MOVABLE_FSTREAMS)
basic_ofstream(basic_ofstream&& that) :
base_type(static_cast< base_type&& >(that)) {}
basic_ofstream& operator= (basic_ofstream&& that)
{
*static_cast< base_type* >(this) = static_cast< base_type&& >(that);
return *this;
}
#endif
basic_ofstream(basic_ofstream const&) = delete;
basic_ofstream const& operator= (basic_ofstream const&) = delete;
public:
void open(path const& p)
{
base_type::open(BOOST_FILESYSTEM_C_STR(p), std::ios_base::out);
}
void open(path const& p, std::ios_base::openmode mode)
{
base_type::open(BOOST_FILESYSTEM_C_STR(p), mode);
}
};
//--------------------------------------------------------------------------------------//
// basic_fstream //
//--------------------------------------------------------------------------------------//
template< class Char, class Traits = std::char_traits< Char > >
class basic_fstream :
public std::basic_fstream< Char, Traits >
{
private:
typedef std::basic_fstream< Char, Traits > base_type;
public:
basic_fstream() = default;
// use two signatures, rather than one signature with default second
// argument, to workaround VC++ 7.1 bug (ID VSWhidbey 38416)
explicit basic_fstream(path const& p) :
base_type(BOOST_FILESYSTEM_C_STR(p), std::ios_base::in | std::ios_base::out) {}
basic_fstream(path const& p, std::ios_base::openmode mode) :
base_type(BOOST_FILESYSTEM_C_STR(p), mode) {}
#if !defined(BOOST_FILESYSTEM_DETAIL_NO_CXX11_MOVABLE_FSTREAMS)
basic_fstream(basic_fstream&& that) :
base_type(static_cast< base_type&& >(that)) {}
basic_fstream& operator= (basic_fstream&& that)
{
*static_cast< base_type* >(this) = static_cast< base_type&& >(that);
return *this;
}
#endif
basic_fstream(basic_fstream const&) = delete;
basic_fstream const& operator= (basic_fstream const&) = delete;
public:
void open(path const& p)
{
base_type::open(BOOST_FILESYSTEM_C_STR(p), std::ios_base::in | std::ios_base::out);
}
void open(path const& p, std::ios_base::openmode mode)
{
base_type::open(BOOST_FILESYSTEM_C_STR(p), mode);
}
};
//--------------------------------------------------------------------------------------//
// typedefs //
//--------------------------------------------------------------------------------------//
typedef basic_filebuf< char > filebuf;
typedef basic_ifstream< char > ifstream;
typedef basic_ofstream< char > ofstream;
typedef basic_fstream< char > fstream;
typedef basic_filebuf< wchar_t > wfilebuf;
typedef basic_ifstream< wchar_t > wifstream;
typedef basic_ofstream< wchar_t > wofstream;
typedef basic_fstream< wchar_t > wfstream;
} // namespace filesystem
} // namespace boost
#if defined(BOOST_MSVC)
#pragma warning(pop)
#endif
#include <boost/filesystem/detail/footer.hpp>
#endif // BOOST_FILESYSTEM_FSTREAM_HPP

View File

@@ -0,0 +1,724 @@
// boost/filesystem/operations.hpp ---------------------------------------------------//
// Copyright Beman Dawes 2002-2009
// Copyright Jan Langer 2002
// Copyright Dietmar Kuehl 2001
// Copyright Vladimir Prus 2002
// Copyright Andrey Semashev 2020-2024
// Distributed under the Boost Software License, Version 1.0.
// See http://www.boost.org/LICENSE_1_0.txt
// Library home page: http://www.boost.org/libs/filesystem
//--------------------------------------------------------------------------------------//
#ifndef BOOST_FILESYSTEM_OPERATIONS_HPP
#define BOOST_FILESYSTEM_OPERATIONS_HPP
#include <boost/filesystem/config.hpp>
#include <boost/filesystem/path.hpp>
#include <boost/filesystem/file_status.hpp>
#include <boost/detail/bitmask.hpp>
#include <boost/system/error_code.hpp>
#include <boost/cstdint.hpp>
#include <ctime>
#include <string>
#include <boost/filesystem/detail/header.hpp> // must be the last #include
//--------------------------------------------------------------------------------------//
namespace boost {
namespace filesystem {
struct space_info
{
// all values are byte counts
boost::uintmax_t capacity;
boost::uintmax_t free; // <= capacity
boost::uintmax_t available; // <= free
};
enum class copy_options : unsigned int
{
none = 0u, // Default. For copy_file: error if the target file exists. For copy: do not recurse, follow symlinks, copy file contents.
// copy_file options:
skip_existing = 1u, // Don't overwrite the existing target file, don't report an error
overwrite_existing = 1u << 1u, // Overwrite existing file
update_existing = 1u << 2u, // Overwrite existing file if its last write time is older than the replacement file
synchronize_data = 1u << 3u, // Flush all buffered data written to the target file to permanent storage
synchronize = 1u << 4u, // Flush all buffered data and attributes written to the target file to permanent storage
ignore_attribute_errors = 1u << 5u, // Ignore errors of copying file attributes
// copy options:
recursive = 1u << 8u, // Recurse into sub-directories
copy_symlinks = 1u << 9u, // Copy symlinks as symlinks instead of copying the referenced file
skip_symlinks = 1u << 10u, // Don't copy symlinks
directories_only = 1u << 11u, // Only copy directory structure, do not copy non-directory files
create_symlinks = 1u << 12u, // Create symlinks instead of copying files
create_hard_links = 1u << 13u, // Create hard links instead of copying files
_detail_recursing = 1u << 14u // Internal use only, do not use
};
BOOST_BITMASK(copy_options)
//--------------------------------------------------------------------------------------//
// implementation details //
//--------------------------------------------------------------------------------------//
namespace detail {
BOOST_FILESYSTEM_DECL
path absolute_v3(path const& p, path const& base, system::error_code* ec = nullptr);
BOOST_FILESYSTEM_DECL
path absolute_v4(path const& p, path const& base, system::error_code* ec = nullptr);
BOOST_FILESYSTEM_DECL
file_status status(path const& p, system::error_code* ec = nullptr);
BOOST_FILESYSTEM_DECL
file_status symlink_status(path const& p, system::error_code* ec = nullptr);
BOOST_FILESYSTEM_DECL
bool is_empty(path const& p, system::error_code* ec = nullptr);
BOOST_FILESYSTEM_DECL
path initial_path(system::error_code* ec = nullptr);
BOOST_FILESYSTEM_DECL
path canonical_v3(path const& p, path const& base, system::error_code* ec = nullptr);
BOOST_FILESYSTEM_DECL
path canonical_v4(path const& p, path const& base, system::error_code* ec = nullptr);
BOOST_FILESYSTEM_DECL
void copy(path const& from, path const& to, copy_options options, system::error_code* ec = nullptr);
BOOST_FILESYSTEM_DECL
bool copy_file(path const& from, path const& to, copy_options options, system::error_code* ec = nullptr);
BOOST_FILESYSTEM_DECL
void copy_symlink(path const& existing_symlink, path const& new_symlink, system::error_code* ec = nullptr);
BOOST_FILESYSTEM_DECL
bool create_directories(path const& p, system::error_code* ec = nullptr);
BOOST_FILESYSTEM_DECL
bool create_directory(path const& p, const path* existing, system::error_code* ec = nullptr);
BOOST_FILESYSTEM_DECL
void create_directory_symlink(path const& to, path const& from, system::error_code* ec = nullptr);
BOOST_FILESYSTEM_DECL
void create_hard_link(path const& to, path const& from, system::error_code* ec = nullptr);
BOOST_FILESYSTEM_DECL
void create_symlink(path const& to, path const& from, system::error_code* ec = nullptr);
BOOST_FILESYSTEM_DECL
path current_path(system::error_code* ec = nullptr);
BOOST_FILESYSTEM_DECL
void current_path(path const& p, system::error_code* ec = nullptr);
BOOST_FILESYSTEM_DECL
bool equivalent_v3(path const& p1, path const& p2, system::error_code* ec = nullptr);
BOOST_FILESYSTEM_DECL
bool equivalent_v4(path const& p1, path const& p2, system::error_code* ec = nullptr);
BOOST_FILESYSTEM_DECL
boost::uintmax_t file_size(path const& p, system::error_code* ec = nullptr);
BOOST_FILESYSTEM_DECL
boost::uintmax_t hard_link_count(path const& p, system::error_code* ec = nullptr);
BOOST_FILESYSTEM_DECL
std::time_t creation_time(path const& p, system::error_code* ec = nullptr);
BOOST_FILESYSTEM_DECL
std::time_t last_write_time(path const& p, system::error_code* ec = nullptr);
BOOST_FILESYSTEM_DECL
void last_write_time(path const& p, const std::time_t new_time, system::error_code* ec = nullptr);
BOOST_FILESYSTEM_DECL
void permissions(path const& p, perms prms, system::error_code* ec = nullptr);
BOOST_FILESYSTEM_DECL
path read_symlink(path const& p, system::error_code* ec = nullptr);
BOOST_FILESYSTEM_DECL
path relative(path const& p, path const& base, system::error_code* ec = nullptr);
BOOST_FILESYSTEM_DECL
bool remove(path const& p, system::error_code* ec = nullptr);
BOOST_FILESYSTEM_DECL
boost::uintmax_t remove_all(path const& p, system::error_code* ec = nullptr);
BOOST_FILESYSTEM_DECL
void rename(path const& old_p, path const& new_p, system::error_code* ec = nullptr);
BOOST_FILESYSTEM_DECL
void resize_file(path const& p, uintmax_t size, system::error_code* ec = nullptr);
BOOST_FILESYSTEM_DECL
space_info space(path const& p, system::error_code* ec = nullptr);
BOOST_FILESYSTEM_DECL
path system_complete(path const& p, system::error_code* ec = nullptr);
BOOST_FILESYSTEM_DECL
path temp_directory_path(system::error_code* ec = nullptr);
BOOST_FILESYSTEM_DECL
path unique_path(path const& p, system::error_code* ec = nullptr);
BOOST_FILESYSTEM_DECL
path weakly_canonical_v3(path const& p, path const& base, system::error_code* ec = nullptr);
BOOST_FILESYSTEM_DECL
path weakly_canonical_v4(path const& p, path const& base, system::error_code* ec = nullptr);
} // namespace detail
//--------------------------------------------------------------------------------------//
// //
// status query functions //
// //
//--------------------------------------------------------------------------------------//
inline file_status status(path const& p)
{
return detail::status(p);
}
inline file_status status(path const& p, system::error_code& ec) noexcept
{
return detail::status(p, &ec);
}
inline file_status symlink_status(path const& p)
{
return detail::symlink_status(p);
}
inline file_status symlink_status(path const& p, system::error_code& ec) noexcept
{
return detail::symlink_status(p, &ec);
}
inline bool exists(path const& p)
{
return filesystem::exists(detail::status(p));
}
inline bool exists(path const& p, system::error_code& ec) noexcept
{
return filesystem::exists(detail::status(p, &ec));
}
inline bool is_regular_file(path const& p)
{
return filesystem::is_regular_file(detail::status(p));
}
inline bool is_regular_file(path const& p, system::error_code& ec) noexcept
{
return filesystem::is_regular_file(detail::status(p, &ec));
}
inline bool is_directory(path const& p)
{
return filesystem::is_directory(detail::status(p));
}
inline bool is_directory(path const& p, system::error_code& ec) noexcept
{
return filesystem::is_directory(detail::status(p, &ec));
}
inline bool is_symlink(path const& p)
{
return filesystem::is_symlink(detail::symlink_status(p));
}
inline bool is_symlink(path const& p, system::error_code& ec) noexcept
{
return filesystem::is_symlink(detail::symlink_status(p, &ec));
}
inline bool is_block_file(path const& p)
{
return filesystem::is_block_file(detail::status(p));
}
inline bool is_block_file(path const& p, system::error_code& ec) noexcept
{
return filesystem::is_block_file(detail::status(p, &ec));
}
inline bool is_character_file(path const& p)
{
return filesystem::is_character_file(detail::status(p));
}
inline bool is_character_file(path const& p, system::error_code& ec) noexcept
{
return filesystem::is_character_file(detail::status(p, &ec));
}
inline bool is_fifo(path const& p)
{
return filesystem::is_fifo(detail::status(p));
}
inline bool is_fifo(path const& p, system::error_code& ec) noexcept
{
return filesystem::is_fifo(detail::status(p, &ec));
}
inline bool is_socket(path const& p)
{
return filesystem::is_socket(detail::status(p));
}
inline bool is_socket(path const& p, system::error_code& ec) noexcept
{
return filesystem::is_socket(detail::status(p, &ec));
}
inline bool is_reparse_file(path const& p)
{
return filesystem::is_reparse_file(detail::symlink_status(p));
}
inline bool is_reparse_file(path const& p, system::error_code& ec) noexcept
{
return filesystem::is_reparse_file(detail::symlink_status(p, &ec));
}
inline bool is_other(path const& p)
{
return filesystem::is_other(detail::status(p));
}
inline bool is_other(path const& p, system::error_code& ec) noexcept
{
return filesystem::is_other(detail::status(p, &ec));
}
inline bool is_empty(path const& p)
{
return detail::is_empty(p);
}
inline bool is_empty(path const& p, system::error_code& ec)
{
return detail::is_empty(p, &ec);
}
//--------------------------------------------------------------------------------------//
// //
// operational functions //
// //
//--------------------------------------------------------------------------------------//
inline path initial_path()
{
return detail::initial_path();
}
inline path initial_path(system::error_code& ec)
{
return detail::initial_path(&ec);
}
template< class Path >
path initial_path()
{
return initial_path();
}
template< class Path >
path initial_path(system::error_code& ec)
{
return detail::initial_path(&ec);
}
inline path current_path()
{
return detail::current_path();
}
inline path current_path(system::error_code& ec)
{
return detail::current_path(&ec);
}
inline void current_path(path const& p)
{
detail::current_path(p);
}
inline void current_path(path const& p, system::error_code& ec) noexcept
{
detail::current_path(p, &ec);
}
inline void copy(path const& from, path const& to)
{
detail::copy(from, to, copy_options::none);
}
inline void copy(path const& from, path const& to, system::error_code& ec) noexcept
{
detail::copy(from, to, copy_options::none, &ec);
}
inline void copy(path const& from, path const& to, copy_options options)
{
detail::copy(from, to, options);
}
inline void copy(path const& from, path const& to, copy_options options, system::error_code& ec) noexcept
{
detail::copy(from, to, options, &ec);
}
inline bool copy_file(path const& from, path const& to)
{
return detail::copy_file(from, to, copy_options::none);
}
inline bool copy_file(path const& from, path const& to, system::error_code& ec) noexcept
{
return detail::copy_file(from, to, copy_options::none, &ec);
}
inline bool copy_file(path const& from, path const& to, copy_options options)
{
return detail::copy_file(from, to, options);
}
inline bool copy_file(path const& from, path const& to, copy_options options, system::error_code& ec) noexcept
{
return detail::copy_file(from, to, options, &ec);
}
inline void copy_symlink(path const& existing_symlink, path const& new_symlink)
{
detail::copy_symlink(existing_symlink, new_symlink);
}
inline void copy_symlink(path const& existing_symlink, path const& new_symlink, system::error_code& ec) noexcept
{
detail::copy_symlink(existing_symlink, new_symlink, &ec);
}
inline bool create_directories(path const& p)
{
return detail::create_directories(p);
}
inline bool create_directories(path const& p, system::error_code& ec) noexcept
{
return detail::create_directories(p, &ec);
}
inline bool create_directory(path const& p)
{
return detail::create_directory(p, nullptr);
}
inline bool create_directory(path const& p, system::error_code& ec) noexcept
{
return detail::create_directory(p, nullptr, &ec);
}
inline bool create_directory(path const& p, path const& existing)
{
return detail::create_directory(p, &existing);
}
inline bool create_directory(path const& p, path const& existing, system::error_code& ec) noexcept
{
return detail::create_directory(p, &existing, &ec);
}
inline void create_directory_symlink(path const& to, path const& from)
{
detail::create_directory_symlink(to, from);
}
inline void create_directory_symlink(path const& to, path const& from, system::error_code& ec) noexcept
{
detail::create_directory_symlink(to, from, &ec);
}
inline void create_hard_link(path const& to, path const& new_hard_link)
{
detail::create_hard_link(to, new_hard_link);
}
inline void create_hard_link(path const& to, path const& new_hard_link, system::error_code& ec) noexcept
{
detail::create_hard_link(to, new_hard_link, &ec);
}
inline void create_symlink(path const& to, path const& new_symlink)
{
detail::create_symlink(to, new_symlink);
}
inline void create_symlink(path const& to, path const& new_symlink, system::error_code& ec) noexcept
{
detail::create_symlink(to, new_symlink, &ec);
}
inline boost::uintmax_t file_size(path const& p)
{
return detail::file_size(p);
}
inline boost::uintmax_t file_size(path const& p, system::error_code& ec) noexcept
{
return detail::file_size(p, &ec);
}
inline boost::uintmax_t hard_link_count(path const& p)
{
return detail::hard_link_count(p);
}
inline boost::uintmax_t hard_link_count(path const& p, system::error_code& ec) noexcept
{
return detail::hard_link_count(p, &ec);
}
inline std::time_t creation_time(path const& p)
{
return detail::creation_time(p);
}
inline std::time_t creation_time(path const& p, system::error_code& ec) noexcept
{
return detail::creation_time(p, &ec);
}
inline std::time_t last_write_time(path const& p)
{
return detail::last_write_time(p);
}
inline std::time_t last_write_time(path const& p, system::error_code& ec) noexcept
{
return detail::last_write_time(p, &ec);
}
inline void last_write_time(path const& p, const std::time_t new_time)
{
detail::last_write_time(p, new_time);
}
inline void last_write_time(path const& p, const std::time_t new_time, system::error_code& ec) noexcept
{
detail::last_write_time(p, new_time, &ec);
}
inline void permissions(path const& p, perms prms)
{
detail::permissions(p, prms);
}
inline void permissions(path const& p, perms prms, system::error_code& ec) noexcept
{
detail::permissions(p, prms, &ec);
}
inline path read_symlink(path const& p)
{
return detail::read_symlink(p);
}
inline path read_symlink(path const& p, system::error_code& ec)
{
return detail::read_symlink(p, &ec);
}
inline bool remove(path const& p)
{
return detail::remove(p);
}
inline bool remove(path const& p, system::error_code& ec) noexcept
{
return detail::remove(p, &ec);
}
inline boost::uintmax_t remove_all(path const& p)
{
return detail::remove_all(p);
}
inline boost::uintmax_t remove_all(path const& p, system::error_code& ec) noexcept
{
return detail::remove_all(p, &ec);
}
inline void rename(path const& old_p, path const& new_p)
{
detail::rename(old_p, new_p);
}
inline void rename(path const& old_p, path const& new_p, system::error_code& ec) noexcept
{
detail::rename(old_p, new_p, &ec);
}
// name suggested by Scott McMurray
inline void resize_file(path const& p, uintmax_t size)
{
detail::resize_file(p, size);
}
inline void resize_file(path const& p, uintmax_t size, system::error_code& ec) noexcept
{
detail::resize_file(p, size, &ec);
}
inline path relative(path const& p, path const& base = current_path())
{
return detail::relative(p, base);
}
inline path relative(path const& p, system::error_code& ec)
{
path base = current_path(ec);
if (ec)
return path();
return detail::relative(p, base, &ec);
}
inline path relative(path const& p, path const& base, system::error_code& ec)
{
return detail::relative(p, base, &ec);
}
inline space_info space(path const& p)
{
return detail::space(p);
}
inline space_info space(path const& p, system::error_code& ec) noexcept
{
return detail::space(p, &ec);
}
inline path system_complete(path const& p)
{
return detail::system_complete(p);
}
inline path system_complete(path const& p, system::error_code& ec)
{
return detail::system_complete(p, &ec);
}
inline path temp_directory_path()
{
return detail::temp_directory_path();
}
inline path temp_directory_path(system::error_code& ec)
{
return detail::temp_directory_path(&ec);
}
inline path unique_path(path const& p =
#if defined(BOOST_WINDOWS_API)
L"%%%%-%%%%-%%%%-%%%%"
#else
"%%%%-%%%%-%%%%-%%%%"
#endif
)
{
return detail::unique_path(p);
}
inline path unique_path(system::error_code& ec)
{
return detail::unique_path
(
#if defined(BOOST_WINDOWS_API)
L"%%%%-%%%%-%%%%-%%%%",
#else
"%%%%-%%%%-%%%%-%%%%",
#endif
&ec
);
}
inline path unique_path(path const& p, system::error_code& ec)
{
return detail::unique_path(p, &ec);
}
namespace BOOST_FILESYSTEM_VERSION_NAMESPACE {
inline path absolute(path const& p, path const& base = current_path())
{
return BOOST_FILESYSTEM_VERSIONED_SYM(detail::absolute)(p, base);
}
inline path absolute(path const& p, system::error_code& ec)
{
path base = current_path(ec);
if (ec)
return path();
return BOOST_FILESYSTEM_VERSIONED_SYM(detail::absolute)(p, base, &ec);
}
inline path absolute(path const& p, path const& base, system::error_code& ec)
{
return BOOST_FILESYSTEM_VERSIONED_SYM(detail::absolute)(p, base, &ec);
}
inline path canonical(path const& p, path const& base = current_path())
{
return BOOST_FILESYSTEM_VERSIONED_SYM(detail::canonical)(p, base);
}
inline path canonical(path const& p, system::error_code& ec)
{
path base = current_path(ec);
if (ec)
return path();
return BOOST_FILESYSTEM_VERSIONED_SYM(detail::canonical)(p, base, &ec);
}
inline path canonical(path const& p, path const& base, system::error_code& ec)
{
return BOOST_FILESYSTEM_VERSIONED_SYM(detail::canonical)(p, base, &ec);
}
inline bool equivalent(path const& p1, path const& p2)
{
return BOOST_FILESYSTEM_VERSIONED_SYM(detail::equivalent)(p1, p2);
}
inline bool equivalent(path const& p1, path const& p2, system::error_code& ec) noexcept
{
return BOOST_FILESYSTEM_VERSIONED_SYM(detail::equivalent)(p1, p2, &ec);
}
inline path weakly_canonical(path const& p, path const& base = current_path())
{
return BOOST_FILESYSTEM_VERSIONED_SYM(detail::weakly_canonical)(p, base);
}
inline path weakly_canonical(path const& p, system::error_code& ec)
{
path base = current_path(ec);
if (ec)
return path();
return BOOST_FILESYSTEM_VERSIONED_SYM(detail::weakly_canonical)(p, base, &ec);
}
inline path weakly_canonical(path const& p, path const& base, system::error_code& ec)
{
return BOOST_FILESYSTEM_VERSIONED_SYM(detail::weakly_canonical)(p, base, &ec);
}
} // namespace BOOST_FILESYSTEM_VERSION_NAMESPACE
using BOOST_FILESYSTEM_VERSION_NAMESPACE::absolute;
using BOOST_FILESYSTEM_VERSION_NAMESPACE::canonical;
using BOOST_FILESYSTEM_VERSION_NAMESPACE::equivalent;
using BOOST_FILESYSTEM_VERSION_NAMESPACE::weakly_canonical;
// test helper -----------------------------------------------------------------------//
// Not part of the documented interface since false positives are possible;
// there is no law that says that an OS that has large stat.st_size
// actually supports large file sizes.
namespace detail {
BOOST_FILESYSTEM_DECL bool possible_large_file_size_support();
} // namespace detail
} // namespace filesystem
} // namespace boost
#include <boost/filesystem/detail/footer.hpp>
#endif // BOOST_FILESYSTEM_OPERATIONS_HPP

File diff suppressed because it is too large Load Diff