QGIS API Documentation  3.20.0-Odense (decaadbb31)
qgszipitem.h
Go to the documentation of this file.
1 /***************************************************************************
2  qgszipitem.h
3  -------------------
4  begin : 2011-04-01
5  copyright : (C) 2011 Radim Blazek
6  email : radim dot blazek 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 #ifndef QGSZIPITEM_H
18 #define QGSZIPITEM_H
19 
20 #include "qgis_sip.h"
21 #include "qgis_core.h"
22 #include "qgis.h"
23 #include "qgsdatacollectionitem.h"
24 
29 class CORE_EXPORT QgsZipItem : public QgsDataCollectionItem
30 {
31  Q_OBJECT
32 
33  protected:
34  QString mFilePath;
35  QString mVsiPrefix;
36  QStringList mZipFileList;
37 
38  public:
40  QgsZipItem( QgsDataItem *parent, const QString &name, const QString &path );
41 
43  QgsZipItem( QgsDataItem *parent, const QString &name, const QString &filePath, const QString &path, const QString &providerKey = QString() );
44 
45 #ifdef SIP_RUN
46  SIP_PYOBJECT __repr__();
47  % MethodCode
48  QString str = QStringLiteral( "<QgsZipItem: \"%1\" %2>" ).arg( sipCpp->name(), sipCpp->path() );
49  sipRes = PyUnicode_FromString( str.toUtf8().constData() );
50  % End
51 #endif
52 
53  QVector<QgsDataItem *> createChildren() override;
54  QStringList getZipFileList();
55 
57  static QVector<dataItem_t *> sDataItemPtr SIP_SKIP;
58  static QStringList sProviderNames;
59 
60  static QString vsiPrefix( const QString &uri ) { return qgsVsiPrefix( uri ); }
61 
65  static QgsDataItem *itemFromPath( QgsDataItem *parent, const QString &path, const QString &name ) SIP_FACTORY;
66 
71  static QgsDataItem *itemFromPath( QgsDataItem *parent, const QString &filePath, const QString &name, const QString &path ) SIP_FACTORY SIP_PYNAME( itemFromFilePath );
72 
73  static QIcon iconZip();
74 
75  private:
76  void init();
77 };
78 
79 
80 
81 #endif // QGSZIPITEM_H
82 
83 
A Collection: logical collection of layers or subcollections, e.g.
Base class for all items in the model.
Definition: qgsdataitem.h:46
virtual QVector< QgsDataItem * > createChildren()
Create children.
A zip file: contains layers, using GDAL/OGR VSIFILE mechanism.
Definition: qgszipitem.h:30
QStringList mZipFileList
Definition: qgszipitem.h:36
QString mFilePath
Definition: qgszipitem.h:34
QString mVsiPrefix
Definition: qgszipitem.h:35
static QString vsiPrefix(const QString &uri)
Definition: qgszipitem.h:60
static QStringList sProviderNames
Definition: qgszipitem.h:58
#define str(x)
Definition: qgis.cpp:37
QString qgsVsiPrefix(const QString &path)
Definition: qgis.cpp:200
#define SIP_SKIP
Definition: qgis_sip.h:126
#define SIP_PYNAME(name)
Definition: qgis_sip.h:81
#define SIP_FACTORY
Definition: qgis_sip.h:76