replace boost filesystem with std filesystem; upgrade gtest and find it using cmake.

This commit is contained in:
Chunting Gu
2020-02-15 12:04:51 +08:00
parent 7e3da65e73
commit 7e7ab1c1e8
72 changed files with 233 additions and 31551 deletions
+9 -9
View File
@@ -1,12 +1,12 @@
#ifndef WEBCC_BODY_H_
#define WEBCC_BODY_H_
#include <filesystem>
#include <fstream>
#include <memory>
#include <string>
#include <utility>
#include "boost/filesystem/fstream.hpp"
#include "webcc/common.h"
namespace webcc {
@@ -152,14 +152,14 @@ private:
class FileBody : public Body {
public:
// For message to be sent out.
FileBody(const Path& path, std::size_t chunk_size);
FileBody(const std::filesystem::path& path, std::size_t chunk_size);
// For message received.
// No |chunk_size| is needed since you don't iterate the payload of a
// received message.
// If |auto_delete| is true, the file will be deleted on destructor unless it
// is moved to another path (see Move()).
FileBody(const Path& path, bool auto_delete = false);
FileBody(const std::filesystem::path& path, bool auto_delete = false);
~FileBody() override;
@@ -173,7 +173,7 @@ public:
void Dump(std::ostream& os, const std::string& prefix) const override;
const Path& path() const {
const std::filesystem::path& path() const {
return path_;
}
@@ -186,17 +186,17 @@ public:
// If |new_path| resolves to an existing non-directory file, it is removed.
// If |new_path| resolves to an existing directory, it is removed if empty
// on ISO/IEC 9945 but is an error on Windows.
// See boost::filesystem::rename() for more details.
bool Move(const Path& new_path);
// See std::filesystem::rename() for more details.
bool Move(const std::filesystem::path& new_path);
private:
Path path_;
std::filesystem::path path_;
std::size_t chunk_size_;
bool auto_delete_;
std::size_t size_; // File size in bytes
boost::filesystem::ifstream ifstream_;
std::ifstream ifstream_;
std::string chunk_;
};