The QgsServerQueryStringParameter class holds the information regarding a query string input parameter and its validation.
More...
#include <qgsserverquerystringparameter.h>
|
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...
|
|
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.
- Since
- QGIS 3.10
Definition at line 47 of file qgsserverquerystringparameter.h.
◆ Type
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()
QgsServerQueryStringParameter::~QgsServerQueryStringParameter |
( |
| ) |
|
|
virtual |
◆ data()
json QgsServerQueryStringParameter::data |
( |
| ) |
const |
◆ description()
QString QgsServerQueryStringParameter::description |
( |
| ) |
const |
◆ hidden()
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.
- Since
- QGIS 3.28
Definition at line 163 of file qgsserverquerystringparameter.cpp.
◆ name()
QString QgsServerQueryStringParameter::name |
( |
| ) |
const |
◆ setCustomValidator()
void QgsServerQueryStringParameter::setCustomValidator |
( |
const customValidator & |
customValidator | ) |
|
Sets the custom validation function to customValidator.
Validator function signature is: bool ( const QgsServerApiContext &context, QVariant &value )
- Note
- a validator can change the value if needed and must return
true
if the validation passed
-
not available in Python bindings
Definition at line 111 of file qgsserverquerystringparameter.cpp.
◆ setDescription()
void QgsServerQueryStringParameter::setDescription |
( |
const QString & |
description | ) |
|
◆ setHidden()
void QgsServerQueryStringParameter::setHidden |
( |
bool |
hidden | ) |
|
◆ typeName()
QString QgsServerQueryStringParameter::typeName |
( |
const Type |
type | ) |
|
|
static |
◆ value()
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:
- required
- can convert to proper Type
- custom validator (if set - not available in Python bindings)
- See also
- setCustomValidator() (not available in Python bindings)
- Returns
- the parameter value or an invalid QVariant if not found (and not required)
- Exceptions
-
QgsServerApiBadRequestError | if validation fails |
Definition at line 40 of file qgsserverquerystringparameter.cpp.
◆ TestQgsServerQueryStringParameter
friend class TestQgsServerQueryStringParameter |
|
friend |
The documentation for this class was generated from the following files: