QGIS API Documentation
3.20.0-Odense (decaadbb31)
|
The QgsServerQueryStringParameter class holds the information regarding a query string input parameter and its validation. More...
#include <qgsserverquerystringparameter.h>
Public Types | |
enum class | Type { String = QVariant::String , Integer = QVariant::LongLong , Double = QVariant::Double , Boolean = QVariant::Bool , List = QVariant::StringList } |
The Type enum represents the parameter type. More... | |
Public Member Functions | |
QgsServerQueryStringParameter (const QString name, bool required=false, Type type=QgsServerQueryStringParameter::Type::String, const QString &description=QString(), const QVariant &defaultValue=QVariant()) | |
Constructs a QgsServerQueryStringParameter object. More... | |
virtual | ~QgsServerQueryStringParameter () |
json | data () const |
Returns the handler information as a JSON object. More... | |
QString | description () const |
Returns parameter description. More... | |
QString | name () const |
Returns the name of the parameter. More... | |
void | setCustomValidator (const customValidator &customValidator) |
Sets the custom validation function to customValidator. More... | |
void | setDescription (const QString &description) |
Sets validator description. More... | |
virtual QVariant | value (const QgsServerApiContext &context) const |
Extracts the value from the request context by validating the parameter value and converting it to its proper Type. More... | |
Static Public Member Functions | |
static QString | typeName (const Type type) |
Returns the name of the type. More... | |
Friends | |
class | TestQgsServerQueryStringParameter |
The QgsServerQueryStringParameter class holds the information regarding a query string input parameter and its validation.
The class is extendable through custom validators (C++ only) and/or by subclassing and overriding the value() method.
Definition at line 47 of file qgsserverquerystringparameter.h.
|
strong |
The Type enum represents the parameter type.
Enumerator | |
---|---|
String | |
Integer | parameter is a string |
Double | parameter is an integer |
Boolean | parameter is a double |
List | parameter is a boolean |
Definition at line 60 of file qgsserverquerystringparameter.h.
QgsServerQueryStringParameter::QgsServerQueryStringParameter | ( | const QString | name, |
bool | required = false , |
||
QgsServerQueryStringParameter::Type | type = QgsServerQueryStringParameter::Type::String , |
||
const QString & | description = QString() , |
||
const QVariant & | defaultValue = QVariant() |
||
) |
Constructs a QgsServerQueryStringParameter object.
name | parameter name |
required | |
type | the parameter type |
description | parameter description |
defaultValue | default value, it is ignored if the parameter is required |
Definition at line 22 of file qgsserverquerystringparameter.cpp.
|
virtual |
Definition at line 35 of file qgsserverquerystringparameter.cpp.
json QgsServerQueryStringParameter::data | ( | ) | const |
Returns the handler information as a JSON object.
Definition at line 116 of file qgsserverquerystringparameter.cpp.
QString QgsServerQueryStringParameter::description | ( | ) | const |
Returns parameter description.
Definition at line 142 of file qgsserverquerystringparameter.cpp.
QString QgsServerQueryStringParameter::name | ( | ) | const |
Returns the name of the parameter.
Definition at line 153 of file qgsserverquerystringparameter.cpp.
void QgsServerQueryStringParameter::setCustomValidator | ( | const customValidator & | customValidator | ) |
Sets the custom validation function to customValidator.
Validator function signature is: bool ( const QgsServerApiContext &context, QVariant &value )
true
if the validation passed Definition at line 111 of file qgsserverquerystringparameter.cpp.
void QgsServerQueryStringParameter::setDescription | ( | const QString & | description | ) |
Sets validator description.
Definition at line 158 of file qgsserverquerystringparameter.cpp.
|
static |
Returns the name of the type.
Definition at line 147 of file qgsserverquerystringparameter.cpp.
|
virtual |
Extracts the value from the request context by validating the parameter value and converting it to its proper Type.
If the value is not set and a default was not provided an invalid QVariant is returned.
Validation steps:
QgsServerApiBadRequestError | if validation fails |
Definition at line 40 of file qgsserverquerystringparameter.cpp.
|
friend |
Definition at line 152 of file qgsserverquerystringparameter.h.