libquentier 0.5.0
The library for rich desktop clients of Evernote service
Loading...
Searching...
No Matches
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 processes file write requests with given request ids
 
void onReadFileRequest (QString absoluteFilePath, QUuid requestId)
 onReadFileRequest slot processes file read requests with given request ids
 

Signals

void readyForIO ()
 readyForIO signal is emitted 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 signal listeners that they can perform some IO via the FileIOProcessorAsync
 
void writeFileRequestProcessed (bool success, ErrorString errorDescription, QUuid requestId)
 writeFileRequestProcessed signal is emitted when the file write request with given id is finished
 
void readFileRequestProcessed (bool success, ErrorString errorDescription, QByteArray data, QUuid requestId)
 readFileRequestProcessed signal is emitted when the file read request with given id is finished
 

Public Member Functions

 FileIOProcessorAsync (QObject *parent=nullptr)
 
void setIdleTimePeriod (qint32 seconds)
 setIdleTimePeriod sets 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.
 

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 processes file read requests with given request ids

Parameters
absoluteFilePathAbsolute file path to be read
requestIdUnique identifier of the file read request

◆ onWriteFileRequest

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

onWriteFileRequest slot processes file write requests with given request ids

Parameters
absoluteFilePathAbsolute file path to be written
dataData to be written to the file
requestIdUnique identifier of the file write request
appendIf 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 is emitted when the file read request with given id is finished

Parameters
successTrue if read operation was successful, false otherwise
errorDescriptionTextual description of the error
dataData read from file
requestIdUnique identifier of the file read request

◆ setIdleTimePeriod()

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

setIdleTimePeriod sets 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
secondsNumber of seconds for idle time period

◆ writeFileRequestProcessed

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

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

Parameters
successTrue if write operation was successful, false otherwise
errorDescriptionTextual description of the error
requestIdUnique identifier of the file write request