1 /***************************************************************************
2                              qgsprovidersublayerdetails.cpp
3                              ----------------------------
4     begin                : May 2021
5     copyright            : (C) 2021 by Nyall Dawson
6     email                : nyall dot dawson at gmail dot com
7  ***************************************************************************/
8 /***************************************************************************
9  *                                                                         *
10  *   This program is free software; you can redistribute it and/or modify  *
11  *   it under the terms of the GNU General Public License as published by  *
12  *   the Free Software Foundation; either version 2 of the License, or     *
13  *   (at your option) any later version.                                   *
14  *                                                                         *
15  ***************************************************************************/
16 
17 #include "qgsprovidersublayerdetails.h"
18 #include "qgsmaplayerfactory.h"
19 
20 
21 
toLayer(const LayerOptions & options) const22 QgsMapLayer *QgsProviderSublayerDetails::toLayer( const LayerOptions &options ) const
23 {
24   QgsMapLayerFactory::LayerOptions layerOptions( options.transformContext );
25   layerOptions.loadDefaultStyle = options.loadDefaultStyle;
26   return QgsMapLayerFactory::createLayer( mUri, mName, mType, layerOptions, mProviderKey );
27 }
28 
operator ==(const QgsProviderSublayerDetails & other) const29 bool QgsProviderSublayerDetails::operator==( const QgsProviderSublayerDetails &other ) const
30 {
31   return mProviderKey == other.mProviderKey
32          && mType == other.mType
33          && mFlags == other.mFlags
34          && mUri == other.mUri
35          && mLayerNumber == other.mLayerNumber
36          && mName == other.mName
37          && mDescription == other.mDescription
38          && mFeatureCount == other.mFeatureCount
39          && mGeometryColumnName == other.mGeometryColumnName
40          && mPath == other.mPath
41          && mWkbType == other.mWkbType
42          && mSkippedContainerScan == other.mSkippedContainerScan
43          && mDriverName == other.mDriverName;
44 }
45 
operator !=(const QgsProviderSublayerDetails & other) const46 bool QgsProviderSublayerDetails::operator!=( const QgsProviderSublayerDetails &other ) const
47 {
48   return !( *this == other );
49 }
50