1 #ifndef LIBFILEZILLA_FILE_HEADER
2 #define LIBFILEZILLA_FILE_HEADER
8 #include "glue/windows.hpp"
28 class FZ_PUBLIC_SYMBOL
file final
32 typedef HANDLE file_t;
63 current_user_only = 0x4,
75 current_user_and_admins_only = 0x8
91 file& operator=(
file const&) =
delete;
94 file& operator=(
file && op) noexcept;
97 explicit operator bool()
const {
return opened(); }
164 int64_t
read(
void *buf, int64_t count);
176 int64_t
write(
void const* buf, int64_t count);
193 HANDLE fd_{INVALID_HANDLE_VALUE};
Represents a point of time in wallclock, tracking the timestamps accuracy/precision.
Definition: time.hpp:41
Lean class for file access.
Definition: file.hpp:29
mode
Files can be opened for reading, writing, or both.
Definition: file.hpp:38
creation_flags
Creation flags when opening file for writing.
Definition: file.hpp:50
int64_t seek(int64_t offset, seek_mode m)
Relative seek based on seek mode.
int64_t write(void const *buf, int64_t count)
Write data to file.
int64_t read(void *buf, int64_t count)
Read data from file.
bool truncate()
Truncate the file to the current position of the file pointer.
int64_t size() const
Gets size of file.
file_t fd()
Returns the raw file descriptor, but retains ownership.
Definition: file.hpp:104
seek_mode
Used by seek.
Definition: file.hpp:111
@ begin
Seek from beginning of file.
Definition: file.hpp:113
@ current
Seek from current position in the file.
Definition: file.hpp:116
bool set_modification_time(datetime const &t)
Sets modification time to specified time.
file(file_t fd)
Creates file from descriptor.
int64_t position()
Get Current position in file.
Definition: file.hpp:142
bool fsync()
Ensure data is flushed to disk.
Small class to return filesystem errors.
Definition: fsresult.hpp:26
fz::result and fz::rwresult wrappers for dealing with file system errors.
Sets some global macros and further includes string.hpp.
The namespace used by libfilezilla.
Definition: apply.hpp:17
bool remove_file(native_string const &name)
remove the specified file.
std::wstring native_string
A string in the system's native character type and encoding. Note: This typedef changes depending on...
Definition: string.hpp:34