|
QGIS API Documentation 4.1.0-Master (5bf3c20f3c9)
|
Holds the information regarding a query string input parameter and its validation. More...
#include <qgsserverquerystringparameter.h>
Public Types | |
| enum class | Type { String = QMetaType::Type::QString , Integer = QMetaType::Type::LongLong , Double = QMetaType::Type::Double , Boolean = QMetaType::Type::Bool , List = QMetaType::Type::QStringList } |
| 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. | |
| virtual | ~QgsServerQueryStringParameter () |
| json | data () const |
| Returns the handler information as a JSON object. | |
| QString | description () const |
| Returns parameter description. | |
| bool | hidden () const |
Returns true if the parameter is hidden from the schema. | |
| QString | name () const |
| Returns the name of the parameter. | |
| void | setCustomValidator (const customValidator &customValidator) |
| Sets the custom validation function to customValidator. | |
| void | setDescription (const QString &description) |
| Sets validator description. | |
| void | setHidden (bool hidden) |
| Set the parameter's hidden status, parameters are not hidden by default. | |
| 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. | |
Static Public Member Functions | |
| static QString | typeName (const Type type) |
| Returns the name of the type. | |
Friends | |
| class | TestQgsServerQueryStringParameter |
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 46 of file qgsserverquerystringparameter.h.
|
strong |
The Type enum represents the parameter type.
Definition at line 57 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 30 of file qgsserverquerystringparameter.cpp.
|
virtual |
Definition at line 38 of file qgsserverquerystringparameter.cpp.
| json QgsServerQueryStringParameter::data | ( | ) | const |
Returns the handler information as a JSON object.
Definition at line 115 of file qgsserverquerystringparameter.cpp.
| QString QgsServerQueryStringParameter::description | ( | ) | const |
Returns parameter description.
Definition at line 140 of file qgsserverquerystringparameter.cpp.
| bool QgsServerQueryStringParameter::hidden | ( | ) | const |
Returns true if the parameter is hidden from the schema.
Hidden params can be useful to implement legacy parameters or parameters that can be accepted without being advertised.
Definition at line 161 of file qgsserverquerystringparameter.cpp.
| QString QgsServerQueryStringParameter::name | ( | ) | const |
Returns the name of the parameter.
Definition at line 151 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 110 of file qgsserverquerystringparameter.cpp.
| void QgsServerQueryStringParameter::setDescription | ( | const QString & | description | ) |
Sets validator description.
Definition at line 156 of file qgsserverquerystringparameter.cpp.
| void QgsServerQueryStringParameter::setHidden | ( | bool | hidden | ) |
Set the parameter's hidden status, parameters are not hidden by default.
Definition at line 166 of file qgsserverquerystringparameter.cpp.
|
static |
Returns the name of the type.
Definition at line 145 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 41 of file qgsserverquerystringparameter.cpp.
|
friend |
Definition at line 164 of file qgsserverquerystringparameter.h.