diff --git a/include/caosdb/certificate_provider.h b/include/caosdb/certificate_provider.h index e7d7a156efeaf05435fd3ccb8029549a82e38442..1fd4a80b630e53b8b704b29f7803837a3cff6ced 100644 --- a/include/caosdb/certificate_provider.h +++ b/include/caosdb/certificate_provider.h @@ -22,9 +22,9 @@ #ifndef CAOSDB_CERTIFICATE_PROVIDER_H #define CAOSDB_CERTIFICATE_PROVIDER_H -#include "boost/filesystem/path.hpp" // for path +#include <filesystem> // for path namespace caosdb::configuration { -using boost::filesystem::path; +using std::filesystem::path; class CertificateProvider { public: diff --git a/include/caosdb/configuration.h b/include/caosdb/configuration.h index 2c521e7b0f36c351dabd6f7341ea3bb393fd402c..be51bab1ac3152b035857929c6c6f9844f630d78 100644 --- a/include/caosdb/configuration.h +++ b/include/caosdb/configuration.h @@ -21,11 +21,9 @@ #ifndef CAOSDB_CONFIGURATION_H #define CAOSDB_CONFIGURATION_H -#include "boost/filesystem/operations.hpp" // for exists -#include "boost/filesystem/path.hpp" // for path -#include "boost/json/object.hpp" // for object -#include "boost/json/value.hpp" // for value -#include "boost/json/value_ref.hpp" // IWYU pragma: keep +#include "boost/json/object.hpp" // for object +#include "boost/json/value.hpp" // for value +#include "boost/json/value_ref.hpp" // IWYU pragma: keep // IWYU pragma: no_include "boost/json/fwd.hpp" #include "caosdb/authentication.h" // for Authenticator, PlainPassw... #include "caosdb/certificate_provider.h" // for CertificateProvider, path @@ -34,12 +32,11 @@ #include "caosdb/utility.h" // for load_json_file #include "grpcpp/security/credentials.h" // for ChannelCredentials #include <iosfwd> // for ostream +#include <filesystem> // for exists #include <memory> // for unique_ptr, shared_ptr #include <string> // for string namespace caosdb::configuration { -using boost::filesystem::exists; -using boost::filesystem::path; using boost::json::array; using boost::json::object; using boost::json::value; @@ -48,6 +45,8 @@ using caosdb::authentication::PlainPasswordAuthenticator; using caosdb::exceptions::ConfigurationError; using caosdb::utility::load_json_file; using grpc::ChannelCredentials; +using std::filesystem::exists; +using std::filesystem::path; const std::string logger_name = "caosdb::configuration"; diff --git a/include/caosdb/connection.h b/include/caosdb/connection.h index d3ed0945e0022f29e6097fb4ea2d9207c3258987..f9aaa8b56c4029f7809f32776a1e607525c8661c 100644 --- a/include/caosdb/connection.h +++ b/include/caosdb/connection.h @@ -27,10 +27,6 @@ * @date 2021-05-18 * @brief Configuration and setup of the connection. */ -#include <map> // for map -#include <memory> // for shared_ptr, unique_ptr -#include <string> // for string, basic_string -#include "boost/filesystem/path.hpp" // for path #include "caosdb/authentication.h" // for Authenticator #include "caosdb/configuration.h" // for ConnectionConfigura... #include "caosdb/entity/v1alpha1/main.grpc.pb.h" // for EntityTransactionSe... @@ -39,9 +35,12 @@ #include "caosdb/transaction.h" // for Transaction #include "caosdb/transaction_status.h" // for TransactionStatus #include "grpcpp/channel.h" // for Channel +#include <filesystem> // for path +#include <map> // for map +#include <memory> // for shared_ptr, unique_ptr +#include <string> // for string, basic_string namespace caosdb::connection { -using boost::filesystem::path; using caosdb::authentication::Authenticator; using caosdb::configuration::ConnectionConfiguration; using caosdb::entity::v1alpha1::EntityTransactionService; @@ -50,6 +49,7 @@ using caosdb::info::VersionInfo; using caosdb::info::v1alpha1::GeneralInfoService; using caosdb::transaction::Transaction; using caosdb::transaction::TransactionStatus; +using std::filesystem::path; /** * @brief A reusable connection to a CaosDBServer. diff --git a/include/caosdb/entity.h b/include/caosdb/entity.h index 6de939c37f19d9419815dcb8b7001fd19050133f..3e24624a79bff94e72b7398b01b562f962c426ef 100644 --- a/include/caosdb/entity.h +++ b/include/caosdb/entity.h @@ -36,14 +36,13 @@ #include "caosdb/protobuf_helper.h" // for get_arena #include "caosdb/status_code.h" // for StatusCode #include "caosdb/value.h" // for Value -#include <boost/filesystem/operations.hpp> // for exists, is_di... -#include <boost/filesystem/path.hpp> // for path #include <boost/log/core/record.hpp> // for record #include <boost/log/detail/attachable_sstream_buf.hpp> // for basic_ostring... #include <boost/log/sources/record_ostream.hpp> // for basic_record_... #include <boost/preprocessor/seq/limits/enum_256.hpp> // for BOOST_PP_SEQ_... #include <boost/preprocessor/seq/limits/size_256.hpp> // for BOOST_PP_SEQ_... #include <cstdint> // for int64_t +#include <filesystem> // for path #include <google/protobuf/message.h> // for RepeatedPtrField #include <iosfwd> // for streamsize #include <iterator> // for iterator, output_iterato... @@ -55,9 +54,9 @@ #include <utility> // for move namespace caosdb::entity { -using boost::filesystem::exists; -using boost::filesystem::is_directory; using caosdb::entity::v1alpha1::IdResponse; +using std::filesystem::exists; +using std::filesystem::is_directory; using ProtoParent = caosdb::entity::v1alpha1::Parent; using ProtoProperty = caosdb::entity::v1alpha1::Property; using ProtoEntity = caosdb::entity::v1alpha1::Entity; @@ -113,7 +112,7 @@ const std::map<Role, std::string> role_names = {{Role::UNSPECIFIED, "UNSPECIFIED struct FileDescriptor { FileTransmissionId *file_transmission_id; ProtoFileDescriptor *wrapped; - boost::filesystem::path local_path; + std::filesystem::path local_path; }; /** @@ -756,11 +755,11 @@ public: inline auto GetFileDescriptor() -> FileDescriptor & { return this->file_descriptor; } - inline auto GetLocalPath() const noexcept -> const boost::filesystem::path & { + inline auto GetLocalPath() const noexcept -> const std::filesystem::path & { return this->file_descriptor.local_path; } - inline auto SetLocalPath(const boost::filesystem::path &local_path) noexcept -> StatusCode { + inline auto SetLocalPath(const std::filesystem::path &local_path) noexcept -> StatusCode { if (GetRole() != Role::FILE) { CAOSDB_LOG_WARN(logger_name) << "Entity::SetLocalPath failed. This is not a file entity."; return StatusCode::NOT_A_FILE_ENTITY; diff --git a/include/caosdb/file_transmission/file_reader.h b/include/caosdb/file_transmission/file_reader.h index 67c1247fa97cc43e28064b4e0da81812f41b231a..2c52f17c6188d76cf06bbc275afa100cab179e51 100644 --- a/include/caosdb/file_transmission/file_reader.h +++ b/include/caosdb/file_transmission/file_reader.h @@ -49,20 +49,18 @@ #ifndef CAOSDB_FILE_TRANSMISSION_FILE_READER_H #define CAOSDB_FILE_TRANSMISSION_FILE_READER_H -#include <boost/filesystem/fstream.hpp> // for ifstream -#include <boost/filesystem/operations.hpp> // for exists -#include <boost/filesystem/path.hpp> // for path -#include <fstream> // for ifstream, size_t -#include <string> // for string +#include <filesystem> // for ifstream +#include <fstream> // for ifstream, size_t +#include <string> // for string namespace caosdb::transaction { -using boost::filesystem::exists; -using boost::filesystem::ifstream; -using boost::filesystem::path; +using std::ifstream; +using std::filesystem::exists; +using std::filesystem::path; class FileReader final { public: - FileReader(boost::filesystem::path filename); + FileReader(std::filesystem::path filename); ~FileReader() = default; @@ -80,7 +78,7 @@ private: void openFile(); std::ifstream stream_; - boost::filesystem::path filename_; + std::filesystem::path filename_; unsigned long long size_; }; diff --git a/include/caosdb/file_transmission/file_writer.h b/include/caosdb/file_transmission/file_writer.h index 801d74b9547951d2a3b86ed4b333bfb4b7035aa9..165178b1e3b44f9d3208220d1422af1bb61d0833 100644 --- a/include/caosdb/file_transmission/file_writer.h +++ b/include/caosdb/file_transmission/file_writer.h @@ -49,15 +49,15 @@ #ifndef CAOSDB_FILE_TRANSMISSION_FILE_WRITER_H #define CAOSDB_FILE_TRANSMISSION_FILE_WRITER_H -#include <boost/filesystem/path.hpp> // for path -#include <fstream> // for ofstream -#include <string> // for string +#include <filesystem> // for path +#include <fstream> // for ofstream +#include <string> // for string namespace caosdb::transaction { class FileWriter final { public: - FileWriter(boost::filesystem::path filename); + FileWriter(std::filesystem::path filename); ~FileWriter() = default; @@ -73,7 +73,7 @@ private: void openFile(); std::ofstream stream_; - boost::filesystem::path filename_; + std::filesystem::path filename_; }; } // namespace caosdb::transaction diff --git a/include/caosdb/utility.h b/include/caosdb/utility.h index 5af1b491c0b5b9d48606ba6b46130b3ef3de1d9c..2822e0c2538cbd91005ca73e6a325be3dde78e31 100644 --- a/include/caosdb/utility.h +++ b/include/caosdb/utility.h @@ -25,28 +25,26 @@ #include "caosdb/entity.h" // for Importance, Role #include <boost/beast/core/detail/base64.hpp> // for encoded_size #include <boost/beast/core/detail/base64.ipp> // for encode -#include <boost/filesystem/operations.hpp> // for exists -#include <boost/filesystem/path.hpp> // for path -#include <boost/filesystem/fstream.hpp> // for basic_ifstream, ifstream -#include <boost/filesystem/string_file.hpp> // for load_string_file -#include <boost/json/stream_parser.hpp> // for stream_parser -#include <boost/json/value.hpp> // for value -#include <boost/lexical_cast.hpp> // for lexical_cast -#include <cassert> // for assert -#include <cstdlib> // for getenv -#include <fstream> // for basic_istream<>::__ist... -#include <memory> // for allocator, unique_ptr -#include <stdexcept> // for logic_error -#include <string> // for string, operator+, cha... -#include <type_traits> // for underlying_type_t -#include <typeinfo> // for type_info +#include <boost/filesystem.hpp> +#include <boost/json/stream_parser.hpp> // for stream_parser +#include <boost/json/value.hpp> // for value +#include <boost/lexical_cast.hpp> // for lexical_cast +#include <cassert> // for assert +#include <cstdlib> // for getenv +#include <filesystem> // for path +#include <fstream> // for basic_istream<>::__ist... +#include <memory> // for allocator, unique_ptr +#include <stdexcept> // for logic_error +#include <string> // for string, operator+, cha... +#include <type_traits> // for underlying_type_t +#include <typeinfo> // for type_info namespace caosdb::utility { -using boost::filesystem::exists; -using boost::filesystem::ifstream; -using boost::filesystem::path; using boost::json::stream_parser; using boost::json::value; +using std::ifstream; +using std::filesystem::exists; +using std::filesystem::path; /** * @brief Get the name of the enum value. May be useful for higher-order CaosDB clients. @@ -86,9 +84,9 @@ auto getEnumValueFromName<caosdb::entity::Role>(const std::string &name) -> caos /** * @brief Read a text file into a string and return the file's content. */ -inline auto load_string_file(const path &path) -> std::string { +inline auto load_string_file(const std::string &file_path) -> std::string { std::string result; - boost::filesystem::load_string_file(path, result); + boost::filesystem::load_string_file(file_path, result); return result; } diff --git a/src/caosdb/configuration.cpp b/src/caosdb/configuration.cpp index edce302e00bcb5645d734e2ff577be23d0a8bd67..b08046d5ff687220ddfc4fa6c2cefc2e876f0900 100644 --- a/src/caosdb/configuration.cpp +++ b/src/caosdb/configuration.cpp @@ -47,8 +47,6 @@ #include <string> // for string, operator+ namespace caosdb::configuration { -using boost::filesystem::exists; -using boost::filesystem::path; using boost::json::object; using boost::json::value; using caosdb::authentication::Authenticator; @@ -66,6 +64,8 @@ using caosdb::utility::load_string_file; using grpc::InsecureChannelCredentials; using grpc::SslCredentials; using grpc::SslCredentialsOptions; +using std::filesystem::exists; +using std::filesystem::path; PemFileCertificateProvider::PemFileCertificateProvider(const path &path) { this->certificate_provider = load_string_file(path); diff --git a/src/caosdb/file_transmission/download_request_handler.cpp b/src/caosdb/file_transmission/download_request_handler.cpp index cbe79e93eb89261d1d85484cf39f4ad5deecba18..5887e53641d5a49c3670294f19517e3e55a954e2 100644 --- a/src/caosdb/file_transmission/download_request_handler.cpp +++ b/src/caosdb/file_transmission/download_request_handler.cpp @@ -51,7 +51,6 @@ #include "caosdb/protobuf_helper.h" // for get_arena #include "caosdb/status_code.h" // for GENERIC_RPC_E... #include "caosdb/transaction_status.h" // for TransactionStatus -#include <boost/filesystem/path.hpp> // for operator<<, path #include <boost/log/core/record.hpp> // for record #include <boost/log/detail/attachable_sstream_buf.hpp> // for basic_ostring... #include <boost/log/sources/record_ostream.hpp> // for basic_record_... @@ -59,6 +58,7 @@ #include <boost/preprocessor/seq/limits/size_256.hpp> // for BOOST_PP_SEQ_... #include <exception> // IWYU pragma: keep // IWYU pragma: no_include <bits/exception.h> +#include <filesystem> // for operator<<, path #include <google/protobuf/arena.h> // for Arena #include <grpcpp/impl/codegen/async_stream.h> // for ClientAsyncRe... #include <grpcpp/impl/codegen/client_context.h> // for ClientContext diff --git a/src/caosdb/file_transmission/file_reader.cpp b/src/caosdb/file_transmission/file_reader.cpp index f118eca01c6d17975684a15de56eb7c693fdc117..3d08f5d8ad1a2d5b012086cf9f75e52327d9dfda 100644 --- a/src/caosdb/file_transmission/file_reader.cpp +++ b/src/caosdb/file_transmission/file_reader.cpp @@ -48,13 +48,12 @@ */ #include "caosdb/file_transmission/file_reader.h" #include "caosdb/file_transmission/file_error.h" // for FileIOError -#include <boost/filesystem/path.hpp> // for path +#include <filesystem> // for path #include <utility> // for move namespace caosdb::transaction { -FileReader::FileReader(boost::filesystem::path filename) - : filename_(std::move(filename)), size_(0) { +FileReader::FileReader(std::filesystem::path filename) : filename_(std::move(filename)), size_(0) { this->openFile(); } diff --git a/src/caosdb/file_transmission/file_writer.cpp b/src/caosdb/file_transmission/file_writer.cpp index 5cf7d3a798942fc2ab9a3fe4a278b0e29d362f6e..3f49ea43df85a54fd3dec6c5c8125be46b43d676 100644 --- a/src/caosdb/file_transmission/file_writer.cpp +++ b/src/caosdb/file_transmission/file_writer.cpp @@ -48,12 +48,12 @@ */ #include "caosdb/file_transmission/file_writer.h" #include "caosdb/file_transmission/file_error.h" // for FileIOError -#include <boost/filesystem/path.hpp> // for path +#include <filesystem> // for path #include <utility> // for move namespace caosdb::transaction { -FileWriter::FileWriter(boost::filesystem::path filename) : filename_(std::move(filename)) { +FileWriter::FileWriter(std::filesystem::path filename) : filename_(std::move(filename)) { this->openFile(); } diff --git a/src/caosdb/file_transmission/upload_request_handler.cpp b/src/caosdb/file_transmission/upload_request_handler.cpp index bc74391753a0c7c3dce01f80d8fa67acc9e782cd..f43448e4d4d7a0c0e75a6ebf02b14a6b98cd5b79 100644 --- a/src/caosdb/file_transmission/upload_request_handler.cpp +++ b/src/caosdb/file_transmission/upload_request_handler.cpp @@ -52,7 +52,6 @@ #include "caosdb/status_code.h" // for GENERIC_RPC_E... #include "caosdb/transaction_status.h" // for TransactionStatus #include <algorithm> // for min -#include <boost/filesystem/path.hpp> // for operator<<, path #include <boost/log/core/record.hpp> // for record #include <boost/log/detail/attachable_sstream_buf.hpp> // for basic_ostring... #include <boost/log/sources/record_ostream.hpp> // for basic_record_... @@ -61,6 +60,7 @@ #include <cstdint> // for uint64_t #include <exception> // IWYU pragma: keep // IWYU pragma: no_include <bits/exception.h> +#include <filesystem> // for operator<<, path #include <google/protobuf/arena.h> // for Arena #include <grpcpp/impl/codegen/async_stream.h> // for ClientAsyncWr... #include <grpcpp/impl/codegen/call_op_set.h> // for WriteOptions diff --git a/src/caosdb/transaction.cpp b/src/caosdb/transaction.cpp index 637112d8b85df957a59718899a93ce220348fd75..416d36fc82573b096d9b88adb68dbb367281520e 100644 --- a/src/caosdb/transaction.cpp +++ b/src/caosdb/transaction.cpp @@ -28,7 +28,6 @@ #include "caosdb/status_code.h" // for StatusCode #include "caosdb/transaction_handler.h" // for EntityTransactionHandler #include <algorithm> // for max -#include <boost/filesystem/path.hpp> // for operator<<, path #include <boost/log/core/record.hpp> // for record #include <boost/log/detail/attachable_sstream_buf.hpp> // for basic_ostring... #include <boost/log/sources/record_ostream.hpp> // for basic_record_... @@ -36,6 +35,7 @@ #include <boost/preprocessor/seq/limits/size_256.hpp> // for BOOST_PP_SEQ_... // IWYU pragma: no_include <bits/exception.h> #include <exception> // IWYU pragma: keep +#include <filesystem> // for operator<<, path #include <google/protobuf/arena.h> // for Arena #include <grpc/impl/codegen/gpr_types.h> // for gpr_timespec #include <grpcpp/impl/codegen/completion_queue.h> // for CompletionQueue diff --git a/src/ccaosdb.cpp b/src/ccaosdb.cpp index 77759fce1d216f215dfccd343aa8202b2ec911fa..d33d74eb28494b8961eccfd637dfa3b71fa8e8da 100644 --- a/src/ccaosdb.cpp +++ b/src/ccaosdb.cpp @@ -1115,7 +1115,7 @@ ERROR_RETURN_CODE(GENERIC_ERROR, }) CAOSDB_ENTITY_SET(name, name, wrapped_entity->SetName(std::string(name));) CAOSDB_ENTITY_SET(local_path, local_path, - return wrapped_entity->SetLocalPath(boost::filesystem::path(local_path));) + return wrapped_entity->SetLocalPath(std::filesystem::path(local_path));) CAOSDB_ENTITY_SET(file_path, file_path, wrapped_entity->SetFilePath(std::string(file_path));) CAOSDB_ENTITY_SET(description, description, wrapped_entity->SetDescription(std::string(description));) diff --git a/test/test_file_transmission.cpp b/test/test_file_transmission.cpp index 7c5eb745e8f451b0282fa844510dc71ad402ed18..7903c917f62187b86f9162c6b2f59220e11837b6 100644 --- a/test/test_file_transmission.cpp +++ b/test/test_file_transmission.cpp @@ -19,15 +19,13 @@ */ #include "caosdb/file_transmission/file_writer.h" #include "caosdb/file_transmission/file_reader.h" -#include <boost/filesystem/operations.hpp> // for exists, file_size, remove -#include <boost/filesystem/path.hpp> // for path -#include <boost/filesystem/path_traits.hpp> // for filesystem -#include <gtest/gtest-message.h> // for Message -#include <gtest/gtest-test-part.h> // for TestPartResult, SuiteApiResolver -#include <gtest/gtest_pred_impl.h> // for Test, EXPECT_EQ, AssertionResult -#include <string> // for string - -namespace fs = boost::filesystem; +#include <filesystem> // for path +#include <gtest/gtest-message.h> // for Message +#include <gtest/gtest-test-part.h> // for TestPartResult, SuiteApiResolver +#include <gtest/gtest_pred_impl.h> // for Test, EXPECT_EQ, AssertionResult +#include <string> // for string + +namespace fs = std::filesystem; namespace caosdb::transaction {