Skip to content
Snippets Groups Projects
Verified Commit 3b739b68 authored by Timm Fitschen's avatar Timm Fitschen
Browse files

Replace boost::filesystem with std::filesystem

parent e35253f6
Branches
Tags
2 merge requests!33Release 0.1,!32fix windows build
Pipeline #15219 failed
This commit is part of merge request !33. Comments created here will be created in the context of that merge request.
Showing
with 67 additions and 76 deletions
......@@ -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:
......
......@@ -21,8 +21,6 @@
#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
......@@ -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";
......
......@@ -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.
......
......@@ -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;
......
......@@ -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 <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_;
};
......
......@@ -49,7 +49,7 @@
#ifndef CAOSDB_FILE_TRANSMISSION_FILE_WRITER_H
#define CAOSDB_FILE_TRANSMISSION_FILE_WRITER_H
#include <boost/filesystem/path.hpp> // for path
#include <filesystem> // for path
#include <fstream> // for ofstream
#include <string> // for string
......@@ -57,7 +57,7 @@ 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
......
......@@ -25,15 +25,13 @@
#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/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
......@@ -42,11 +40,11 @@
#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;
}
......
......@@ -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);
......
......@@ -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
......
......@@ -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();
}
......
......@@ -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();
}
......
......@@ -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
......
......@@ -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
......
......@@ -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));)
......
......@@ -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 <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 = boost::filesystem;
namespace fs = std::filesystem;
namespace caosdb::transaction {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment