Skip to content

Commit

Permalink
[Server] Replaced unnecessary QStringLiteral by character
Browse files Browse the repository at this point in the history
  • Loading branch information
rldhont committed Jun 5, 2017
1 parent 05d9f92 commit b6c76a0
Show file tree
Hide file tree
Showing 9 changed files with 62 additions and 62 deletions.
4 changes: 2 additions & 2 deletions src/server/services/wcs/qgswcsdescribecoverage.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ namespace QgsWcs
QStringList coveNameList;
if ( !coveNames.isEmpty() )
{
coveNameList = coveNames.split( QStringLiteral( "," ) );
coveNameList = coveNames.split( ',' );
for ( int i = 0; i < coveNameList.size(); ++i )
{
coveNameList.replace( i, coveNameList.at( i ).trimmed() );
Expand All @@ -111,7 +111,7 @@ namespace QgsWcs
QString name = layer->name();
if ( !layer->shortName().isEmpty() )
name = layer->shortName();
name = name.replace( QLatin1String( " " ), QLatin1String( "_" ) );
name = name.replace( ' ', '_' );

if ( coveNameList.size() == 0 || coveNameList.contains( name ) )
{
Expand Down
6 changes: 3 additions & 3 deletions src/server/services/wcs/qgswcsutils.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ namespace QgsWcs
QString name = layer->name();
if ( !layer->shortName().isEmpty() )
name = layer->shortName();
name = name.replace( QLatin1String( " " ), QLatin1String( "_" ) );
name = name.replace( ' ', '_' );
QDomText nameText = doc.createTextNode( name );
nameElem.appendChild( nameText );
layerElem.appendChild( nameElem );
Expand Down Expand Up @@ -260,15 +260,15 @@ namespace QgsWcs

QgsRectangle parseBbox( const QString &bboxStr )
{
QStringList lst = bboxStr.split( QStringLiteral( "," ) );
QStringList lst = bboxStr.split( ',' );
if ( lst.count() != 4 )
return QgsRectangle();

double d[4];
bool ok;
for ( int i = 0; i < 4; i++ )
{
lst[i].replace( QLatin1String( " " ), QLatin1String( "+" ) );
lst[i].replace( ' ', '+' );
d[i] = lst[i].toDouble( &ok );
if ( !ok )
return QgsRectangle();
Expand Down
14 changes: 7 additions & 7 deletions src/server/services/wfs/qgswfsdescribefeaturetype.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -90,8 +90,8 @@ namespace QgsWfs
if ( docChildElem.tagName() == QLatin1String( "TypeName" ) )
{
QString typeName = docChildElem.text().trimmed();
if ( typeName.contains( QLatin1String( ":" ) ) )
typeNameList << typeName.section( QStringLiteral( ":" ), 1, 1 );
if ( typeName.contains( ':' ) )
typeNameList << typeName.section( ':', 1, 1 );
else
typeNameList << typeName;
}
Expand All @@ -103,12 +103,12 @@ namespace QgsWfs
QString typeNames = request.parameter( QStringLiteral( "TYPENAME" ) );
if ( !typeNames.isEmpty() )
{
QStringList typeNameSplit = typeNames.split( QStringLiteral( "," ) );
QStringList typeNameSplit = typeNames.split( ',' );
for ( int i = 0; i < typeNameSplit.size(); ++i )
{
QString typeName = typeNameSplit.at( i ).trimmed();
if ( typeName.contains( QLatin1String( ":" ) ) )
typeNameList << typeName.section( QStringLiteral( ":" ), 1, 1 );
if ( typeName.contains( ':' ) )
typeNameList << typeName.section( ':', 1, 1 );
else
typeNameList << typeName;
}
Expand All @@ -127,7 +127,7 @@ namespace QgsWfs
QString name = layer->name();
if ( !layer->shortName().isEmpty() )
name = layer->shortName();
name = name.replace( QLatin1String( " " ), QLatin1String( "_" ) );
name = name.replace( ' ', '_' );

if ( !typeNameList.isEmpty() && !typeNameList.contains( name ) )
{
Expand Down Expand Up @@ -168,7 +168,7 @@ namespace QgsWfs
QString typeName = layer->name();
if ( !layer->shortName().isEmpty() )
typeName = layer->shortName();
typeName = typeName.replace( QLatin1String( " " ), QLatin1String( "_" ) );
typeName = typeName.replace( ' ', '_' );

//xsd:element
QDomElement elementElem = doc.createElement( QStringLiteral( "element" )/*xsd:element*/ );
Expand Down
54 changes: 27 additions & 27 deletions src/server/services/wfs/qgswfsgetfeature.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,7 @@ namespace QgsWfs
QString name = layer->name();
if ( !layer->shortName().isEmpty() )
name = layer->shortName();
name = name.replace( QLatin1String( " " ), QLatin1String( "_" ) );
name = name.replace( ' ', '_' );

if ( typeNameList.contains( name ) )
{
Expand Down Expand Up @@ -387,7 +387,7 @@ namespace QgsWfs
// parse FEATUREID
if ( parameters.contains( QStringLiteral( "FEATUREID" ) ) )
{
QStringList fidList = parameters.value( QStringLiteral( "FEATUREID" ) ).split( QStringLiteral( "," ) );
QStringList fidList = parameters.value( QStringLiteral( "FEATUREID" ) ).split( ',' );
// Verifying the 1:1 mapping between FEATUREID and PROPERTYNAME
if ( !propertyNameList.isEmpty() && propertyNameList.size() != fidList.size() )
{
Expand Down Expand Up @@ -417,13 +417,13 @@ namespace QgsWfs
propertyName = *propertyNameIt;
}
// testing typename in the WFS featureID
if ( !fid.contains( QLatin1String( "." ) ) )
if ( !fid.contains( '.' ) )
{
throw QgsRequestNotWellFormedException( QStringLiteral( "FEATUREID has to have TYPENAME in the values" ) );
}

QString typeName = fid.section( QStringLiteral( "." ), 0, 0 );
fid = fid.section( QStringLiteral( "." ), 1, 1 );
QString typeName = fid.section( '.', 0, 0 );
fid = fid.section( '.', 1, 1 );
if ( !typeNameList.contains( typeName ) )
{
typeNameList << typeName;
Expand Down Expand Up @@ -467,23 +467,23 @@ namespace QgsWfs
{
QStringList propertyList;

QStringList attrList = propertyName.split( QStringLiteral( "," ) );
QStringList attrList = propertyName.split( ',' );
QStringList::const_iterator alstIt;
for ( alstIt = attrList.begin(); alstIt != attrList.end(); ++alstIt )
{
QString fieldName = *alstIt;
fieldName = fieldName.trimmed();
if ( fieldName.contains( QLatin1String( ":" ) ) )
if ( fieldName.contains( ':' ) )
{
fieldName = fieldName.section( QStringLiteral( ":" ), 1, 1 );
fieldName = fieldName.section( ':', 1, 1 );
}
if ( fieldName.contains( QLatin1String( "/" ) ) )
if ( fieldName.contains( '/' ) )
{
if ( fieldName.section( QStringLiteral( "/" ), 0, 0 ) != typeName )
if ( fieldName.section( '/', 0, 0 ) != typeName )
{
throw QgsRequestNotWellFormedException( QStringLiteral( "PropertyName text '%1' has to contain TypeName '%2'" ).arg( fieldName ).arg( typeName ) );
}
fieldName = fieldName.section( QStringLiteral( "/" ), 1, 1 );
fieldName = fieldName.section( '/', 1, 1 );
}
propertyList.append( fieldName );
}
Expand Down Expand Up @@ -513,7 +513,7 @@ namespace QgsWfs
throw QgsRequestNotWellFormedException( QStringLiteral( "TYPENAME is mandatory except if FEATUREID is used" ) );
}

typeNameList = parameters.value( QStringLiteral( "TYPENAME" ) ).split( QStringLiteral( "," ) );
typeNameList = parameters.value( QStringLiteral( "TYPENAME" ) ).split( ',' );
// Verifying the 1:1 mapping between TYPENAME and PROPERTYNAME
if ( !propertyNameList.isEmpty() && typeNameList.size() != propertyNameList.size() )
{
Expand Down Expand Up @@ -549,23 +549,23 @@ namespace QgsWfs
{
QStringList propertyList;

QStringList attrList = propertyName.split( QStringLiteral( "," ) );
QStringList attrList = propertyName.split( ',' );
QStringList::const_iterator alstIt;
for ( alstIt = attrList.begin(); alstIt != attrList.end(); ++alstIt )
{
QString fieldName = *alstIt;
fieldName = fieldName.trimmed();
if ( fieldName.contains( QLatin1String( ":" ) ) )
if ( fieldName.contains( ':' ) )
{
fieldName = fieldName.section( QStringLiteral( ":" ), 1, 1 );
fieldName = fieldName.section( ':', 1, 1 );
}
if ( fieldName.contains( QLatin1String( "/" ) ) )
if ( fieldName.contains( '/' ) )
{
if ( fieldName.section( QStringLiteral( "/" ), 0, 0 ) != typeName )
if ( fieldName.section( '/', 0, 0 ) != typeName )
{
throw QgsRequestNotWellFormedException( QStringLiteral( "PropertyName text '%1' has to contain TypeName '%2'" ).arg( fieldName ).arg( typeName ) );
}
fieldName = fieldName.section( QStringLiteral( "/" ), 1, 1 );
fieldName = fieldName.section( '/', 1, 1 );
}
propertyList.append( fieldName );
}
Expand Down Expand Up @@ -660,7 +660,7 @@ namespace QgsWfs
bool ok;
for ( int i = 0; i < 4; i++ )
{
corners[i].replace( QLatin1String( " " ), QLatin1String( "+" ) );
corners[i].replace( ' ', '+' );
d[i] = corners[i].toDouble( &ok );
if ( !ok )
{
Expand Down Expand Up @@ -769,9 +769,9 @@ namespace QgsWfs
getFeatureQuery parseQueryElement( QDomElement &queryElem )
{
QString typeName = queryElem.attribute( QStringLiteral( "typeName" ), QLatin1String( "" ) );
if ( typeName.contains( QLatin1String( ":" ) ) )
if ( typeName.contains( ':' ) )
{
typeName = typeName.section( QStringLiteral( ":" ), 1, 1 );
typeName = typeName.section( ':', 1, 1 );
}

QgsFeatureRequest featureRequest;
Expand All @@ -785,17 +785,17 @@ namespace QgsWfs
if ( queryChildElem.tagName() == QLatin1String( "PropertyName" ) )
{
QString fieldName = queryChildElem.text().trimmed();
if ( fieldName.contains( QLatin1String( ":" ) ) )
if ( fieldName.contains( ':' ) )
{
fieldName = fieldName.section( QStringLiteral( ":" ), 1, 1 );
fieldName = fieldName.section( ':', 1, 1 );
}
if ( fieldName.contains( QLatin1String( "/" ) ) )
if ( fieldName.contains( '/' ) )
{
if ( fieldName.section( QStringLiteral( "/" ), 0, 0 ) != typeName )
if ( fieldName.section( '/', 0, 0 ) != typeName )
{
throw QgsRequestNotWellFormedException( QStringLiteral( "PropertyName text '%1' has to contain TypeName '%2'" ).arg( fieldName ).arg( typeName ) );
}
fieldName = fieldName.section( QStringLiteral( "/" ), 1, 1 );
fieldName = fieldName.section( '/', 1, 1 );
}
propertyList.append( fieldName );
}
Expand Down Expand Up @@ -878,7 +878,7 @@ namespace QgsWfs
query.removeAllQueryItems( QStringLiteral( "_DC" ) );

query.addQueryItem( QStringLiteral( "REQUEST" ), QStringLiteral( "DescribeFeatureType" ) );
query.addQueryItem( QStringLiteral( "TYPENAME" ), typeNames.join( QStringLiteral( "," ) ) );
query.addQueryItem( QStringLiteral( "TYPENAME" ), typeNames.join( ',' ) );
query.addQueryItem( QStringLiteral( "OUTPUTFORMAT" ), QStringLiteral( "XMLSCHEMA" ) );

mapUrl.setQuery( query );
Expand Down
26 changes: 13 additions & 13 deletions src/server/services/wfs/qgswfstransaction.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -243,7 +243,7 @@ namespace QgsWfs
QString name = layer->name();
if ( !layer->shortName().isEmpty() )
name = layer->shortName();
name = name.replace( QLatin1String( " " ), QLatin1String( "_" ) );
name = name.replace( ' ', '_' );

if ( !typeNameList.contains( name ) )
{
Expand Down Expand Up @@ -779,7 +779,7 @@ namespace QgsWfs
// parse FEATUREID
if ( parameters.contains( QStringLiteral( "FEATUREID" ) ) )
{
QStringList fidList = parameters.value( QStringLiteral( "FEATUREID" ) ).split( QStringLiteral( "," ) );
QStringList fidList = parameters.value( QStringLiteral( "FEATUREID" ) ).split( ',' );

QMap<QString, QgsFeatureIds> fidsMap;

Expand All @@ -790,13 +790,13 @@ namespace QgsWfs
QString fid = *fidIt;
fid = fid.trimmed();
// testing typename in the WFS featureID
if ( !fid.contains( QLatin1String( "." ) ) )
if ( !fid.contains( '.' ) )
{
throw QgsRequestNotWellFormedException( QStringLiteral( "FEATUREID has to have TYPENAME in the values" ) );
}

QString typeName = fid.section( QStringLiteral( "." ), 0, 0 );
fid = fid.section( QStringLiteral( "." ), 1, 1 );
QString typeName = fid.section( '.', 0, 0 );
fid = fid.section( '.', 1, 1 );
if ( !typeNameList.contains( typeName ) )
{
typeNameList << typeName;
Expand Down Expand Up @@ -830,7 +830,7 @@ namespace QgsWfs
throw QgsRequestNotWellFormedException( QStringLiteral( "TYPENAME is mandatory except if FEATUREID is used" ) );
}

typeNameList = parameters.value( QStringLiteral( "TYPENAME" ) ).split( QStringLiteral( "," ) );
typeNameList = parameters.value( QStringLiteral( "TYPENAME" ) ).split( ',' );

// Create actions based on TypeName
QStringList::const_iterator typeNameIt = typeNameList.constBegin();
Expand Down Expand Up @@ -925,7 +925,7 @@ namespace QgsWfs
bool ok;
for ( int i = 0; i < 4; i++ )
{
corners[i].replace( QLatin1String( " " ), QLatin1String( "+" ) );
corners[i].replace( ' ', '+' );
d[i] = corners[i].toDouble( &ok );
if ( !ok )
{
Expand Down Expand Up @@ -1038,8 +1038,8 @@ namespace QgsWfs
transactionDelete parseDeleteActionElement( QDomElement &actionElem )
{
QString typeName = actionElem.attribute( QStringLiteral( "typeName" ) );
if ( typeName.contains( QLatin1String( ":" ) ) )
typeName = typeName.section( QStringLiteral( ":" ), 1, 1 );
if ( typeName.contains( ':' ) )
typeName = typeName.section( ':', 1, 1 );

QDomElement filterElem = actionElem.firstChild().toElement();
if ( filterElem.tagName() != QLatin1String( "Filter" ) )
Expand All @@ -1065,8 +1065,8 @@ namespace QgsWfs
transactionUpdate parseUpdateActionElement( QDomElement &actionElem )
{
QString typeName = actionElem.attribute( QStringLiteral( "typeName" ) );
if ( typeName.contains( QLatin1String( ":" ) ) )
typeName = typeName.section( QStringLiteral( ":" ), 1, 1 );
if ( typeName.contains( ':' ) )
typeName = typeName.section( ':', 1, 1 );

QDomNodeList propertyNodeList = actionElem.elementsByTagName( QStringLiteral( "Property" ) );
if ( propertyNodeList.size() != 1 )
Expand Down Expand Up @@ -1130,8 +1130,8 @@ namespace QgsWfs
for ( int i = 0; i < featureNodeList.count(); ++i )
{
QString tempTypeName = featureNodeList.at( i ).toElement().localName();
if ( tempTypeName.contains( QLatin1String( ":" ) ) )
tempTypeName = tempTypeName.section( QStringLiteral( ":" ), 1, 1 );
if ( tempTypeName.contains( ':' ) )
tempTypeName = tempTypeName.section( ':', 1, 1 );

if ( typeName.isEmpty() )
{
Expand Down
2 changes: 1 addition & 1 deletion src/server/services/wms/qgswmsdescribelayer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ namespace QgsWms
QStringLiteral( "LAYERS is mandatory for DescribeLayer operation" ), 400 );
}

QStringList layersList = parameters[ QStringLiteral( "LAYERS" )].split( QStringLiteral( "," ), QString::SkipEmptyParts );
QStringList layersList = parameters[ QStringLiteral( "LAYERS" )].split( ',', QString::SkipEmptyParts );
if ( layersList.size() < 1 )
{
throw QgsServiceException( QStringLiteral( "InvalidParameterValue" ), QStringLiteral( "Layers is empty" ), 400 );
Expand Down
4 changes: 2 additions & 2 deletions src/server/services/wms/qgswmsgetcapabilities.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -947,7 +947,7 @@ namespace QgsWms
//keyword list
if ( !l->keywordList().isEmpty() )
{
QStringList keywordStringList = l->keywordList().split( QStringLiteral( "," ) );
QStringList keywordStringList = l->keywordList().split( ',' );

QDomElement keywordListElem = doc.createElement( QStringLiteral( "KeywordList" ) );
for ( int i = 0; i < keywordStringList.size(); ++i )
Expand Down Expand Up @@ -1619,7 +1619,7 @@ namespace QgsWms
reversedList << layerList[ i ];

QDomElement layerDrawingOrderElem = doc.createElement( QStringLiteral( "LayerDrawingOrder" ) );
QDomText drawingOrderText = doc.createTextNode( reversedList.join( QStringLiteral( "," ) ) );
QDomText drawingOrderText = doc.createTextNode( reversedList.join( ',' ) );
layerDrawingOrderElem.appendChild( drawingOrderText );
parentElem.appendChild( layerDrawingOrderElem );
}
Expand Down
2 changes: 1 addition & 1 deletion src/server/services/wms/qgswmsgetcontext.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -356,7 +356,7 @@ namespace QgsWms
//keyword list
if ( !l->keywordList().isEmpty() )
{
QStringList keywordStringList = l->keywordList().split( QStringLiteral( "," ) );
QStringList keywordStringList = l->keywordList().split( ',' );
bool sia2045 = QgsServerProjectUtils::wmsInfoFormatSia2045( *project );

QDomElement keywordsElem = doc.createElement( QStringLiteral( "ows:Keywords" ) );
Expand Down
Loading

0 comments on commit b6c76a0

Please sign in to comment.