update boost
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
// 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
|
||||
@@ -9,32 +10,48 @@
|
||||
|
||||
//--------------------------------------------------------------------------------------//
|
||||
|
||||
#ifndef BOOST_FILESYSTEM3_CONFIG_HPP
|
||||
#define BOOST_FILESYSTEM3_CONFIG_HPP
|
||||
|
||||
# if defined(BOOST_FILESYSTEM_VERSION) && BOOST_FILESYSTEM_VERSION != 3
|
||||
# error Compiling Filesystem version 3 file with BOOST_FILESYSTEM_VERSION defined != 3
|
||||
# endif
|
||||
|
||||
# if !defined(BOOST_FILESYSTEM_VERSION)
|
||||
# define BOOST_FILESYSTEM_VERSION 3
|
||||
# endif
|
||||
|
||||
#define BOOST_FILESYSTEM_I18N // aid users wishing to compile several versions
|
||||
#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/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))
|
||||
|
||||
#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
|
||||
#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 ----------------------------------------------------------------//
|
||||
//
|
||||
@@ -46,50 +63,57 @@
|
||||
|
||||
#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
|
||||
#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
|
||||
#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
|
||||
#define BOOST_FILESYSTEM_DYN_LINK
|
||||
#elif defined(BOOST_ALL_STATIC_LINK) && !defined(BOOST_FILESYSTEM_STATIC_LINK)
|
||||
# define 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
|
||||
#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
|
||||
#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
|
||||
#if defined(BOOST_FILESYSTEM_SOURCE)
|
||||
#define BOOST_FILESYSTEM_DECL BOOST_SYMBOL_EXPORT
|
||||
#else
|
||||
# define BOOST_FILESYSTEM_DECL
|
||||
#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)
|
||||
#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:
|
||||
@@ -99,12 +123,30 @@
|
||||
// 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
|
||||
#define BOOST_DYN_LINK
|
||||
#endif
|
||||
//
|
||||
// And include the header that does the work:
|
||||
//
|
||||
#include <boost/config/auto_link.hpp>
|
||||
#endif // auto-linking disabled
|
||||
#endif // auto-linking disabled
|
||||
|
||||
#endif // BOOST_FILESYSTEM3_CONFIG_HPP
|
||||
#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
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
|
||||
// Copyright Beman Dawes, 2002-2005
|
||||
// Copyright Vladimir Prus, 2002
|
||||
|
||||
// Use, modification, and distribution is subject to 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)
|
||||
@@ -10,49 +11,45 @@
|
||||
|
||||
//----------------------------------------------------------------------------//
|
||||
|
||||
#ifndef BOOST_FILESYSTEM3_CONVENIENCE_HPP
|
||||
#define BOOST_FILESYSTEM3_CONVENIENCE_HPP
|
||||
|
||||
#include <boost/config.hpp>
|
||||
|
||||
# if defined( BOOST_NO_STD_WSTRING )
|
||||
# error Configuration not supported: Boost.Filesystem V3 and later requires std::wstring support
|
||||
# endif
|
||||
#ifndef BOOST_FILESYSTEM_CONVENIENCE_HPP
|
||||
#define BOOST_FILESYSTEM_CONVENIENCE_HPP
|
||||
|
||||
#include <boost/filesystem/config.hpp>
|
||||
#include <boost/filesystem/operations.hpp>
|
||||
#include <boost/system/error_code.hpp>
|
||||
|
||||
#include <boost/config/abi_prefix.hpp> // must be the last #include
|
||||
#include <boost/filesystem/detail/header.hpp> // must be the last #include
|
||||
|
||||
namespace boost
|
||||
namespace boost {
|
||||
namespace filesystem {
|
||||
|
||||
#ifndef BOOST_FILESYSTEM_NO_DEPRECATED
|
||||
|
||||
BOOST_FILESYSTEM_DETAIL_DEPRECATED("Use path::extension() instead")
|
||||
inline std::string extension(const path& p)
|
||||
{
|
||||
namespace filesystem
|
||||
{
|
||||
return p.extension().string();
|
||||
}
|
||||
|
||||
# ifndef BOOST_FILESYSTEM_NO_DEPRECATED
|
||||
BOOST_FILESYSTEM_DETAIL_DEPRECATED("Use path::stem() instead")
|
||||
inline std::string basename(const path& p)
|
||||
{
|
||||
return p.stem().string();
|
||||
}
|
||||
|
||||
inline std::string extension(const path & p)
|
||||
{
|
||||
return p.extension().string();
|
||||
}
|
||||
BOOST_FILESYSTEM_DETAIL_DEPRECATED("Use path::replace_extension() instead")
|
||||
inline path change_extension(const path& p, const path& new_extension)
|
||||
{
|
||||
path new_p(p);
|
||||
new_p.replace_extension(new_extension);
|
||||
return new_p;
|
||||
}
|
||||
|
||||
inline std::string basename(const path & p)
|
||||
{
|
||||
return p.stem().string();
|
||||
}
|
||||
#endif
|
||||
|
||||
inline path change_extension( const path & p, const path & new_extension )
|
||||
{
|
||||
path new_p( p );
|
||||
new_p.replace_extension( new_extension );
|
||||
return new_p;
|
||||
}
|
||||
|
||||
# endif
|
||||
|
||||
|
||||
} // namespace filesystem
|
||||
} // namespace filesystem
|
||||
} // namespace boost
|
||||
|
||||
#include <boost/config/abi_suffix.hpp> // pops abi_prefix.hpp pragmas
|
||||
#endif // BOOST_FILESYSTEM3_CONVENIENCE_HPP
|
||||
#include <boost/filesystem/detail/footer.hpp>
|
||||
|
||||
#endif // BOOST_FILESYSTEM_CONVENIENCE_HPP
|
||||
|
||||
87
linx64/include/boost/filesystem/cstdio.hpp
Normal file
87
linx64/include/boost/filesystem/cstdio.hpp
Normal 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() BOOST_NOEXCEPT : p(buf) {}
|
||||
~small_array() BOOST_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(NULL, 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 NULL;
|
||||
|
||||
wmode.p = static_cast< wchar_t* >(std::malloc((wmode_len + 1u) * sizeof(wchar_t)));
|
||||
if (BOOST_UNLIKELY(!wmode.p))
|
||||
return NULL;
|
||||
|
||||
std::size_t wmode_len2 = std::mbstowcs(wmode.p, mode, wmode_len + 1u);
|
||||
if (BOOST_UNLIKELY(wmode_len2 > wmode_len))
|
||||
return NULL;
|
||||
}
|
||||
|
||||
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
|
||||
23
linx64/include/boost/filesystem/detail/footer.hpp
Normal file
23
linx64/include/boost/filesystem/detail/footer.hpp
Normal 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>
|
||||
54
linx64/include/boost/filesystem/detail/header.hpp
Normal file
54
linx64/include/boost/filesystem/detail/header.hpp
Normal 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)
|
||||
@@ -1,44 +0,0 @@
|
||||
// boost/filesystem/detail/macro_value.hpp -------------------------------------------//
|
||||
|
||||
// (C) Copyright John Maddock 2001 - 2003
|
||||
// (C) Copyright Jens Maurer 2001
|
||||
// (C) Copyright Peter Dimov 2001
|
||||
// (C) Copyright Darin Adler 2001
|
||||
// (C) Copyright Beman Dawes 2002
|
||||
|
||||
// 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_MACRO_VALUE_HPP
|
||||
#define BOOST_FILESYSTEM_MACRO_VALUE_HPP
|
||||
|
||||
#include <boost/config.hpp>
|
||||
#include <boost/assert.hpp>
|
||||
#include <cstdlib>
|
||||
|
||||
namespace boost
|
||||
{
|
||||
namespace detail
|
||||
{
|
||||
inline const char* macro_value(const char* name, const char* value)
|
||||
{
|
||||
static const char* no_value = "[no value]";
|
||||
static const char* not_defined = "[not defined]";
|
||||
|
||||
BOOST_ASSERT_MSG(name, "name argument must not be a null pointer");
|
||||
BOOST_ASSERT_MSG(value, "value argument must not be a null pointer");
|
||||
|
||||
return strcmp(name, value + 1)
|
||||
? ((*value && *(value+1)) ? (value+1) : no_value)
|
||||
: not_defined; // name == value+1 so the macro is not defined
|
||||
}
|
||||
} // detail
|
||||
} // boost
|
||||
|
||||
#define BOOST_MACRO_VALUE(X) boost::detail::macro_value(#X, BOOST_STRINGIZE(=X))
|
||||
|
||||
#endif // BOOST_FILESYSTEM_MACRO_VALUE_HPP
|
||||
737
linx64/include/boost/filesystem/detail/path_traits.hpp
Normal file
737
linx64/include/boost/filesystem/detail/path_traits.hpp
Normal file
@@ -0,0 +1,737 @@
|
||||
// filesystem path_traits.hpp --------------------------------------------------------//
|
||||
|
||||
// Copyright Beman Dawes 2009
|
||||
// Copyright Andrey Semashev 2022
|
||||
|
||||
// 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>
|
||||
#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/type_traits/declval.hpp>
|
||||
#include <boost/type_traits/remove_cv.hpp>
|
||||
#include <boost/type_traits/integral_constant.hpp>
|
||||
#include <boost/type_traits/conjunction.hpp>
|
||||
#if defined(BOOST_FILESYSTEM_DETAIL_CXX23_STRING_VIEW_HAS_IMPLICIT_RANGE_CTOR)
|
||||
#include <boost/type_traits/disjunction.hpp>
|
||||
#include <boost/core/enable_if.hpp>
|
||||
#endif
|
||||
#if !defined(BOOST_FILESYSTEM_NO_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() BOOST_NOEXCEPT;
|
||||
|
||||
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_NO_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_NO_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 boost::true_type
|
||||
{
|
||||
};
|
||||
|
||||
template< >
|
||||
struct is_known_path_source_tag< unknown_type_tag > :
|
||||
public boost::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 boost::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 boost::false_type
|
||||
{
|
||||
};
|
||||
|
||||
template< >
|
||||
struct is_path_char_type< char > :
|
||||
public boost::true_type
|
||||
{
|
||||
};
|
||||
|
||||
template< >
|
||||
struct is_path_char_type< wchar_t > :
|
||||
public boost::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 boost::conjunction<
|
||||
boost::iterators::is_iterator< Iterator >,
|
||||
is_iterator_to_path_chars< Iterator >
|
||||
>::type
|
||||
{
|
||||
};
|
||||
|
||||
|
||||
//! 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 boost::false_type
|
||||
{
|
||||
};
|
||||
|
||||
template< >
|
||||
struct is_native_char_ptr< path_native_char_type* > :
|
||||
public boost::true_type
|
||||
{
|
||||
};
|
||||
|
||||
template< >
|
||||
struct is_native_char_ptr< const path_native_char_type* > :
|
||||
public boost::true_type
|
||||
{
|
||||
};
|
||||
|
||||
|
||||
//! Converts character encoding using the supplied codecvt facet. If \a cvt is \c NULL 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 = NULL);
|
||||
|
||||
//! \overload convert
|
||||
BOOST_FILESYSTEM_DECL
|
||||
void convert(const wchar_t* from, const wchar_t* from_end, std::string& to, const codecvt_type* cvt = NULL);
|
||||
|
||||
|
||||
// Source dispatch -----------------------------------------------------------------//
|
||||
|
||||
template< typename Source, typename Callback >
|
||||
typename Callback::result_type dispatch(Source const& source, Callback cb, const codecvt_type* cvt = NULL);
|
||||
|
||||
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_NO_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 = NULL, *data_end = NULL;
|
||||
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 = NULL, *data_end = NULL;
|
||||
if (!source.empty())
|
||||
{
|
||||
data = &source[0];
|
||||
data_end = data + source.size();
|
||||
}
|
||||
return cb(data, data_end, cvt);
|
||||
}
|
||||
|
||||
#endif // !defined(BOOST_FILESYSTEM_NO_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 boost::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(const char*);
|
||||
yes_type check(const wchar_t*);
|
||||
yes_type check(std::string const&);
|
||||
yes_type check(std::wstring const&);
|
||||
yes_type check(boost::container::basic_string< char, std::char_traits< char >, void > const&);
|
||||
yes_type check(boost::container::basic_string< wchar_t, std::char_traits< wchar_t >, void > const&);
|
||||
#if !defined(BOOST_NO_CXX17_HDR_STRING_VIEW)
|
||||
yes_type check(std::string_view const&);
|
||||
yes_type check(std::wstring_view const&);
|
||||
#endif
|
||||
yes_type check(boost::basic_string_view< char, std::char_traits< char > > const&);
|
||||
yes_type check(boost::basic_string_view< wchar_t, std::char_traits< wchar_t > > const&);
|
||||
#if !defined(BOOST_NO_CXX11_NULLPTR)
|
||||
no_type check(std::nullptr_t);
|
||||
#endif
|
||||
no_type check(...);
|
||||
|
||||
} // namespace is_convertible_to_path_source_impl
|
||||
|
||||
//! The type trait indicates whether the type has a conversion path to one of the path source types
|
||||
template< typename T >
|
||||
struct is_convertible_to_path_source :
|
||||
public boost::integral_constant<
|
||||
bool,
|
||||
sizeof(is_convertible_to_path_source_impl::check(boost::declval< T const& >())) == sizeof(yes_type)
|
||||
>
|
||||
{
|
||||
};
|
||||
|
||||
#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(std::string_view const&);
|
||||
yes_type check(std::wstring_view const&);
|
||||
#if !defined(BOOST_NO_CXX11_NULLPTR)
|
||||
no_type check(std::nullptr_t);
|
||||
#endif
|
||||
no_type check(...);
|
||||
|
||||
} // namespace is_convertible_to_std_string_view_impl
|
||||
|
||||
template< typename T >
|
||||
struct is_convertible_to_std_string_view :
|
||||
public boost::integral_constant<
|
||||
bool,
|
||||
sizeof(is_convertible_to_std_string_view_impl::check(boost::declval< T const& >())) == sizeof(yes_type)
|
||||
>
|
||||
{
|
||||
};
|
||||
|
||||
namespace is_convertible_to_path_source_non_std_string_view_impl {
|
||||
|
||||
yes_type check(const char*);
|
||||
yes_type check(const wchar_t*);
|
||||
yes_type check(std::string const&);
|
||||
yes_type check(std::wstring const&);
|
||||
yes_type check(boost::container::basic_string< char, std::char_traits< char >, void > const&);
|
||||
yes_type check(boost::container::basic_string< wchar_t, std::char_traits< wchar_t >, void > const&);
|
||||
yes_type check(boost::basic_string_view< char, std::char_traits< char > > const&);
|
||||
yes_type check(boost::basic_string_view< wchar_t, std::char_traits< wchar_t > > const&);
|
||||
#if !defined(BOOST_NO_CXX11_NULLPTR)
|
||||
no_type check(std::nullptr_t);
|
||||
#endif
|
||||
no_type check(...);
|
||||
|
||||
} // namespace is_convertible_to_path_source_non_std_string_view_impl
|
||||
|
||||
template< typename T >
|
||||
struct is_convertible_to_path_source_non_std_string_view :
|
||||
public boost::integral_constant<
|
||||
bool,
|
||||
sizeof(is_convertible_to_path_source_non_std_string_view_impl::check(boost::declval< T const& >())) == sizeof(yes_type)
|
||||
>
|
||||
{
|
||||
};
|
||||
|
||||
//! The type trait indicates whether the type has a conversion path to one of the path source types
|
||||
template< typename T >
|
||||
struct is_convertible_to_path_source :
|
||||
public boost::disjunction<
|
||||
is_convertible_to_std_string_view< T >,
|
||||
is_convertible_to_path_source_non_std_string_view< T >
|
||||
>::type
|
||||
{
|
||||
};
|
||||
|
||||
#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 = NULL)
|
||||
{
|
||||
typedef typename boost::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 boost::disable_if_c<
|
||||
is_convertible_to_std_string_view< typename boost::remove_cv< Source >::type >::value,
|
||||
typename Callback::result_type
|
||||
>::type dispatch_convertible(Source const& source, Callback cb, const codecvt_type* cvt = NULL)
|
||||
{
|
||||
typedef typename boost::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 boost::enable_if_c<
|
||||
is_convertible_to_std_string_view< typename boost::remove_cv< Source >::type >::value,
|
||||
typename Callback::result_type
|
||||
>::type dispatch_convertible(Source const& source, Callback cb, const codecvt_type* cvt = NULL)
|
||||
{
|
||||
typedef typename boost::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
|
||||
@@ -9,10 +9,17 @@
|
||||
|
||||
#include <boost/filesystem/config.hpp>
|
||||
|
||||
#define BOOST_UTF8_BEGIN_NAMESPACE \
|
||||
namespace boost { namespace filesystem { namespace detail {
|
||||
#include <boost/filesystem/detail/header.hpp>
|
||||
|
||||
#define BOOST_UTF8_END_NAMESPACE }}}
|
||||
#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>
|
||||
@@ -21,4 +28,6 @@
|
||||
#undef BOOST_UTF8_END_NAMESPACE
|
||||
#undef BOOST_UTF8_DECL
|
||||
|
||||
#endif
|
||||
#include <boost/filesystem/detail/footer.hpp>
|
||||
|
||||
#endif // BOOST_FILESYSTEM_UTF8_CODECVT_FACET_HPP
|
||||
|
||||
1113
linx64/include/boost/filesystem/directory.hpp
Normal file
1113
linx64/include/boost/filesystem/directory.hpp
Normal file
File diff suppressed because it is too large
Load Diff
@@ -1,9 +1,92 @@
|
||||
// boost/filesystem/exception.hpp -----------------------------------------------------//
|
||||
|
||||
// Copyright Beman Dawes 2003
|
||||
// Use, modification, and distribution is subject to 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)
|
||||
// Copyright Andrey Semashev 2019
|
||||
|
||||
// This header is no longer used. The contents have been moved to path.hpp.
|
||||
// It is provided so that user code #includes do not have to be changed.
|
||||
// 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() BOOST_NOEXCEPT_OR_NOTHROW;
|
||||
|
||||
path const& path1() const BOOST_NOEXCEPT
|
||||
{
|
||||
return m_imp_ptr.get() ? m_imp_ptr->m_path1 : get_empty_path();
|
||||
}
|
||||
path const& path2() const BOOST_NOEXCEPT
|
||||
{
|
||||
return m_imp_ptr.get() ? m_imp_ptr->m_path2 : get_empty_path();
|
||||
}
|
||||
|
||||
BOOST_FILESYSTEM_DECL const char* what() const BOOST_NOEXCEPT_OR_NOTHROW BOOST_OVERRIDE;
|
||||
|
||||
private:
|
||||
BOOST_FILESYSTEM_DECL static path const& get_empty_path() BOOST_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
|
||||
|
||||
BOOST_DEFAULTED_FUNCTION(impl(), {})
|
||||
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
|
||||
|
||||
269
linx64/include/boost/filesystem/file_status.hpp
Normal file
269
linx64/include/boost/filesystem/file_status.hpp
Normal file
@@ -0,0 +1,269 @@
|
||||
// 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,
|
||||
#ifndef BOOST_FILESYSTEM_NO_DEPRECATED
|
||||
status_unknown = status_error,
|
||||
#endif
|
||||
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() BOOST_NOEXCEPT :
|
||||
m_value(status_error),
|
||||
m_perms(perms_not_known)
|
||||
{
|
||||
}
|
||||
explicit BOOST_CONSTEXPR file_status(file_type v) BOOST_NOEXCEPT :
|
||||
m_value(v),
|
||||
m_perms(perms_not_known)
|
||||
{
|
||||
}
|
||||
BOOST_CONSTEXPR file_status(file_type v, perms prms) BOOST_NOEXCEPT :
|
||||
m_value(v),
|
||||
m_perms(prms)
|
||||
{
|
||||
}
|
||||
|
||||
// As of October 2015 the interaction between noexcept and =default is so troublesome
|
||||
// for VC++, GCC, and probably other compilers, that =default is not used with noexcept
|
||||
// functions. GCC is not even consistent for the same release on different platforms.
|
||||
|
||||
BOOST_CONSTEXPR file_status(file_status const& rhs) BOOST_NOEXCEPT :
|
||||
m_value(rhs.m_value),
|
||||
m_perms(rhs.m_perms)
|
||||
{
|
||||
}
|
||||
BOOST_CXX14_CONSTEXPR file_status& operator=(file_status const& rhs) BOOST_NOEXCEPT
|
||||
{
|
||||
m_value = rhs.m_value;
|
||||
m_perms = rhs.m_perms;
|
||||
return *this;
|
||||
}
|
||||
|
||||
#if !defined(BOOST_NO_CXX11_RVALUE_REFERENCES)
|
||||
// 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) BOOST_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) BOOST_NOEXCEPT
|
||||
{
|
||||
m_value = static_cast< file_type&& >(rhs.m_value);
|
||||
m_perms = static_cast< perms&& >(rhs.m_perms);
|
||||
return *this;
|
||||
}
|
||||
#endif
|
||||
|
||||
// observers
|
||||
BOOST_CONSTEXPR file_type type() const BOOST_NOEXCEPT { return m_value; }
|
||||
BOOST_CONSTEXPR perms permissions() const BOOST_NOEXCEPT { return m_perms; }
|
||||
|
||||
// modifiers
|
||||
BOOST_CXX14_CONSTEXPR void type(file_type v) BOOST_NOEXCEPT { m_value = v; }
|
||||
BOOST_CXX14_CONSTEXPR void permissions(perms prms) BOOST_NOEXCEPT { m_perms = prms; }
|
||||
|
||||
BOOST_CONSTEXPR bool operator==(file_status const& rhs) const BOOST_NOEXCEPT
|
||||
{
|
||||
return type() == rhs.type() && permissions() == rhs.permissions();
|
||||
}
|
||||
BOOST_CONSTEXPR bool operator!=(file_status const& rhs) const BOOST_NOEXCEPT
|
||||
{
|
||||
return !(*this == rhs);
|
||||
}
|
||||
|
||||
private:
|
||||
file_type m_value;
|
||||
perms m_perms;
|
||||
};
|
||||
|
||||
inline BOOST_CONSTEXPR bool type_present(file_status f) BOOST_NOEXCEPT
|
||||
{
|
||||
return f.type() != filesystem::status_error;
|
||||
}
|
||||
|
||||
inline BOOST_CONSTEXPR bool permissions_present(file_status f) BOOST_NOEXCEPT
|
||||
{
|
||||
return f.permissions() != filesystem::perms_not_known;
|
||||
}
|
||||
|
||||
inline BOOST_CONSTEXPR bool status_known(file_status f) BOOST_NOEXCEPT
|
||||
{
|
||||
return filesystem::type_present(f) && filesystem::permissions_present(f);
|
||||
}
|
||||
|
||||
inline BOOST_CONSTEXPR bool exists(file_status f) BOOST_NOEXCEPT
|
||||
{
|
||||
return f.type() != filesystem::status_error && f.type() != filesystem::file_not_found;
|
||||
}
|
||||
|
||||
inline BOOST_CONSTEXPR bool is_regular_file(file_status f) BOOST_NOEXCEPT
|
||||
{
|
||||
return f.type() == filesystem::regular_file;
|
||||
}
|
||||
|
||||
inline BOOST_CONSTEXPR bool is_directory(file_status f) BOOST_NOEXCEPT
|
||||
{
|
||||
return f.type() == filesystem::directory_file;
|
||||
}
|
||||
|
||||
inline BOOST_CONSTEXPR bool is_symlink(file_status f) BOOST_NOEXCEPT
|
||||
{
|
||||
return f.type() == filesystem::symlink_file;
|
||||
}
|
||||
|
||||
inline BOOST_CONSTEXPR bool is_block_file(file_status f) BOOST_NOEXCEPT
|
||||
{
|
||||
return f.type() == filesystem::block_file;
|
||||
}
|
||||
|
||||
inline BOOST_CONSTEXPR bool is_character_file(file_status f) BOOST_NOEXCEPT
|
||||
{
|
||||
return f.type() == filesystem::character_file;
|
||||
}
|
||||
|
||||
inline BOOST_CONSTEXPR bool is_fifo(file_status f) BOOST_NOEXCEPT
|
||||
{
|
||||
return f.type() == filesystem::fifo_file;
|
||||
}
|
||||
|
||||
inline BOOST_CONSTEXPR bool is_socket(file_status f) BOOST_NOEXCEPT
|
||||
{
|
||||
return f.type() == filesystem::socket_file;
|
||||
}
|
||||
|
||||
inline BOOST_CONSTEXPR bool is_reparse_file(file_status f) BOOST_NOEXCEPT
|
||||
{
|
||||
return f.type() == filesystem::reparse_file;
|
||||
}
|
||||
|
||||
inline BOOST_CONSTEXPR bool is_other(file_status f) BOOST_NOEXCEPT
|
||||
{
|
||||
return filesystem::exists(f) && !filesystem::is_regular_file(f) && !filesystem::is_directory(f) && !filesystem::is_symlink(f);
|
||||
}
|
||||
|
||||
#ifndef BOOST_FILESYSTEM_NO_DEPRECATED
|
||||
BOOST_FILESYSTEM_DETAIL_DEPRECATED("Use is_regular_file() instead")
|
||||
inline bool is_regular(file_status f) BOOST_NOEXCEPT
|
||||
{
|
||||
return filesystem::is_regular_file(f);
|
||||
}
|
||||
#endif
|
||||
|
||||
} // namespace filesystem
|
||||
} // namespace boost
|
||||
|
||||
#include <boost/filesystem/detail/footer.hpp> // pops abi_prefix.hpp pragmas
|
||||
|
||||
#endif // BOOST_FILESYSTEM_FILE_STATUS_HPP
|
||||
@@ -1,6 +1,7 @@
|
||||
// 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
|
||||
@@ -9,177 +10,252 @@
|
||||
|
||||
//--------------------------------------------------------------------------------------//
|
||||
|
||||
#ifndef BOOST_FILESYSTEM3_FSTREAM_HPP
|
||||
#define BOOST_FILESYSTEM3_FSTREAM_HPP
|
||||
|
||||
#include <boost/config.hpp>
|
||||
|
||||
# if defined( BOOST_NO_STD_WSTRING )
|
||||
# error Configuration not supported: Boost.Filesystem V3 and later requires std::wstring support
|
||||
# endif
|
||||
#ifndef BOOST_FILESYSTEM_FSTREAM_HPP
|
||||
#define BOOST_FILESYSTEM_FSTREAM_HPP
|
||||
|
||||
#include <boost/filesystem/config.hpp>
|
||||
#include <boost/filesystem/path.hpp>
|
||||
#include <cstddef>
|
||||
#include <iosfwd>
|
||||
#include <fstream>
|
||||
|
||||
#include <boost/config/abi_prefix.hpp> // must be the last #include
|
||||
#include <boost/filesystem/detail/header.hpp> // must be the last #include
|
||||
|
||||
// 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(BOOST_WINDOWS_API) \
|
||||
&& (!defined(_CPPLIB_VER) || _CPPLIB_VER < 405 || defined(_STLPORT_VERSION))
|
||||
// !Dinkumware || early Dinkumware || STLPort masquerading as Dinkumware
|
||||
# define BOOST_FILESYSTEM_C_STR string().c_str() // use narrow, since wide not available
|
||||
#else // use the native c_str, which will be narrow on POSIX, wide on Windows
|
||||
# define BOOST_FILESYSTEM_C_STR c_str()
|
||||
#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<charT>' : inherits 'std::basic_istream<_Elem,_Traits>::std::basic_istream<_Elem,_Traits>::_Add_vtordisp1' via dominance
|
||||
#pragma warning(disable: 4250)
|
||||
// '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
|
||||
{
|
||||
namespace boost {
|
||||
namespace filesystem {
|
||||
|
||||
//--------------------------------------------------------------------------------------//
|
||||
// basic_filebuf //
|
||||
//--------------------------------------------------------------------------------------//
|
||||
|
||||
template < class charT, class traits = std::char_traits<charT> >
|
||||
class basic_filebuf : public std::basic_filebuf<charT,traits>
|
||||
{
|
||||
private: // disallow copying
|
||||
basic_filebuf(const basic_filebuf&);
|
||||
const basic_filebuf& operator=(const 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() {}
|
||||
virtual ~basic_filebuf() {}
|
||||
public:
|
||||
BOOST_DEFAULTED_FUNCTION(basic_filebuf(), {})
|
||||
|
||||
basic_filebuf<charT,traits>*
|
||||
open(const path& p, std::ios_base::openmode mode)
|
||||
#if !defined(BOOST_FILESYSTEM_DETAIL_NO_CXX11_MOVABLE_FSTREAMS)
|
||||
#if !defined(BOOST_NO_CXX11_DEFAULTED_MOVES)
|
||||
basic_filebuf(basic_filebuf&&) = default;
|
||||
basic_filebuf& operator= (basic_filebuf&&) = default;
|
||||
#else
|
||||
basic_filebuf(basic_filebuf&& that) :
|
||||
base_type(static_cast< base_type&& >(that)) {}
|
||||
|
||||
basic_filebuf& operator= (basic_filebuf&& that)
|
||||
{
|
||||
return std::basic_filebuf<charT,traits>::open(p.BOOST_FILESYSTEM_C_STR, mode)
|
||||
? this : 0;
|
||||
*static_cast< base_type* >(this) = static_cast< base_type&& >(that);
|
||||
return *this;
|
||||
}
|
||||
};
|
||||
#endif
|
||||
#endif // !defined(BOOST_FILESYSTEM_DETAIL_NO_CXX11_MOVABLE_FSTREAMS)
|
||||
|
||||
BOOST_DELETED_FUNCTION(basic_filebuf(basic_filebuf const&))
|
||||
BOOST_DELETED_FUNCTION(basic_filebuf const& operator= (basic_filebuf const&))
|
||||
|
||||
public:
|
||||
basic_filebuf* open(path const& p, std::ios_base::openmode mode)
|
||||
{
|
||||
return base_type::open(BOOST_FILESYSTEM_C_STR(p), mode) ? this : NULL;
|
||||
}
|
||||
};
|
||||
|
||||
//--------------------------------------------------------------------------------------//
|
||||
// basic_ifstream //
|
||||
//--------------------------------------------------------------------------------------//
|
||||
|
||||
template < class charT, class traits = std::char_traits<charT> >
|
||||
class basic_ifstream : public std::basic_ifstream<charT,traits>
|
||||
{
|
||||
private: // disallow copying
|
||||
basic_ifstream(const basic_ifstream&);
|
||||
const basic_ifstream& operator=(const 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() {}
|
||||
public:
|
||||
BOOST_DEFAULTED_FUNCTION(basic_ifstream(), {})
|
||||
|
||||
// use two signatures, rather than one signature with default second
|
||||
// argument, to workaround VC++ 7.1 bug (ID VSWhidbey 38416)
|
||||
|
||||
explicit basic_ifstream(const path& p)
|
||||
: std::basic_ifstream<charT,traits>(p.BOOST_FILESYSTEM_C_STR, std::ios_base::in) {}
|
||||
explicit basic_ifstream(path const& p) :
|
||||
base_type(BOOST_FILESYSTEM_C_STR(p), std::ios_base::in) {}
|
||||
|
||||
basic_ifstream(const path& p, std::ios_base::openmode mode)
|
||||
: std::basic_ifstream<charT,traits>(p.BOOST_FILESYSTEM_C_STR, mode) {}
|
||||
basic_ifstream(path const& p, std::ios_base::openmode mode) :
|
||||
base_type(BOOST_FILESYSTEM_C_STR(p), mode) {}
|
||||
|
||||
void open(const path& p)
|
||||
{ std::basic_ifstream<charT,traits>::open(p.BOOST_FILESYSTEM_C_STR, std::ios_base::in); }
|
||||
#if !defined(BOOST_FILESYSTEM_DETAIL_NO_CXX11_MOVABLE_FSTREAMS)
|
||||
basic_ifstream(basic_ifstream&& that) :
|
||||
base_type(static_cast< base_type&& >(that)) {}
|
||||
|
||||
void open(const path& p, std::ios_base::openmode mode)
|
||||
{ std::basic_ifstream<charT,traits>::open(p.BOOST_FILESYSTEM_C_STR, mode); }
|
||||
basic_ifstream& operator= (basic_ifstream&& that)
|
||||
{
|
||||
*static_cast< base_type* >(this) = static_cast< base_type&& >(that);
|
||||
return *this;
|
||||
}
|
||||
#endif
|
||||
|
||||
virtual ~basic_ifstream() {}
|
||||
};
|
||||
BOOST_DELETED_FUNCTION(basic_ifstream(basic_ifstream const&))
|
||||
BOOST_DELETED_FUNCTION(basic_ifstream const& operator= (basic_ifstream const&))
|
||||
|
||||
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 charT, class traits = std::char_traits<charT> >
|
||||
class basic_ofstream : public std::basic_ofstream<charT,traits>
|
||||
{
|
||||
private: // disallow copying
|
||||
basic_ofstream(const basic_ofstream&);
|
||||
const basic_ofstream& operator=(const 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() {}
|
||||
public:
|
||||
BOOST_DEFAULTED_FUNCTION(basic_ofstream(), {})
|
||||
|
||||
// use two signatures, rather than one signature with default second
|
||||
// argument, to workaround VC++ 7.1 bug (ID VSWhidbey 38416)
|
||||
|
||||
explicit basic_ofstream(const path& p)
|
||||
: std::basic_ofstream<charT,traits>(p.BOOST_FILESYSTEM_C_STR, std::ios_base::out) {}
|
||||
explicit basic_ofstream(path const& p) :
|
||||
base_type(BOOST_FILESYSTEM_C_STR(p), std::ios_base::out) {}
|
||||
|
||||
basic_ofstream(const path& p, std::ios_base::openmode mode)
|
||||
: std::basic_ofstream<charT,traits>(p.BOOST_FILESYSTEM_C_STR, mode) {}
|
||||
basic_ofstream(path const& p, std::ios_base::openmode mode) :
|
||||
base_type(BOOST_FILESYSTEM_C_STR(p), mode) {}
|
||||
|
||||
void open(const path& p)
|
||||
{ std::basic_ofstream<charT,traits>::open(p.BOOST_FILESYSTEM_C_STR, std::ios_base::out); }
|
||||
#if !defined(BOOST_FILESYSTEM_DETAIL_NO_CXX11_MOVABLE_FSTREAMS)
|
||||
basic_ofstream(basic_ofstream&& that) :
|
||||
base_type(static_cast< base_type&& >(that)) {}
|
||||
|
||||
void open(const path& p, std::ios_base::openmode mode)
|
||||
{ std::basic_ofstream<charT,traits>::open(p.BOOST_FILESYSTEM_C_STR, mode); }
|
||||
basic_ofstream& operator= (basic_ofstream&& that)
|
||||
{
|
||||
*static_cast< base_type* >(this) = static_cast< base_type&& >(that);
|
||||
return *this;
|
||||
}
|
||||
#endif
|
||||
|
||||
virtual ~basic_ofstream() {}
|
||||
};
|
||||
BOOST_DELETED_FUNCTION(basic_ofstream(basic_ofstream const&))
|
||||
BOOST_DELETED_FUNCTION(basic_ofstream const& operator= (basic_ofstream const&))
|
||||
|
||||
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 charT, class traits = std::char_traits<charT> >
|
||||
class basic_fstream : public std::basic_fstream<charT,traits>
|
||||
{
|
||||
private: // disallow copying
|
||||
basic_fstream(const basic_fstream&);
|
||||
const basic_fstream & operator=(const 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() {}
|
||||
public:
|
||||
BOOST_DEFAULTED_FUNCTION(basic_fstream(), {})
|
||||
|
||||
// use two signatures, rather than one signature with default second
|
||||
// argument, to workaround VC++ 7.1 bug (ID VSWhidbey 38416)
|
||||
|
||||
explicit basic_fstream(const path& p)
|
||||
: std::basic_fstream<charT,traits>(p.BOOST_FILESYSTEM_C_STR,
|
||||
std::ios_base::in | std::ios_base::out) {}
|
||||
explicit basic_fstream(path const& p) :
|
||||
base_type(BOOST_FILESYSTEM_C_STR(p), std::ios_base::in | std::ios_base::out) {}
|
||||
|
||||
basic_fstream(const path& p, std::ios_base::openmode mode)
|
||||
: std::basic_fstream<charT,traits>(p.BOOST_FILESYSTEM_C_STR, mode) {}
|
||||
basic_fstream(path const& p, std::ios_base::openmode mode) :
|
||||
base_type(BOOST_FILESYSTEM_C_STR(p), mode) {}
|
||||
|
||||
void open(const path& p)
|
||||
{ std::basic_fstream<charT,traits>::open(p.BOOST_FILESYSTEM_C_STR,
|
||||
std::ios_base::in | std::ios_base::out); }
|
||||
#if !defined(BOOST_FILESYSTEM_DETAIL_NO_CXX11_MOVABLE_FSTREAMS)
|
||||
basic_fstream(basic_fstream&& that) :
|
||||
base_type(static_cast< base_type&& >(that)) {}
|
||||
|
||||
void open(const path& p, std::ios_base::openmode mode)
|
||||
{ std::basic_fstream<charT,traits>::open(p.BOOST_FILESYSTEM_C_STR, mode); }
|
||||
basic_fstream& operator= (basic_fstream&& that)
|
||||
{
|
||||
*static_cast< base_type* >(this) = static_cast< base_type&& >(that);
|
||||
return *this;
|
||||
}
|
||||
#endif
|
||||
|
||||
virtual ~basic_fstream() {}
|
||||
BOOST_DELETED_FUNCTION(basic_fstream(basic_fstream const&))
|
||||
BOOST_DELETED_FUNCTION(basic_fstream const& operator= (basic_fstream const&))
|
||||
|
||||
};
|
||||
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< 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;
|
||||
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
|
||||
@@ -188,5 +264,6 @@ namespace filesystem
|
||||
#pragma warning(pop)
|
||||
#endif
|
||||
|
||||
#include <boost/config/abi_suffix.hpp> // pops abi_prefix.hpp pragmas
|
||||
#endif // BOOST_FILESYSTEM3_FSTREAM_HPP
|
||||
#include <boost/filesystem/detail/footer.hpp>
|
||||
|
||||
#endif // BOOST_FILESYSTEM_FSTREAM_HPP
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@@ -1,6 +1,7 @@
|
||||
// filesystem path_traits.hpp --------------------------------------------------------//
|
||||
|
||||
// Copyright Beman Dawes 2009
|
||||
// Copyright Andrey Semashev 2022
|
||||
|
||||
// Distributed under the Boost Software License, Version 1.0.
|
||||
// See http://www.boost.org/LICENSE_1_0.txt
|
||||
@@ -10,343 +11,28 @@
|
||||
#ifndef BOOST_FILESYSTEM_PATH_TRAITS_HPP
|
||||
#define BOOST_FILESYSTEM_PATH_TRAITS_HPP
|
||||
|
||||
#include <boost/config.hpp>
|
||||
|
||||
# if defined( BOOST_NO_STD_WSTRING )
|
||||
# error Configuration not supported: Boost.Filesystem V3 and later requires std::wstring support
|
||||
# endif
|
||||
|
||||
#include <boost/filesystem/config.hpp>
|
||||
#include <boost/type_traits/is_array.hpp>
|
||||
#include <boost/type_traits/decay.hpp>
|
||||
#include <boost/system/error_code.hpp>
|
||||
#include <boost/core/enable_if.hpp>
|
||||
#include <cwchar> // for mbstate_t
|
||||
#include <string>
|
||||
#include <vector>
|
||||
#include <list>
|
||||
#include <iterator>
|
||||
#include <locale>
|
||||
#include <boost/assert.hpp>
|
||||
// #include <iostream> //**** comment me out ****
|
||||
|
||||
#include <boost/config/abi_prefix.hpp> // must be the last #include
|
||||
#if !defined(BOOST_FILESYSTEM_DEPRECATED) && !defined(BOOST_FILESYSTEM_ALLOW_DEPRECATED)
|
||||
#include <boost/config/header_deprecated.hpp>
|
||||
BOOST_HEADER_DEPRECATED("your own implementation")
|
||||
#endif
|
||||
|
||||
namespace boost { namespace filesystem {
|
||||
#if !defined(BOOST_FILESYSTEM_NO_DEPRECATED)
|
||||
|
||||
BOOST_FILESYSTEM_DECL const system::error_category& codecvt_error_category();
|
||||
// uses std::codecvt_base::result used for error codes:
|
||||
//
|
||||
// ok: Conversion successful.
|
||||
// partial: Not all source characters converted; one or more additional source
|
||||
// characters are needed to produce the final target character, or the
|
||||
// size of the target intermediate buffer was too small to hold the result.
|
||||
// error: A character in the source could not be converted to the target encoding.
|
||||
// noconv: The source and target characters have the same type and encoding, so no
|
||||
// conversion was necessary.
|
||||
#include <boost/filesystem/detail/path_traits.hpp>
|
||||
#include <boost/filesystem/detail/header.hpp> // must be the last #include
|
||||
|
||||
class directory_entry;
|
||||
namespace boost {
|
||||
namespace filesystem {
|
||||
|
||||
namespace path_traits {
|
||||
namespace path_traits = boost::filesystem::detail::path_traits;
|
||||
|
||||
typedef std::codecvt<wchar_t, char, std::mbstate_t> codecvt_type;
|
||||
} // namespace filesystem
|
||||
} // namespace boost
|
||||
|
||||
// is_pathable type trait; allows disabling over-agressive class path member templates
|
||||
#include <boost/filesystem/detail/footer.hpp>
|
||||
|
||||
template <class T>
|
||||
struct is_pathable { static const bool value = false; };
|
||||
#endif // !defined(BOOST_FILESYSTEM_NO_DEPRECATED)
|
||||
|
||||
template<> struct is_pathable<char*> { static const bool value = true; };
|
||||
template<> struct is_pathable<const char*> { static const bool value = true; };
|
||||
template<> struct is_pathable<wchar_t*> { static const bool value = true; };
|
||||
template<> struct is_pathable<const wchar_t*> { static const bool value = true; };
|
||||
template<> struct is_pathable<std::string> { static const bool value = true; };
|
||||
template<> struct is_pathable<std::wstring> { static const bool value = true; };
|
||||
template<> struct is_pathable<std::vector<char> > { static const bool value = true; };
|
||||
template<> struct is_pathable<std::vector<wchar_t> > { static const bool value = true; };
|
||||
template<> struct is_pathable<std::list<char> > { static const bool value = true; };
|
||||
template<> struct is_pathable<std::list<wchar_t> > { static const bool value = true; };
|
||||
template<> struct is_pathable<directory_entry> { static const bool value = true; };
|
||||
|
||||
// Pathable empty
|
||||
|
||||
template <class Container> inline
|
||||
// disable_if aids broken compilers (IBM, old GCC, etc.) and is harmless for
|
||||
// conforming compilers. Replace by plain "bool" at some future date (2012?)
|
||||
typename boost::disable_if<boost::is_array<Container>, bool>::type
|
||||
empty(const Container & c)
|
||||
{ return c.begin() == c.end(); }
|
||||
|
||||
template <class T> inline
|
||||
bool empty(T * const & c_str)
|
||||
{
|
||||
BOOST_ASSERT(c_str);
|
||||
return !*c_str;
|
||||
}
|
||||
|
||||
template <typename T, size_t N> inline
|
||||
bool empty(T (&x)[N])
|
||||
{ return !x[0]; }
|
||||
|
||||
// value types differ ---------------------------------------------------------------//
|
||||
//
|
||||
// A from_end argument of 0 is less efficient than a known end, so use only if needed
|
||||
|
||||
// with codecvt
|
||||
|
||||
BOOST_FILESYSTEM_DECL
|
||||
void convert(const char* from,
|
||||
const char* from_end, // 0 for null terminated MBCS
|
||||
std::wstring & to,
|
||||
const codecvt_type& cvt);
|
||||
|
||||
BOOST_FILESYSTEM_DECL
|
||||
void convert(const wchar_t* from,
|
||||
const wchar_t* from_end, // 0 for null terminated MBCS
|
||||
std::string & to,
|
||||
const codecvt_type& cvt);
|
||||
|
||||
inline
|
||||
void convert(const char* from,
|
||||
std::wstring & to,
|
||||
const codecvt_type& cvt)
|
||||
{
|
||||
BOOST_ASSERT(from);
|
||||
convert(from, 0, to, cvt);
|
||||
}
|
||||
|
||||
inline
|
||||
void convert(const wchar_t* from,
|
||||
std::string & to,
|
||||
const codecvt_type& cvt)
|
||||
{
|
||||
BOOST_ASSERT(from);
|
||||
convert(from, 0, to, cvt);
|
||||
}
|
||||
|
||||
// without codecvt
|
||||
|
||||
inline
|
||||
void convert(const char* from,
|
||||
const char* from_end, // 0 for null terminated MBCS
|
||||
std::wstring & to);
|
||||
|
||||
inline
|
||||
void convert(const wchar_t* from,
|
||||
const wchar_t* from_end, // 0 for null terminated MBCS
|
||||
std::string & to);
|
||||
|
||||
inline
|
||||
void convert(const char* from,
|
||||
std::wstring & to);
|
||||
|
||||
inline
|
||||
void convert(const wchar_t* from,
|
||||
std::string & to);
|
||||
|
||||
// value types same -----------------------------------------------------------------//
|
||||
|
||||
// char with codecvt
|
||||
|
||||
inline
|
||||
void convert(const char* from, const char* from_end, std::string & to,
|
||||
const codecvt_type&)
|
||||
{
|
||||
BOOST_ASSERT(from);
|
||||
BOOST_ASSERT(from_end);
|
||||
to.append(from, from_end);
|
||||
}
|
||||
|
||||
inline
|
||||
void convert(const char* from,
|
||||
std::string & to,
|
||||
const codecvt_type&)
|
||||
{
|
||||
BOOST_ASSERT(from);
|
||||
to += from;
|
||||
}
|
||||
|
||||
// wchar_t with codecvt
|
||||
|
||||
inline
|
||||
void convert(const wchar_t* from, const wchar_t* from_end, std::wstring & to,
|
||||
const codecvt_type&)
|
||||
{
|
||||
BOOST_ASSERT(from);
|
||||
BOOST_ASSERT(from_end);
|
||||
to.append(from, from_end);
|
||||
}
|
||||
|
||||
inline
|
||||
void convert(const wchar_t* from,
|
||||
std::wstring & to,
|
||||
const codecvt_type&)
|
||||
{
|
||||
BOOST_ASSERT(from);
|
||||
to += from;
|
||||
}
|
||||
|
||||
// char without codecvt
|
||||
|
||||
inline
|
||||
void convert(const char* from, const char* from_end, std::string & to)
|
||||
{
|
||||
BOOST_ASSERT(from);
|
||||
BOOST_ASSERT(from_end);
|
||||
to.append(from, from_end);
|
||||
}
|
||||
|
||||
inline
|
||||
void convert(const char* from, std::string & to)
|
||||
{
|
||||
BOOST_ASSERT(from);
|
||||
to += from;
|
||||
}
|
||||
|
||||
// wchar_t without codecvt
|
||||
|
||||
inline
|
||||
void convert(const wchar_t* from, const wchar_t* from_end, std::wstring & to)
|
||||
{
|
||||
BOOST_ASSERT(from);
|
||||
BOOST_ASSERT(from_end);
|
||||
to.append(from, from_end);
|
||||
}
|
||||
|
||||
inline
|
||||
void convert(const wchar_t* from, std::wstring & to)
|
||||
{
|
||||
BOOST_ASSERT(from);
|
||||
to += from;
|
||||
}
|
||||
|
||||
// Source dispatch -----------------------------------------------------------------//
|
||||
|
||||
// contiguous containers with codecvt
|
||||
template <class U> inline
|
||||
void dispatch(const std::string& c, U& to, const codecvt_type& cvt)
|
||||
{
|
||||
if (c.size())
|
||||
convert(&*c.begin(), &*c.begin() + c.size(), to, cvt);
|
||||
}
|
||||
template <class U> inline
|
||||
void dispatch(const std::wstring& c, U& to, const codecvt_type& cvt)
|
||||
{
|
||||
if (c.size())
|
||||
convert(&*c.begin(), &*c.begin() + c.size(), to, cvt);
|
||||
}
|
||||
template <class U> inline
|
||||
void dispatch(const std::vector<char>& c, U& to, const codecvt_type& cvt)
|
||||
{
|
||||
if (c.size())
|
||||
convert(&*c.begin(), &*c.begin() + c.size(), to, cvt);
|
||||
}
|
||||
template <class U> inline
|
||||
void dispatch(const std::vector<wchar_t>& c, U& to, const codecvt_type& cvt)
|
||||
{
|
||||
if (c.size())
|
||||
convert(&*c.begin(), &*c.begin() + c.size(), to, cvt);
|
||||
}
|
||||
|
||||
// contiguous containers without codecvt
|
||||
template <class U> inline
|
||||
void dispatch(const std::string& c, U& to)
|
||||
{
|
||||
if (c.size())
|
||||
convert(&*c.begin(), &*c.begin() + c.size(), to);
|
||||
}
|
||||
template <class U> inline
|
||||
void dispatch(const std::wstring& c, U& to)
|
||||
{
|
||||
if (c.size())
|
||||
convert(&*c.begin(), &*c.begin() + c.size(), to);
|
||||
}
|
||||
template <class U> inline
|
||||
void dispatch(const std::vector<char>& c, U& to)
|
||||
{
|
||||
if (c.size())
|
||||
convert(&*c.begin(), &*c.begin() + c.size(), to);
|
||||
}
|
||||
template <class U> inline
|
||||
void dispatch(const std::vector<wchar_t>& c, U& to)
|
||||
{
|
||||
if (c.size())
|
||||
convert(&*c.begin(), &*c.begin() + c.size(), to);
|
||||
}
|
||||
|
||||
// non-contiguous containers with codecvt
|
||||
template <class Container, class U> inline
|
||||
// disable_if aids broken compilers (IBM, old GCC, etc.) and is harmless for
|
||||
// conforming compilers. Replace by plain "void" at some future date (2012?)
|
||||
typename boost::disable_if<boost::is_array<Container>, void>::type
|
||||
dispatch(const Container & c, U& to, const codecvt_type& cvt)
|
||||
{
|
||||
if (c.size())
|
||||
{
|
||||
std::basic_string<typename Container::value_type> s(c.begin(), c.end());
|
||||
convert(s.c_str(), s.c_str()+s.size(), to, cvt);
|
||||
}
|
||||
}
|
||||
|
||||
// c_str
|
||||
template <class T, class U> inline
|
||||
void dispatch(T * const & c_str, U& to, const codecvt_type& cvt)
|
||||
{
|
||||
// std::cout << "dispatch() const T *\n";
|
||||
BOOST_ASSERT(c_str);
|
||||
convert(c_str, to, cvt);
|
||||
}
|
||||
|
||||
// Note: there is no dispatch on C-style arrays because the array may
|
||||
// contain a string smaller than the array size.
|
||||
|
||||
BOOST_FILESYSTEM_DECL
|
||||
void dispatch(const directory_entry & de,
|
||||
# ifdef BOOST_WINDOWS_API
|
||||
std::wstring & to,
|
||||
# else
|
||||
std::string & to,
|
||||
# endif
|
||||
const codecvt_type&);
|
||||
|
||||
// non-contiguous containers without codecvt
|
||||
template <class Container, class U> inline
|
||||
// disable_if aids broken compilers (IBM, old GCC, etc.) and is harmless for
|
||||
// conforming compilers. Replace by plain "void" at some future date (2012?)
|
||||
typename boost::disable_if<boost::is_array<Container>, void>::type
|
||||
dispatch(const Container & c, U& to)
|
||||
{
|
||||
if (c.size())
|
||||
{
|
||||
std::basic_string<typename Container::value_type> seq(c.begin(), c.end());
|
||||
convert(seq.c_str(), seq.c_str()+seq.size(), to);
|
||||
}
|
||||
}
|
||||
|
||||
// c_str
|
||||
template <class T, class U> inline
|
||||
void dispatch(T * const & c_str, U& to)
|
||||
{
|
||||
// std::cout << "dispatch() const T *\n";
|
||||
BOOST_ASSERT(c_str);
|
||||
convert(c_str, to);
|
||||
}
|
||||
|
||||
// Note: there is no dispatch on C-style arrays because the array may
|
||||
// contain a string smaller than the array size.
|
||||
|
||||
BOOST_FILESYSTEM_DECL
|
||||
void dispatch(const directory_entry & de,
|
||||
# ifdef BOOST_WINDOWS_API
|
||||
std::wstring & to
|
||||
# else
|
||||
std::string & to
|
||||
# endif
|
||||
);
|
||||
|
||||
|
||||
}}} // namespace boost::filesystem::path_traits
|
||||
|
||||
#include <boost/config/abi_suffix.hpp> // pops abi_prefix.hpp pragmas
|
||||
|
||||
#endif // BOOST_FILESYSTEM_PATH_TRAITS_HPP
|
||||
#endif // BOOST_FILESYSTEM_PATH_TRAITS_HPP
|
||||
|
||||
@@ -10,34 +10,61 @@
|
||||
#ifndef BOOST_FILESYSTEM_STRING_FILE_HPP
|
||||
#define BOOST_FILESYSTEM_STRING_FILE_HPP
|
||||
|
||||
#include <boost/filesystem/config.hpp>
|
||||
|
||||
#if !defined(BOOST_FILESYSTEM_DEPRECATED) && !defined(BOOST_FILESYSTEM_ALLOW_DEPRECATED)
|
||||
#include <boost/config/header_deprecated.hpp>
|
||||
BOOST_HEADER_DEPRECATED("your own implementation")
|
||||
#endif
|
||||
|
||||
#if !defined(BOOST_FILESYSTEM_NO_DEPRECATED)
|
||||
|
||||
#include <cstddef>
|
||||
#include <limits>
|
||||
#include <string>
|
||||
#include <ios>
|
||||
#include <stdexcept>
|
||||
#include <boost/cstdint.hpp>
|
||||
#include <boost/filesystem/path.hpp>
|
||||
#include <boost/filesystem/fstream.hpp>
|
||||
#include <boost/filesystem/operations.hpp>
|
||||
|
||||
namespace boost
|
||||
#include <boost/filesystem/detail/header.hpp> // must be the last #include
|
||||
|
||||
namespace boost {
|
||||
namespace filesystem {
|
||||
|
||||
BOOST_FILESYSTEM_DETAIL_DEPRECATED("Use file IO streams instead")
|
||||
inline void save_string_file(path const& p, std::string const& str)
|
||||
{
|
||||
namespace filesystem
|
||||
{
|
||||
inline
|
||||
void save_string_file(const path& p, const std::string& str)
|
||||
{
|
||||
filesystem::ofstream file;
|
||||
file.exceptions(std::ofstream::failbit | std::ofstream::badbit);
|
||||
file.open(p, std::ios_base::binary);
|
||||
file.write(str.c_str(), str.size());
|
||||
filesystem::ofstream file;
|
||||
file.exceptions(std::ios_base::failbit | std::ios_base::badbit);
|
||||
file.open(p, std::ios_base::binary);
|
||||
const std::size_t sz = str.size();
|
||||
if (BOOST_UNLIKELY(sz > static_cast< boost::uintmax_t >((std::numeric_limits< std::streamsize >::max)())))
|
||||
BOOST_FILESYSTEM_THROW(std::length_error("String size exceeds max write size"));
|
||||
file.write(str.c_str(), static_cast< std::streamsize >(sz));
|
||||
}
|
||||
|
||||
inline
|
||||
void load_string_file(const path& p, std::string& str)
|
||||
BOOST_FILESYSTEM_DETAIL_DEPRECATED("Use file IO streams instead")
|
||||
inline void load_string_file(path const& p, std::string& str)
|
||||
{
|
||||
filesystem::ifstream file;
|
||||
file.exceptions(std::ifstream::failbit | std::ifstream::badbit);
|
||||
file.open(p, std::ios_base::binary);
|
||||
std::size_t sz = static_cast<std::size_t>(filesystem::file_size(p));
|
||||
str.resize(sz, '\0');
|
||||
file.read(&str[0], sz);
|
||||
filesystem::ifstream file;
|
||||
file.exceptions(std::ios_base::failbit | std::ios_base::badbit);
|
||||
file.open(p, std::ios_base::binary);
|
||||
const boost::uintmax_t sz = filesystem::file_size(p);
|
||||
if (BOOST_UNLIKELY(sz > static_cast< boost::uintmax_t >((std::numeric_limits< std::streamsize >::max)())))
|
||||
BOOST_FILESYSTEM_THROW(std::length_error("File size exceeds max read size"));
|
||||
str.resize(static_cast< std::size_t >(sz), '\0');
|
||||
if (sz > 0u)
|
||||
file.read(&str[0], static_cast< std::streamsize >(sz));
|
||||
}
|
||||
} // namespace filesystem
|
||||
} // namespace boost
|
||||
|
||||
#endif // include guard
|
||||
} // namespace filesystem
|
||||
} // namespace boost
|
||||
|
||||
#include <boost/filesystem/detail/footer.hpp>
|
||||
|
||||
#endif // !defined(BOOST_FILESYSTEM_NO_DEPRECATED)
|
||||
|
||||
#endif // BOOST_FILESYSTEM_STRING_FILE_HPP
|
||||
|
||||
Reference in New Issue
Block a user