From be82eff28976e05f9c8e95bd44c46903eac2a2e1 Mon Sep 17 00:00:00 2001 From: Andrey Semashev Date: Wed, 4 Oct 2023 19:37:03 +0300 Subject: [PATCH] Removed string_file.hpp that was deprecated in 1.79.0. --- doc/deprecated.html | 10 --- doc/release_history.html | 1 + example/Jamfile.v2 | 1 - .../directory_symlink_parent_resolution.cpp | 42 ----------- include/boost/filesystem.hpp | 3 - include/boost/filesystem/string_file.hpp | 70 ------------------- test/deprecated_test.cpp | 17 ----- 7 files changed, 1 insertion(+), 143 deletions(-) delete mode 100644 example/directory_symlink_parent_resolution.cpp delete mode 100644 include/boost/filesystem/string_file.hpp diff --git a/doc/deprecated.html b/doc/deprecated.html index 2b5260a3c..939a8eb15 100644 --- a/doc/deprecated.html +++ b/doc/deprecated.html @@ -395,16 +395,6 @@

Deprecated names and features

The workaround is to include the new headers or filesystem.hpp. The new headers are still included by operations.hpp if BOOST_FILESYSTEM_NO_DEPRECATED is not defined. - - - string_file.hpp - - The header provides utility functions for loading and saving a string to/from file. - - ✔ - - The header is deprecated, use a different implementation of these functions. Unavailable if BOOST_FILESYSTEM_NO_DEPRECATED is defined and will be permanently removed in a future release. - path_traits.hpp diff --git a/doc/release_history.html b/doc/release_history.html index f807d03d2..345d25c68 100644 --- a/doc/release_history.html +++ b/doc/release_history.html @@ -45,6 +45,7 @@

1.84.0

  • Fixed that some directory_entry observers taking error_code& ec argument did not clear the error code on successful return. (#291)
  • On Windows, improved robustness of date and time conversion and added support for dates before January 1, 1970. (#293)
  • Removed support for Windows CE that was deprecated since Boost.Filesystem 1.79.0.
  • +
  • Removed boost/filesystem/string_file.hpp header. The header was deprecated since Boost.Filesystem 1.79.0.
  • 1.83.0

    diff --git a/example/Jamfile.v2 b/example/Jamfile.v2 index f047cf3df..e1380e429 100644 --- a/example/Jamfile.v2 +++ b/example/Jamfile.v2 @@ -22,7 +22,6 @@ exe tut5 : tut5.cpp ; exe path_info : path_info.cpp : 11 ; exe file_status : file_status.cpp ; exe file_size : file_size.cpp ; -exe directory_symlink_parent_resolution : directory_symlink_parent_resolution.cpp ; exe simple_ls : simple_ls.cpp ; install tut1-copy : tut1 : . ; diff --git a/example/directory_symlink_parent_resolution.cpp b/example/directory_symlink_parent_resolution.cpp deleted file mode 100644 index a15bbdb4c..000000000 --- a/example/directory_symlink_parent_resolution.cpp +++ /dev/null @@ -1,42 +0,0 @@ -// directory_symlink_parent_resolution.cpp -------------------------------------------// - -// Copyright Beman Dawes 2015 - -// 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 - -#include -#include -#include -#include -#include - -using std::cout; -using std::endl; -using namespace boost::filesystem; - -int cpp_main(int argc, char* argv[]) -{ -#ifdef BOOST_WINDOWS_API - cout << "BOOST_WINDOWS_API" << endl; -#else - cout << "BOOST_POSIX_API" << endl; -#endif - - path test_dir(current_path() / "dspr_demo"); - - remove_all(test_dir); - create_directories(test_dir / "a/c/d"); - current_path(test_dir / "a"); - create_directory_symlink("c/d", "b"); - save_string_file("name.txt", "Windows"); - save_string_file("c/name.txt", "POSIX"); - current_path(test_dir); - std::string s; - load_string_file("a/b/../name.txt", s); - cout << s << endl; - - return 0; -} diff --git a/include/boost/filesystem.hpp b/include/boost/filesystem.hpp index 36bf9071a..8b1480024 100644 --- a/include/boost/filesystem.hpp +++ b/include/boost/filesystem.hpp @@ -19,8 +19,5 @@ #include #include #include -#if defined(BOOST_FILESYSTEM_DEPRECATED) -#include -#endif #endif // BOOST_FILESYSTEM_FILESYSTEM_HPP diff --git a/include/boost/filesystem/string_file.hpp b/include/boost/filesystem/string_file.hpp deleted file mode 100644 index 29428c8cf..000000000 --- a/include/boost/filesystem/string_file.hpp +++ /dev/null @@ -1,70 +0,0 @@ -// filesystem/string_file.hpp --------------------------------------------------------// - -// Copyright Beman Dawes 2015 - -// 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_STRING_FILE_HPP -#define BOOST_FILESYSTEM_STRING_FILE_HPP - -#include - -#if !defined(BOOST_FILESYSTEM_DEPRECATED) && !defined(BOOST_FILESYSTEM_ALLOW_DEPRECATED) -#include -BOOST_HEADER_DEPRECATED("your own implementation") -#endif - -#if !defined(BOOST_FILESYSTEM_NO_DEPRECATED) - -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include // 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) -{ - 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)); -} - -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::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 - -#include - -#endif // !defined(BOOST_FILESYSTEM_NO_DEPRECATED) - -#endif // BOOST_FILESYSTEM_STRING_FILE_HPP diff --git a/test/deprecated_test.cpp b/test/deprecated_test.cpp index 7b11496ad..3b621adb2 100644 --- a/test/deprecated_test.cpp +++ b/test/deprecated_test.cpp @@ -15,7 +15,6 @@ #define BOOST_FILESYSTEM_ALLOW_DEPRECATED #include -#include #include #include @@ -211,21 +210,6 @@ void path_rename_test() } } -// string_file_tests ---------------------------------------------------------------// - -void string_file_tests(const fs::path& temp_dir) -{ - std::cout << "string_file_tests..." << std::endl; - std::string contents("0123456789"); - fs::path p(temp_dir / "string_file"); - save_string_file(p, contents); - save_string_file(p, contents); - BOOST_TEST_EQ(file_size(p), 10u); - std::string round_trip; - load_string_file(p, round_trip); - BOOST_TEST_EQ(contents, round_trip); -} - } // unnamed namespace //--------------------------------------------------------------------------------------// @@ -295,7 +279,6 @@ int cpp_main(int /*argc*/, char* /*argv*/[]) path_container_ctor_test(); path_rename_test(); normalize_test(); - string_file_tests(temp_dir); BOOST_TEST(fs::path("foo/bar").generic() == fs::path("foo/bar"));