updated build system and fixes
Some checks failed
BlockStorage/repertory/pipeline/head There was a failure building this commit
Some checks failed
BlockStorage/repertory/pipeline/head There was a failure building this commit
This commit is contained in:
@ -27,6 +27,9 @@
|
||||
namespace repertory::utils::file {
|
||||
class file final {
|
||||
public:
|
||||
[[nodiscard]] static auto attach_file(native_handle handle,
|
||||
bool read_only = false) -> file;
|
||||
|
||||
[[nodiscard]] static auto open_file(std::filesystem::path path,
|
||||
bool read_only = false) -> file;
|
||||
|
||||
@ -103,31 +106,14 @@ public:
|
||||
[[nodiscard]] auto truncate(std::size_t size) -> bool;
|
||||
|
||||
[[nodiscard]] auto write(const data_buffer &data, std::uint64_t offset,
|
||||
std::size_t *total_written = nullptr) -> bool {
|
||||
return write_(reinterpret_cast<const unsigned char *>(data.data()),
|
||||
data.size() * sizeof(data_buffer::value_type), offset,
|
||||
total_written);
|
||||
}
|
||||
std::size_t *total_written = nullptr) -> bool;
|
||||
|
||||
[[nodiscard]] auto write(std::string_view data, std::uint64_t offset,
|
||||
std::size_t *total_written = nullptr) -> bool {
|
||||
return write_(reinterpret_cast<const unsigned char *>(data.data()),
|
||||
data.size(), offset, total_written);
|
||||
}
|
||||
|
||||
[[nodiscard]] auto write(std::wstring_view data, std::uint64_t offset,
|
||||
std::size_t *total_written = nullptr) -> bool {
|
||||
return write_(reinterpret_cast<const unsigned char *>(data.data()),
|
||||
data.size() * sizeof(wchar_t), offset, total_written);
|
||||
}
|
||||
[[nodiscard]] auto write(const unsigned char *data, std::size_t to_write,
|
||||
std::size_t offset,
|
||||
std::size_t *total_written = nullptr) -> bool;
|
||||
|
||||
public:
|
||||
[[nodiscard]] operator bool() const { return file_ != nullptr; }
|
||||
|
||||
private:
|
||||
[[nodiscard]] auto write_(const unsigned char *data, std::size_t to_write,
|
||||
std::size_t offset,
|
||||
std::size_t *total_written) -> bool;
|
||||
};
|
||||
|
||||
[[nodiscard]] auto get_file_size(std::string_view path,
|
||||
|
Reference in New Issue
Block a user