QGIS API Documentation 3.41.0-Master (af5edcb665c)
Loading...
Searching...
No Matches
Public Member Functions | Static Public Member Functions | Public Attributes | List of all members
QgsServerParameterDefinition Class Reference

Definition of a parameter with basic conversion methods. More...

#include <qgsserverparameters.h>

Inheritance diagram for QgsServerParameterDefinition:
Inheritance graph
[legend]

Public Member Functions

 QgsServerParameterDefinition (const QMetaType::Type type=QMetaType::Type::QString, const QVariant defaultValue=QVariant(""))
 Constructor for QgsServerParameterDefinition.
 
Q_DECL_DEPRECATED QgsServerParameterDefinition (const QVariant::Type type, const QVariant defaultValue=QVariant("")) SIP_DEPRECATED
 Constructor for QgsServerParameterDefinition.
 
virtual ~QgsServerParameterDefinition ()=default
 
virtual bool isValid () const
 Returns true if the parameter is valid, false otherwise.
 
QString loadUrl (bool &ok) const
 Loads the data associated to the parameter converted into an url.
 
bool toBool () const
 Converts the parameter into a boolean.
 
QColor toColor (bool &ok) const
 Converts the parameter into a color.
 
QList< QColor > toColorList (bool &ok, char delimiter=',') const
 Converts the parameter into a list of colors.
 
double toDouble (bool &ok) const
 Converts the parameter into a double.
 
QList< double > toDoubleList (bool &ok, char delimiter=',') const
 Converts the parameter into a list of doubles.
 
QStringList toExpressionList () const
 Converts the parameter into a list of QGIS expressions.
 
QList< QgsGeometrytoGeomList (bool &ok, char delimiter=',') const
 Converts the parameter into a list of geometries.
 
int toInt (bool &ok) const
 Converts the parameter into an integer.
 
QList< int > toIntList (bool &ok, char delimiter=',') const
 Converts the parameter into a list of integers.
 
QStringList toOgcFilterList () const
 Converts the parameter into a list of OGC filters.
 
QgsRectangle toRectangle (bool &ok) const
 Converts the parameter into a rectangle.
 
QString toString (bool defaultValue=false) const
 Converts the parameter into a string.
 
QStringList toStringList (char delimiter=',', bool skipEmptyParts=true) const
 Converts the parameter into a list of strings.
 
QUrl toUrl (bool &ok) const
 Converts the parameter into an url.
 
QString typeName () const
 Returns the type of the parameter as a string.
 

Static Public Member Functions

static void raiseError (const QString &msg)
 Raises an exception in case of an invalid parameters.
 

Public Attributes

QVariant mDefaultValue
 
QMetaType::Type mType
 
QVariant mValue
 

Detailed Description

Definition of a parameter with basic conversion methods.

Since
QGIS 3.4

Definition at line 34 of file qgsserverparameters.h.

Constructor & Destructor Documentation

◆ QgsServerParameterDefinition() [1/2]

QgsServerParameterDefinition::QgsServerParameterDefinition ( const QMetaType::Type  type = QMetaType::Type::QString,
const QVariant  defaultValue = QVariant( "" ) 
)

Constructor for QgsServerParameterDefinition.

Parameters
typeThe type of the parameter
defaultValueThe default value of the parameter

Definition at line 33 of file qgsserverparameters.cpp.

◆ QgsServerParameterDefinition() [2/2]

QgsServerParameterDefinition::QgsServerParameterDefinition ( const QVariant::Type  type,
const QVariant  defaultValue = QVariant( "" ) 
)

Constructor for QgsServerParameterDefinition.

Parameters
typeThe type of the parameter
defaultValueThe default value of the parameter
Deprecated:
QGIS 3.38. Use the method with a QMetaType::Type argument instead.

Definition at line 39 of file qgsserverparameters.cpp.

◆ ~QgsServerParameterDefinition()

virtual QgsServerParameterDefinition::~QgsServerParameterDefinition ( )
virtualdefault

Member Function Documentation

◆ isValid()

bool QgsServerParameterDefinition::isValid ( ) const
virtual

Returns true if the parameter is valid, false otherwise.

Reimplemented in QgsWms::QgsWmsParameter.

Definition at line 407 of file qgsserverparameters.cpp.

◆ loadUrl()

QString QgsServerParameterDefinition::loadUrl ( bool &  ok) const

Loads the data associated to the parameter converted into an url.

Parameters
oktrue if there's no error during the load, false otherwise
Returns
The content loaded
Since
QGIS 3.4

Definition at line 320 of file qgsserverparameters.cpp.

◆ raiseError()

void QgsServerParameterDefinition::raiseError ( const QString &  msg)
static

Raises an exception in case of an invalid parameters.

Parameters
msgThe message describing the exception
Exceptions
QgsBadRequestExceptionInvalid parameter exception

Definition at line 412 of file qgsserverparameters.cpp.

◆ toBool()

bool QgsServerParameterDefinition::toBool ( ) const

Converts the parameter into a boolean.

Returns
A boolean

Definition at line 382 of file qgsserverparameters.cpp.

◆ toColor()

QColor QgsServerParameterDefinition::toColor ( bool &  ok) const

Converts the parameter into a color.

Parameters
oktrue if there's no error during the conversion, false otherwise
Returns
A color

Definition at line 49 of file qgsserverparameters.cpp.

◆ toColorList()

QList< QColor > QgsServerParameterDefinition::toColorList ( bool &  ok,
char  delimiter = ',' 
) const

Converts the parameter into a list of colors.

Parameters
oktrue if there's no error during the conversion, false otherwise
delimiterThe character used for delimiting
Returns
A list of colors

Definition at line 205 of file qgsserverparameters.cpp.

◆ toDouble()

double QgsServerParameterDefinition::toDouble ( bool &  ok) const

Converts the parameter into a double.

Parameters
oktrue if there's no error during the conversion, false otherwise
Returns
A double

Definition at line 394 of file qgsserverparameters.cpp.

◆ toDoubleList()

QList< double > QgsServerParameterDefinition::toDoubleList ( bool &  ok,
char  delimiter = ',' 
) const

Converts the parameter into a list of doubles.

Parameters
oktrue if there's no error during the conversion, false otherwise
delimiterThe character used for delimiting
Returns
A list of doubles

Definition at line 258 of file qgsserverparameters.cpp.

◆ toExpressionList()

QStringList QgsServerParameterDefinition::toExpressionList ( ) const

Converts the parameter into a list of QGIS expressions.

Returns
A list of strings
Since
QGIS 3.24

Definition at line 162 of file qgsserverparameters.cpp.

◆ toGeomList()

QList< QgsGeometry > QgsServerParameterDefinition::toGeomList ( bool &  ok,
char  delimiter = ',' 
) const

Converts the parameter into a list of geometries.

Parameters
oktrue if there's no error during the conversion, false otherwise
delimiterThe character used for delimiting
Returns
A list of geometries

Definition at line 98 of file qgsserverparameters.cpp.

◆ toInt()

int QgsServerParameterDefinition::toInt ( bool &  ok) const

Converts the parameter into an integer.

Parameters
oktrue if there's no error during the conversion, false otherwise
Returns
An integer

Definition at line 369 of file qgsserverparameters.cpp.

◆ toIntList()

QList< int > QgsServerParameterDefinition::toIntList ( bool &  ok,
char  delimiter = ',' 
) const

Converts the parameter into a list of integers.

Parameters
oktrue if there's no error during the conversion, false otherwise
delimiterThe character used for delimiting
Returns
A list of integers

Definition at line 237 of file qgsserverparameters.cpp.

◆ toOgcFilterList()

QStringList QgsServerParameterDefinition::toOgcFilterList ( ) const

Converts the parameter into a list of OGC filters.

Returns
A list of strings
Since
QGIS 3.24

Definition at line 122 of file qgsserverparameters.cpp.

◆ toRectangle()

QgsRectangle QgsServerParameterDefinition::toRectangle ( bool &  ok) const

Converts the parameter into a rectangle.

Parameters
oktrue if there's no error during the conversion, false otherwise
Returns
A rectangle

Definition at line 279 of file qgsserverparameters.cpp.

◆ toString()

QString QgsServerParameterDefinition::toString ( bool  defaultValue = false) const

Converts the parameter into a string.

If defaultValue is true and current value is empty, then the default value is returned.

Definition at line 71 of file qgsserverparameters.cpp.

◆ toStringList()

QStringList QgsServerParameterDefinition::toStringList ( char  delimiter = ',',
bool  skipEmptyParts = true 
) const

Converts the parameter into a list of strings.

Parameters
delimiterThe character used for delimiting
skipEmptyPartsTo use QString::SkipEmptyParts for splitting
Returns
A list of strings

Definition at line 81 of file qgsserverparameters.cpp.

◆ toUrl()

QUrl QgsServerParameterDefinition::toUrl ( bool &  ok) const

Converts the parameter into an url.

Parameters
oktrue if there's no error during the conversion, false otherwise
Returns
An url
Since
QGIS 3.4

Definition at line 355 of file qgsserverparameters.cpp.

◆ typeName()

QString QgsServerParameterDefinition::typeName ( ) const

Returns the type of the parameter as a string.

Definition at line 44 of file qgsserverparameters.cpp.

Member Data Documentation

◆ mDefaultValue

QVariant QgsServerParameterDefinition::mDefaultValue

Definition at line 184 of file qgsserverparameters.h.

◆ mType

QMetaType::Type QgsServerParameterDefinition::mType

Definition at line 182 of file qgsserverparameters.h.

◆ mValue

QVariant QgsServerParameterDefinition::mValue

Definition at line 183 of file qgsserverparameters.h.


The documentation for this class was generated from the following files: