Skip to content
Permalink
Browse files

[Server] Replaced unnecessary QStringLiteral by character

  • Loading branch information
rldhont committed Jun 5, 2017
1 parent 05d9f92 commit b6c76a0ad1ee61d6d4b473884b00dde84a053feb
@@ -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() );
@@ -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 ) )
{
@@ -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 );
@@ -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();
@@ -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;
}
@@ -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;
}
@@ -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 ) )
{
@@ -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*/ );
@@ -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 ) )
{
@@ -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() )
{
@@ -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;
@@ -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 );
}
@@ -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() )
{
@@ -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 );
}
@@ -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 )
{
@@ -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;
@@ -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 );
}
@@ -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 );
@@ -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 ) )
{
@@ -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;

@@ -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;
@@ -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();
@@ -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 )
{
@@ -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" ) )
@@ -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 )
@@ -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() )
{
@@ -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 );
@@ -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 )
@@ -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 );
}
@@ -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" ) );

0 comments on commit b6c76a0

Please sign in to comment.
You can’t perform that action at this time.