libquentier  0.4.0
The library for rich desktop clients of Evernote service
Public Slots | Signals | Public Member Functions | List of all members
quentier::FileIOProcessorAsync Class Reference

The FileIOProcessorAsync class is a wrapper under simple file IO operations, it is meant to be used for simple asynchronous IO. More...

#include <FileIOProcessorAsync.h>

Inheritance diagram for quentier::FileIOProcessorAsync:
Inheritance graph
[legend]
Collaboration diagram for quentier::FileIOProcessorAsync:
Collaboration graph
[legend]

Public Slots

void onWriteFileRequest (QString absoluteFilePath, QByteArray data, QUuid requestId, bool append)
 onWriteFileRequest - slot processing the file write request with given request id More...
 
void onReadFileRequest (QString absoluteFilePath, QUuid requestId)
 onReadFileRequest - slot processing the file read request with given request id More...
 

Signals

void readyForIO ()
 readyForIO - signal sent when the queue for file IO is empty for some time (30 seconds by default, can also be configured via setIdleTimePeriod method) after the last IO event to indicate to signal listeners that they can perform some IO via the FileIOProcessorAsync thread
 
void writeFileRequestProcessed (bool success, ErrorString errorDescription, QUuid requestId)
 writeFileRequestProcessed - signal sent when the file write request with given id is finished More...
 
void readFileRequestProcessed (bool success, ErrorString errorDescription, QByteArray data, QUuid requestId)
 readFileRequestProcessed - signal send when the file read request with given id is finished More...
 

Public Member Functions

 FileIOProcessorAsync (QObject *parent=Q_NULLPTR)
 
void setIdleTimePeriod (qint32 seconds)
 setIdleTimePeriod - set time period defining the idle state of FileIOProcessorAsync: once the time measured since the last IO operation is over the specified number of seconds, the class emits readyForIO signal to any interested listeners of this event. If this method is not called ever, the default idle time period would be 30 seconds. More...
 

Detailed Description

The FileIOProcessorAsync class is a wrapper under simple file IO operations, it is meant to be used for simple asynchronous IO.

Member Function Documentation

◆ onReadFileRequest

void quentier::FileIOProcessorAsync::onReadFileRequest ( QString  absoluteFilePath,
QUuid  requestId 
)
slot

onReadFileRequest - slot processing the file read request with given request id

Parameters
absoluteFilePath- absolute file path to be read
requestId- unique identifier of the file read request

◆ onWriteFileRequest

void quentier::FileIOProcessorAsync::onWriteFileRequest ( QString  absoluteFilePath,
QByteArray  data,
QUuid  requestId,
bool  append 
)
slot

onWriteFileRequest - slot processing the file write request with given request id

Parameters
absoluteFilePath- absolute file path to be written
data- data to be written to the file
requestId- unique identifier of the file write request
append- if true, the data would be appended to file, otherwise the entire file would be erased before with the data is written

◆ readFileRequestProcessed

void quentier::FileIOProcessorAsync::readFileRequestProcessed ( bool  success,
ErrorString  errorDescription,
QByteArray  data,
QUuid  requestId 
)
signal

readFileRequestProcessed - signal send when the file read request with given id is finished

Parameters
success- true if read operation was successful, false otherwise
errorDescription- textual description of the error
data- data read from file
requestId- unique identifier of the file read request

◆ setIdleTimePeriod()

void quentier::FileIOProcessorAsync::setIdleTimePeriod ( qint32  seconds)

setIdleTimePeriod - set time period defining the idle state of FileIOProcessorAsync: once the time measured since the last IO operation is over the specified number of seconds, the class emits readyForIO signal to any interested listeners of this event. If this method is not called ever, the default idle time period would be 30 seconds.

Parameters
seconds- number of seconds for idle time period

◆ writeFileRequestProcessed

void quentier::FileIOProcessorAsync::writeFileRequestProcessed ( bool  success,
ErrorString  errorDescription,
QUuid  requestId 
)
signal

writeFileRequestProcessed - signal sent when the file write request with given id is finished

Parameters
success- true if write operation was successful, false otherwise
errorDescription- textual description of the error
requestId- unique identifier of the file write request