26 File(std::string
const &path, OpenFlags flags, uint32_t mode);
31 File &operator=(
const File &other) =
delete;
34 File(
File &&other) : _fd(-1), _lastError(kErrorInvalidHandle) {
35 *
this = std::move(other);
39 DS2ASSERT(&other !=
this);
41 std::swap(_fd, other._fd);
42 std::swap(_lastError, other._lastError);
48 ErrorCode pread(ByteVector &buf, uint64_t &count, uint64_t offset);
49 ErrorCode pwrite(ByteVector
const &buf, uint64_t &count, uint64_t offset);
50 ErrorCode fstat(ByteVector &buffer)
const;
53 bool valid()
const {
return (_fd >= 0); }
54 ErrorCode lastError()
const {
return _lastError; }
57 static ErrorCode chmod(std::string
const &path, uint32_t mode);
60 static ErrorCode unlink(std::string
const &path);
63 static ErrorCode createDirectory(std::string
const &path, uint32_t flags);
66 static ErrorCode fileSize(std::string
const &path, uint64_t &size);
67 static ErrorCode fileMode(std::string
const &path, uint32_t &mode);