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);
151 void beginOpen(
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);
208 virtual bool onRun();
211 class FileDeviceImpl* _impl;
221 #endif // Pt_System_FileDevice_h
Read and write to files.
Definition: FileDevice.h:130
Signal< FileDevice & > & opened()
Notifies that the file was opened.
Definition: FileDevice.h:159
Represents a path in the file-system.
Definition: Path.h:47
Multicast Signal to call multiple slots.
Definition: Signal.h:109
Endpoint for I/O operations.
Definition: IODevice.h:55
Thread-safe event loop supporting I/O multiplexing and Timers.
Definition: EventLoop.h:72
bool isOpen() const
Returns true if file is open.
Definition: FileDevice.h:164