29 #ifndef Pt_System_FileDevice_h
30 #define Pt_System_FileDevice_h
32 #include <Pt/System/Api.h>
33 #include <Pt/System/IODevice.h>
147 void open(
const Path& path, std::ios::openmode mode);
169 std::size_t onBeginRead(
EventLoop& loop,
char* buffer, std::size_t n,
bool& eof);
172 std::size_t onEndRead(
EventLoop& loop,
char* buffer, std::size_t n,
bool& eof);
175 std::size_t onBeginWrite(
EventLoop& loop,
const char* buffer, std::size_t n);
178 std::size_t onEndWrite(
EventLoop& loop,
const char* buffer, std::size_t n);
187 void onSetTimeout(std::size_t timeout);
190 bool onSeekable()
const;
193 pos_type onSeek(off_type offset, std::ios::seekdir sd);
196 std::size_t onRead(
char* buffer, std::size_t count,
bool& eof);
199 std::size_t onWrite(
const char* buffer, std::size_t count);
202 std::size_t onPeek(
char* buffer, std::size_t count);
211 class FileDeviceImpl* _impl;
221 #endif // Pt_System_FileDevice_h
Signal< FileDevice & > & opened()
Notifies that the file was opened.
Definition: FileDevice.h:159
Core module.
Definition: pt-gfx-images.dox:14
void open(const Path &path, std::ios::openmode mode)
Opens the file.
void onCancel()
Blocks until operation has cancelled.
FileDevice()
Default Constructor.
Multicast Signal to call multiple slots.
Definition: Signal.h:110
Read and write to files.
Definition: FileDevice.h:131
virtual bool onRun()
Check if ready and run.
void beginOpen(const Path &path, std::ios::openmode mode)
Begin opening the file.
void endOpen()
End opening the file.
Represents a path in the file-system.
Definition: Path.h:48
Thread-safe event loop supporting I/O multiplexing and Timers.
Definition: EventLoop.h:74
Endpoint for I/O operations.
Definition: IODevice.h:56
bool isOpen() const
Returns true if file is open.
Definition: FileDevice.h:164
FileDevice(const Path &path, std::ios::openmode mode)
Construct with path to file.