Skip to content
Permalink
Browse files

Add doc for QgsServerParameterDefinition

  • Loading branch information
pblottiere committed Jul 20, 2018
1 parent edeac1d commit fb75580b650da0d2ba48397b2ab414c706f5b2c7
Showing with 207 additions and 7 deletions.
  1. +111 −7 python/server/auto_generated/qgsserverparameters.sip.in
  2. +96 −0 src/server/qgsserverparameters.h
@@ -12,41 +12,145 @@
class QgsServerParameterDefinition
{
%Docstring
*************************************************************************
Definition of a parameter with basic conversion methods

This program is free software; you can redistribute it and/or modify *
it under the terms of the GNU General Public License as published by *
the Free Software Foundation; either version 2 of the License, or *
(at your option) any later version. *

**************************************************************************
.. versionadded:: 3.4
%End

%TypeHeaderCode
#include "qgsserverparameters.h"
%End
public:

QgsServerParameterDefinition( const QVariant::Type type = QVariant::String,
const QVariant defaultValue = QVariant( "" ) );
%Docstring
Constructor for QgsServerParameterDefinition.

:param type: The type of the parameter
:param defaultValue: The default value of the parameter
%End

virtual ~QgsServerParameterDefinition();

QString typeName() const;
%Docstring
Returns the type of the parameter as a string.
%End

virtual bool isValid() const;
%Docstring
Returns true if the parameter is valid, false otherwise.
%End

QString toString() const;
%Docstring
Converts the parameter into a string.
%End

QStringList toStringList( char delimiter = ',' ) const;
%Docstring
Converts the parameter into a list of strings.

:param delimiter: The character used for delimiting

:return: A list of strings
%End

QList<int> toIntList( bool &ok, char delimiter = ',' ) const;
%Docstring
Converts the parameter into a list of integers.

:param ok: True if there's no error during the conversion, false otherwise
:param delimiter: The character used for delimiting

:return: A list of integers
%End

QList<double> toDoubleList( bool &ok, char delimiter = ',' ) const;
%Docstring
Converts the parameter into a list of doubles.

:param ok: True if there's no error during the conversion, false otherwise
:param delimiter: The character used for delimiting

:return: A list of doubles
%End

QList<QColor> toColorList( bool &ok, char delimiter = ',' ) const;
%Docstring
Converts the parameter into a list of colors.

:param ok: True if there's no error during the conversion, false otherwise
:param delimiter: The character used for delimiting

:return: A list of colors
%End

QList<QgsGeometry> toGeomList( bool &ok, char delimiter = ',' ) const;
%Docstring
Converts the parameter into a list of geometries.

:param ok: True if there's no error during the conversion, false otherwise
:param delimiter: The character used for delimiting

:return: A list of geometries
%End

QgsRectangle toRectangle( bool &ok ) const;
%Docstring
Converts the parameter into a rectangle.

:param ok: True if there's no error during the conversion, false otherwise

:return: A rectangle
%End

int toInt( bool &ok ) const;
%Docstring
Converts the parameter into an integer.

:param ok: True if there's no error during the conversion, false otherwise

:return: An integer
%End

double toDouble( bool &ok ) const;
%Docstring
Converts the parameter into a double.

:param ok: True if there's no error during the conversion, false otherwise

:return: A double
%End

bool toBool() const;
%Docstring
Converts the parameter into a boolean.

:param ok: True if there's no error during the conversion, false otherwise
:param delimiter: The character used for delimiting

:return: A boolean
%End

QColor toColor( bool &ok ) const;
%Docstring
Converts the parameter into a color.

:param ok: True if there's no error during the conversion, false otherwise
:param delimiter: The character used for delimiting

:return: A color
%End

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

:param msg: The message describing the exception
\throws QgsBadRequestException Invalid parameter exception
%End

QVariant::Type mType;
QVariant mValue;
@@ -26,29 +26,125 @@
#include "qgsgeometry.h"
#include "qgis_server.h"

/**
* \ingroup server
* \class QgsServerParameterDefinition
* \brief Definition of a parameter with basic conversion methods
* \since QGIS 3.4
*/
class SERVER_EXPORT QgsServerParameterDefinition
{
public:

/**
* Constructor for QgsServerParameterDefinition.
* \param type The type of the parameter
* \param defaultValue The default value of the parameter
*/
QgsServerParameterDefinition( const QVariant::Type type = QVariant::String,
const QVariant defaultValue = QVariant( "" ) );

/**
* Default destructor for QgsServerParameterDefinition.
*/
virtual ~QgsServerParameterDefinition() = default;

/**
* Returns the type of the parameter as a string.
*/
QString typeName() const;

/**
* Returns true if the parameter is valid, false otherwise.
*/
virtual bool isValid() const;

/**
* Converts the parameter into a string.
*/
QString toString() const;

/**
* Converts the parameter into a list of strings.
* \param delimiter The character used for delimiting
* \returns A list of strings
*/
QStringList toStringList( char delimiter = ',' ) const;

/**
* Converts the parameter into a list of integers.
* \param ok True if there's no error during the conversion, false otherwise
* \param delimiter The character used for delimiting
* \returns A list of integers
*/
QList<int> toIntList( bool &ok, char delimiter = ',' ) const;

/**
* Converts the parameter into a list of doubles.
* \param ok True if there's no error during the conversion, false otherwise
* \param delimiter The character used for delimiting
* \returns A list of doubles
*/
QList<double> toDoubleList( bool &ok, char delimiter = ',' ) const;

/**
* Converts the parameter into a list of colors.
* \param ok True if there's no error during the conversion, false otherwise
* \param delimiter The character used for delimiting
* \returns A list of colors
*/
QList<QColor> toColorList( bool &ok, char delimiter = ',' ) const;

/**
* Converts the parameter into a list of geometries.
* \param ok True if there's no error during the conversion, false otherwise
* \param delimiter The character used for delimiting
* \returns A list of geometries
*/
QList<QgsGeometry> toGeomList( bool &ok, char delimiter = ',' ) const;

/**
* Converts the parameter into a rectangle.
* \param ok True if there's no error during the conversion, false otherwise
* \returns A rectangle
*/
QgsRectangle toRectangle( bool &ok ) const;

/**
* Converts the parameter into an integer.
* \param ok True if there's no error during the conversion, false otherwise
* \returns An integer
*/
int toInt( bool &ok ) const;

/**
* Converts the parameter into a double.
* \param ok True if there's no error during the conversion, false otherwise
* \returns A double
*/
double toDouble( bool &ok ) const;

/**
* Converts the parameter into a boolean.
* \param ok True if there's no error during the conversion, false otherwise
* \param delimiter The character used for delimiting
* \returns A boolean
*/
bool toBool() const;

/**
* Converts the parameter into a color.
* \param ok True if there's no error during the conversion, false otherwise
* \param delimiter The character used for delimiting
* \returns A color
*/
QColor toColor( bool &ok ) const;

/**
* Raises an exception in case of an invalid parameters.
* \param msg The message describing the exception
* \throws QgsBadRequestException Invalid parameter exception
*/
static void raiseError( const QString &msg );

QVariant::Type mType;

0 comments on commit fb75580

Please sign in to comment.
You can’t perform that action at this time.