inline boost::filesystem into std::filesystem

This commit is contained in:
qPCR4vir 2019-11-05 19:29:30 +01:00
parent babcdb477d
commit 597f6c05cd

View File

@ -9,7 +9,7 @@
*
* @file nana/filesystem/filesystem.hpp
* @author Ariel Vina-Rodriguez, Jinhao
* @brief Mimic std::experimental::filesystem::v1 (boost v3)
* @brief Mimic std::filesystem
* and need VC2015 or a C++11 compiler. With a few correction can be compiler by VC2013
*/
@ -34,12 +34,6 @@
//Filesystem Selection
#include <nana/config.hpp>
#if defined(NANA_USING_NANA_FILESYSTEM) || defined(NANA_USING_STD_FILESYSTEM) || defined(NANA_USING_BOOST_FILESYSTEM)
#undef NANA_USING_NANA_FILESYSTEM
#undef NANA_USING_STD_FILESYSTEM
#undef NANA_USING_BOOST_FILESYSTEM
#endif
#define NANA_USING_NANA_FILESYSTEM 0
#define NANA_USING_STD_FILESYSTEM 0
#define NANA_USING_BOOST_FILESYSTEM 0
@ -50,16 +44,15 @@
#define NANA_USING_NANA_FILESYSTEM 1
#elif (defined(BOOST_FILESYSTEM_AVAILABLE) && ( defined(BOOST_FILESYSTEM_FORCE) || ( defined(STD_FILESYSTEM_NOT_SUPPORTED) && !defined(STD_FILESYSTEM_FORCE) ) ))
#undef NANA_USING_BOOST_FILESYSTEM
#define NANA_USING_BOOST_FILESYSTEM 1
# include <chrono>
# include <boost/filesystem.hpp>
// add boost::filesystem into std::experimental::filesystem
// inline boost::filesystem into std::filesystem
namespace std {
namespace experimental {
namespace filesystem {
inline namespace boost_filesystem {
using namespace boost::filesystem;
using file_time_type = std::chrono::time_point<std::chrono::system_clock>;
@ -75,16 +68,16 @@ namespace std {
socket = boost::filesystem::file_type::socket_file,
unknown = boost::filesystem::file_type::type_unknown,
};
// Boost dont include generic_u8string
// http://www.boost.org/doc/libs/1_66_0/boost/filesystem/path.hpp
//
// Boost versions: 1.67.0, 1.66.0, ... 1.56.0 enable directory_iterator C++11 range-base for
// http://www.boost.org/doc/libs/1_66_0/boost/filesystem/operations.hpp
// but travis come with an oooold version of boost
// 1.55.0 NOT enable directory_iterator C++11 range-base for
// http://www.boost.org/doc/libs/1_54_0/boost/filesystem/operations.hpp
#if BOOST_VERSION < 105600
namespace boost
// Boost dont include generic_u8string
// http://www.boost.org/doc/libs/1_66_0/boost/filesystem/path.hpp
//
// Boost versions: 1.67.0, 1.66.0, ... 1.56.0 enable directory_iterator C++11 range-base for
// http://www.boost.org/doc/libs/1_66_0/boost/filesystem/operations.hpp
// but travis come with an oooold version of boost
// 1.55.0 NOT enable directory_iterator C++11 range-base for
// http://www.boost.org/doc/libs/1_54_0/boost/filesystem/operations.hpp
#if BOOST_VERSION < 105600
namespace boost { // todo ??
// enable directory_iterator C++11 range-base for statement use --------------------//
// begin() and end() are only used by a range-based for statement in the context of
@ -99,19 +92,10 @@ namespace std {
{
return directory_iterator();
}
#endif
} // filesystem
} // experimental
namespace filesystem
{
using namespace experimental::filesystem;
}
#ifndef __cpp_lib_experimental_filesystem
# define __cpp_lib_experimental_filesystem 201406
#endif
#endif
} // boost_filesystem
} // filesystem
} // std
#else