QGIS API Documentation 3.40.0-Bratislava (b56115d8743)
|
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 = 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 |
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.
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.
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 163 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.
void QgsServerQueryStringParameter::setHidden | ( | bool | hidden | ) |
Set the parameter's hidden status, parameters are not hidden by default.
Definition at line 168 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 170 of file qgsserverquerystringparameter.h.