Skip to content

Commit 654dd44

Browse files
andreassteffensnyalldawson
authored andcommitted
added assign operator and copy constructor for copying all datasource properties to a another/new instance
1 parent c4afd27 commit 654dd44

File tree

3 files changed

+26
-18
lines changed

3 files changed

+26
-18
lines changed

src/providers/wfs/qgswfsdatasourceuri.cpp

Lines changed: 19 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -151,6 +151,25 @@ QgsWFSDataSourceURI::QgsWFSDataSourceURI( const QString &uri )
151151
}
152152
}
153153

154+
QgsWFSDataSourceURI::QgsWFSDataSourceURI( const QgsWFSDataSourceURI& other )
155+
: mURI( other.mURI )
156+
, mAuth( other.mAuth )
157+
, mGetEndpoints( other.mGetEndpoints )
158+
, mPostEndpoints( other.mPostEndpoints )
159+
, mDeprecatedURI( other.mDeprecatedURI )
160+
{
161+
}
162+
163+
QgsWFSDataSourceURI& QgsWFSDataSourceURI::operator=( const QgsWFSDataSourceURI &other )
164+
{
165+
mURI = other.mURI;
166+
mAuth = other.mAuth;
167+
mGetEndpoints = other.mGetEndpoints;
168+
mPostEndpoints = other.mPostEndpoints;
169+
mDeprecatedURI = other.mDeprecatedURI;
170+
return *this;
171+
}
172+
154173
bool QgsWFSDataSourceURI::isValid() const
155174
{
156175
return mURI.hasParam( QgsWFSConstants::URI_PARAM_URL ) &&
@@ -469,17 +488,7 @@ void QgsWFSDataSourceURI::setGetEndpoints( const QgsStringMap &map )
469488
mGetEndpoints = map;
470489
}
471490

472-
QgsStringMap QgsWFSDataSourceURI::getGetEndpoints() const
473-
{
474-
return mGetEndpoints;
475-
}
476-
477491
void QgsWFSDataSourceURI::setPostEndpoints( const QgsStringMap &map )
478492
{
479493
mPostEndpoints = map;
480-
}
481-
482-
QgsStringMap QgsWFSDataSourceURI::getPostEndpoints() const
483-
{
484-
return mPostEndpoints;
485494
}

src/providers/wfs/qgswfsdatasourceuri.h

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,9 @@ class QgsWFSDataSourceURI
4242

4343
explicit QgsWFSDataSourceURI( const QString &uri );
4444

45+
//! Copy constructor
46+
QgsWFSDataSourceURI( const QgsWFSDataSourceURI& other );
47+
4548
//! Returns whether the URI is a valid one
4649
bool isValid() const;
4750

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

143-
//! Return Get DCP endpoints
144-
QgsStringMap getGetEndpoints() const;
145-
146146
//! Sets Post DCP endpoints
147147
void setPostEndpoints( const QgsStringMap &map );
148148

149-
//! Return Post DCP endpoints
150-
QgsStringMap getPostEndpoints() const;
151-
152149
//! Return set of unknown parameter keys in the URI.
153150
QSet<QString> unknownParamKeys() const;
154151

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

155+
//! Assigment operator
156+
QgsWFSDataSourceURI& operator=( const QgsWFSDataSourceURI &other );
157+
158158
private:
159159
QgsDataSourceUri mURI;
160160
QgsAuthorizationSettings mAuth;

src/providers/wfs/qgswfsshareddata.cpp

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -49,8 +49,7 @@ bool QgsWFSSharedData::isRestrictedToRequestBBOX() const
4949
QgsWFSSharedData *QgsWFSSharedData::clone() const
5050
{
5151
QgsWFSSharedData *copy = new QgsWFSSharedData( mURI.uri( true ) );
52-
copy->mURI.setGetEndpoints(mURI.getGetEndpoints());
53-
copy->mURI.setPostEndpoints(mURI.getPostEndpoints());
52+
copy->mURI = mURI;
5453
copy->mWFSVersion = mWFSVersion;
5554
copy->mGeometryAttribute = mGeometryAttribute;
5655
copy->mLayerPropertiesList = mLayerPropertiesList;

0 commit comments

Comments
 (0)