fix file read

This commit is contained in:
2023-12-14 08:46:44 -06:00
parent 35aa8f5a94
commit 00cfb67b64
4 changed files with 81 additions and 70 deletions

View File

@@ -27,6 +27,11 @@
namespace repertory {
class native_file final {
public:
native_file(const native_file &) = delete;
native_file(native_file &&) = delete;
auto operator=(const native_file &) -> native_file & = delete;
auto operator=(native_file &&) -> native_file & = delete;
using native_file_ptr = std::shared_ptr<native_file>;
public:
@@ -34,22 +39,21 @@ public:
return std::shared_ptr<native_file>(new native_file(handle));
}
[[nodiscard]] static auto clone(const native_file_ptr &nativeFile)
[[nodiscard]] static auto clone(const native_file_ptr &ptr)
-> native_file_ptr;
[[nodiscard]] static auto create_or_open(const std::string &source_path,
bool should_chmod,
native_file_ptr &nf) -> api_error;
bool read_only, native_file_ptr &ptr)
-> api_error;
[[nodiscard]] static auto create_or_open(const std::string &source_path,
native_file_ptr &nf) -> api_error;
native_file_ptr &ptr) -> api_error;
[[nodiscard]] static auto open(const std::string &source_path,
native_file_ptr &nf) -> api_error;
native_file_ptr &ptr) -> api_error;
[[nodiscard]] static auto open(const std::string &source_path,
bool should_chmod, native_file_ptr &nf)
-> api_error;
[[nodiscard]] static auto open(const std::string &source_path, bool read_only,
native_file_ptr &ptr) -> api_error;
private:
explicit native_file(const native_handle &handle) : handle_(handle) {}
@@ -71,7 +75,7 @@ public:
void close();
[[nodiscard]] auto copy_from(const native_file_ptr &source) -> bool;
[[nodiscard]] auto copy_from(const native_file_ptr &ptr) -> bool;
[[nodiscard]] auto copy_from(const std::string &path) -> bool;