QGIS API Documentation  3.21.0-Master (5b68dc587e)
qgsprovidersublayertask.h
Go to the documentation of this file.
1 /***************************************************************************
2  qgsprovidersublayertask.h
3  ----------------------
4  begin : June 2021
5  copyright : (C) 2021 by Nyall Dawson
6  email : nyall dot dawson at gmail dot com
7  ***************************************************************************/
8 
9 /***************************************************************************
10  * *
11  * This program is free software; you can redistribute it and/or modify *
12  * it under the terms of the GNU General Public License as published by *
13  * the Free Software Foundation; either version 2 of the License, or *
14  * (at your option) any later version. *
15  * *
16  ***************************************************************************/
17 
18 #ifndef QGSPROVIDERSUBLAYERTASKTASK_H
19 #define QGSPROVIDERSUBLAYERTASKTASK_H
20 
21 #include "qgstaskmanager.h"
22 #include <QReadWriteLock>
23 #include <memory>
24 
25 class QgsFeedback;
27 
46 class CORE_EXPORT QgsProviderSublayerTask : public QgsTask
47 {
48  Q_OBJECT
49 
50  public:
51 
56  QgsProviderSublayerTask( const QString &uri, bool includeSystemTables = false );
57 
59 
63  QList<QgsProviderSublayerDetails> results() const;
64 
65  void cancel() override;
66 
67  protected:
68 
69  bool run() override;
70 
71  private:
72 
73  QString mUri;
74 
75  bool mIncludeSystemTables = false;
76 
77  std::unique_ptr< QgsFeedback > mFeedback;
78 
79  QList<QgsProviderSublayerDetails> mResults;
80 
81  mutable QReadWriteLock mLock;
82 
83 };
84 
85 #endif // QGSPROVIDERSUBLAYERTASKTASK_H
Base class for feedback objects to be used for cancellation of something running in a worker thread.
Definition: qgsfeedback.h:45
Contains details about a sub layer available from a dataset.
A QgsTask which retrieves sublayer details for a URI.
~QgsProviderSublayerTask() override
Abstract base class for long running background tasks.
virtual bool run()=0
Performs the task's operation.
virtual void cancel()
Notifies the task that it should terminate.