forked from qt-creator/qt-creator
Utils: Start adding some asynchronous API to FilePath
Especially with the "remote" scenarios synchronous operations cannot be expected to work reasonably well. This here starts with adding asynchronous versions to some of the FilePath member functions, taking additional "Continuation" style. This is not necessarily the final syntax (sugar like .then(...) comes to mind...), but is simple enough for now for the few uses we have, and it is too early to see what will be needed in the end. Change-Id: Idf4dde1b77d04cafb81b6c024031145bdd91a762 Reviewed-by: Christian Stenger <christian.stenger@qt.io>
This commit is contained in:
@@ -181,6 +181,13 @@ public:
|
||||
static void removeDuplicates(QList<FilePath> &files);
|
||||
static void sort(QList<FilePath> &files);
|
||||
|
||||
// Asynchronous interface
|
||||
template <class ...Args> using Continuation = std::function<void(Args...)>;
|
||||
void asyncCopyFile(const Continuation<bool> &cont, const FilePath &target) const;
|
||||
void asyncFileContents(const Continuation<const QByteArray &> &cont,
|
||||
qint64 maxSize = -1, qint64 offset = 0) const;
|
||||
void asyncWriteFileContents(const Continuation<bool> &cont, const QByteArray &data) const;
|
||||
|
||||
private:
|
||||
friend class ::tst_fileutils;
|
||||
static QString calcRelativePath(const QString &absolutePath, const QString &absoluteAnchorPath);
|
||||
|
||||
Reference in New Issue
Block a user