Skip to content
Permalink
Browse files

Add a remove method thanks to enum value

  • Loading branch information
pblottiere committed Jul 23, 2018
1 parent 6e1f14b commit f55d9c1a31bacdeacb86ec211e9aff66f574ebb0
Showing with 25 additions and 4 deletions.
  1. +23 −4 src/server/qgsserverparameters.cpp
  2. +2 −0 src/server/qgsserverparameters.h
@@ -260,14 +260,28 @@ QgsServerParameter::QgsServerParameter( const QgsServerParameter::Name name,

QString QgsServerParameter::name( const QgsServerParameter::Name name )
{
const QMetaEnum metaEnum( QMetaEnum::fromType<QgsServerParameter::Name>() );
return metaEnum.valueToKey( name );
if ( name == QgsServerParameter::VERSION_SERVICE )
{
return QStringLiteral( "VERSION" );
}
else
{
const QMetaEnum metaEnum( QMetaEnum::fromType<QgsServerParameter::Name>() );
return metaEnum.valueToKey( name );
}
}

QgsServerParameter::Name QgsServerParameter::name( const QString &name )
{
const QMetaEnum metaEnum( QMetaEnum::fromType<QgsServerParameter::Name>() );
return ( QgsServerParameter::Name ) metaEnum.keyToValue( name.toUpper().toStdString().c_str() );
if ( name.compare( QStringLiteral( "VERSION" ) ) == 0 )
{
return QgsServerParameter::VERSION_SERVICE;
}
else
{
const QMetaEnum metaEnum( QMetaEnum::fromType<QgsServerParameter::Name>() );
return ( QgsServerParameter::Name ) metaEnum.keyToValue( name.toUpper().toStdString().c_str() );
}
}

void QgsServerParameter::raiseError() const
@@ -318,6 +332,11 @@ QUrlQuery QgsServerParameters::urlQuery() const
return query;
}

void QgsServerParameters::remove( QgsServerParameter::Name name )
{
remove( QgsServerParameter::name( name ) );
}

void QgsServerParameters::remove( const QString &key )
{
if ( mUnmanagedParameters.contains( key ) )
@@ -127,6 +127,8 @@ class SERVER_EXPORT QgsServerParameters
*/
void remove( const QString &key );

void remove( QgsServerParameter::Name name );

/**
* Returns the value of a parameter.
* \param key the name of the parameter

0 comments on commit f55d9c1

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