1 #ifndef LIBFILEZILLA_FILE_HEADER
2 #define LIBFILEZILLA_FILE_HEADER
4 #include "fsresult.hpp"
8 #include "glue/windows.hpp"
26 class FZ_PUBLIC_SYMBOL
file final
30 typedef HANDLE file_t;
60 current_user_only = 0x4,
72 current_user_and_admins_only = 0x8
83 explicit file(file_t fd);
88 file& operator=(
file const&) =
delete;
91 file& operator=(
file && op) noexcept;
94 explicit operator
bool()
const {
return opened(); }
96 result open(
native_string const& f, mode m, creation_flags d = existing);
122 int64_t size()
const;
136 int64_t seek(int64_t offset, seek_mode m);
161 int64_t
read(
void *buf, int64_t count);
173 int64_t
write(
void const* buf, int64_t count);
184 HANDLE fd_{INVALID_HANDLE_VALUE};
mode
Files can be opened for reading or writing, but not both.
Definition: file.hpp:36
Seek from current position in the file.
Definition: file.hpp:113
int64_t position()
Get Current position in file.
Definition: file.hpp:139
std::wstring native_string
A string in the system's native character type and encoding. Note: This typedef changes depending on...
Definition: string.hpp:33
Seek from beginning of file.
Definition: file.hpp:110
bool remove_file(native_string const &name)
remove the specified file.
The namespace used by libfilezilla.
Definition: apply.hpp:17
seek_mode
Used by seek.
Definition: file.hpp:108
creation_flags
Creation flags when opening file for writing.
Definition: file.hpp:47
Lean class for file access.
Definition: file.hpp:26
Sets some global macros and further includes string.hpp.
file_t fd()
Returns the raw file descriptor, but retains ownership.
Definition: file.hpp:101