Skip to content

Commit

Permalink
added assign operator and copy constructor for copying all datasource…
Browse files Browse the repository at this point in the history
… properties to a another/new instance
  • Loading branch information
andreassteffens authored and github-actions[bot] committed Apr 20, 2023
1 parent 34c7a5d commit 4acae5f
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 18 deletions.
29 changes: 19 additions & 10 deletions src/providers/wfs/qgswfsdatasourceuri.cpp
Expand Up @@ -151,6 +151,25 @@ QgsWFSDataSourceURI::QgsWFSDataSourceURI( const QString &uri )
}
}

QgsWFSDataSourceURI::QgsWFSDataSourceURI( const QgsWFSDataSourceURI& other )
: mURI( other.mURI )
, mAuth( other.mAuth )
, mGetEndpoints( other.mGetEndpoints )
, mPostEndpoints( other.mPostEndpoints )
, mDeprecatedURI( other.mDeprecatedURI )
{
}

QgsWFSDataSourceURI& QgsWFSDataSourceURI::operator=( const QgsWFSDataSourceURI &other )
{
mURI = other.mURI;
mAuth = other.mAuth;
mGetEndpoints = other.mGetEndpoints;
mPostEndpoints = other.mPostEndpoints;
mDeprecatedURI = other.mDeprecatedURI;
return *this;
}

bool QgsWFSDataSourceURI::isValid() const
{
return mURI.hasParam( QgsWFSConstants::URI_PARAM_URL ) &&
Expand Down Expand Up @@ -469,17 +488,7 @@ void QgsWFSDataSourceURI::setGetEndpoints( const QgsStringMap &map )
mGetEndpoints = map;
}

QgsStringMap QgsWFSDataSourceURI::getGetEndpoints() const
{
return mGetEndpoints;
}

void QgsWFSDataSourceURI::setPostEndpoints( const QgsStringMap &map )
{
mPostEndpoints = map;
}

QgsStringMap QgsWFSDataSourceURI::getPostEndpoints() const
{
return mPostEndpoints;
}
12 changes: 6 additions & 6 deletions src/providers/wfs/qgswfsdatasourceuri.h
Expand Up @@ -42,6 +42,9 @@ class QgsWFSDataSourceURI

explicit QgsWFSDataSourceURI( const QString &uri );

//! Copy constructor
QgsWFSDataSourceURI( const QgsWFSDataSourceURI& other );

//! Returns whether the URI is a valid one
bool isValid() const;

Expand Down Expand Up @@ -140,21 +143,18 @@ class QgsWFSDataSourceURI
//! Sets Get DCP endpoints
void setGetEndpoints( const QgsStringMap &map );

//! Return Get DCP endpoints
QgsStringMap getGetEndpoints() const;

//! Sets Post DCP endpoints
void setPostEndpoints( const QgsStringMap &map );

//! Return Post DCP endpoints
QgsStringMap getPostEndpoints() const;

//! Return set of unknown parameter keys in the URI.
QSet<QString> unknownParamKeys() const;

//! Whether the initial GetFeature request, used to determine if gml:description/name/identifiers are used, should be skipped
bool skipInitialGetFeature() const;

//! Assigment operator
QgsWFSDataSourceURI& operator=( const QgsWFSDataSourceURI &other );

private:
QgsDataSourceUri mURI;
QgsAuthorizationSettings mAuth;
Expand Down
3 changes: 1 addition & 2 deletions src/providers/wfs/qgswfsshareddata.cpp
Expand Up @@ -49,8 +49,7 @@ bool QgsWFSSharedData::isRestrictedToRequestBBOX() const
QgsWFSSharedData *QgsWFSSharedData::clone() const
{
QgsWFSSharedData *copy = new QgsWFSSharedData( mURI.uri( true ) );
copy->mURI.setGetEndpoints(mURI.getGetEndpoints());
copy->mURI.setPostEndpoints(mURI.getPostEndpoints());
copy->mURI = mURI;
copy->mWFSVersion = mWFSVersion;
copy->mGeometryAttribute = mGeometryAttribute;
copy->mLayerPropertiesList = mLayerPropertiesList;
Expand Down

0 comments on commit 4acae5f

Please sign in to comment.