Skip to content
Permalink
Browse files
[sipify] Add return types for functions in docstrings
and change \return -> :return: in docystrings
  • Loading branch information
nyalldawson committed Apr 7, 2017
1 parent 8c5e241 commit bfd37e1122d3eada6d0293d8b3e6b9a898f394e3
@@ -44,6 +44,7 @@ class QgsAnnotationManager : QObject
Returns true if the addition was successful, or false if the annotation could not be added.
\see removeAnnotation()
\see annotationAdded()
:rtype: bool
%End

bool removeAnnotation( QgsAnnotation *annotation );
@@ -55,6 +56,7 @@ class QgsAnnotationManager : QObject
\see compositionRemoved()
\see compositionAboutToBeRemoved()
\see clear()
:rtype: bool
%End

void clear();
@@ -66,19 +68,22 @@ class QgsAnnotationManager : QObject
QList< QgsAnnotation * > annotations() const;
%Docstring
Returns a list of all annotations contained in the manager.
:rtype: list of QgsAnnotation
%End

bool readXml( const QDomElement &element, const QDomDocument &doc );
%Docstring
Reads the manager's state from a DOM element, restoring all annotations
present in the XML document.
\see writeXml()
:rtype: bool
%End

QDomElement writeXml( QDomDocument &doc ) const;
%Docstring
Returns a DOM element representing the state of the manager.
\see readXml()
:rtype: QDomElement
%End

signals:
@@ -28,6 +28,9 @@ class QgsHtmlAnnotation: QgsAnnotation
~QgsHtmlAnnotation();

QSizeF minimumFrameSize() const;
%Docstring
:rtype: QSizeF
%End

void setSourceFile( const QString &htmlFile );
%Docstring
@@ -39,6 +42,7 @@ class QgsHtmlAnnotation: QgsAnnotation
%Docstring
Returns the file path for the source HTML file.
\see setSourceFile()
:rtype: str
%End

virtual void writeXml( QDomElement &elem, QDomDocument &doc ) const;
@@ -49,6 +53,7 @@ class QgsHtmlAnnotation: QgsAnnotation
static QgsHtmlAnnotation *create() /Factory/;
%Docstring
Returns a new QgsHtmlAnnotation object.
:rtype: QgsHtmlAnnotation
%End

protected:
@@ -39,11 +39,13 @@ class QgsSvgAnnotation: QgsAnnotation
%Docstring
Returns the file path for the source SVG file.
\see setFilePath()
:rtype: str
%End

static QgsSvgAnnotation *create() /Factory/;
%Docstring
Returns a new QgsSvgAnnotation object.
:rtype: QgsSvgAnnotation
%End

protected:
@@ -31,6 +31,7 @@ class QgsTextAnnotation: QgsAnnotation
Returns the text document which will be rendered
within the annotation.
\see setDocument()
:rtype: QTextDocument
%End

void setDocument( const QTextDocument *doc );
@@ -46,6 +47,7 @@ class QgsTextAnnotation: QgsAnnotation
static QgsTextAnnotation *create() /Factory/;
%Docstring
Returns a new QgsTextAnnotation object.
:rtype: QgsTextAnnotation
%End

protected:
@@ -49,6 +49,7 @@ class QgsProcessingAlgorithm
\see displayName()
\see group()
\see tags()
:rtype: str
%End

QString id() const;
@@ -57,48 +58,56 @@ class QgsProcessingAlgorithm
provider's ID and the algorithms unique name (e.g. "qgis:mergelayers" ).
\see name()
\see provider()
:rtype: str
%End

virtual QString displayName() const = 0;
%Docstring
Returns the translated algorithm name, which should be used for any user-visible display
of the algorithm name.
\see name()
:rtype: str
%End

virtual QStringList tags() const;
%Docstring
Returns a list of tags which relate to the algorithm, and are used to assist users in searching
for suitable algorithms. These tags should be localised.
:rtype: list of str
%End

virtual QIcon icon() const;
%Docstring
Returns an icon for the algorithm.
\see svgIconPath()
:rtype: QIcon
%End

virtual QString svgIconPath() const;
%Docstring
Returns a path to an SVG version of the algorithm's icon.
\see icon()
:rtype: str
%End

virtual QString group() const;
%Docstring
Returns the name of the group this algorithm belongs to. This string
should be localised.
\see tags()
:rtype: str
%End

virtual Flags flags() const;
%Docstring
Returns the flags indicating how and when the algorithm operates and should be exposed to users.
:rtype: Flags
%End

QgsProcessingProvider *provider() const;
%Docstring
Returns the provider to which this algorithm belongs.
:rtype: QgsProcessingProvider
%End

private:
@@ -36,12 +36,14 @@ class QgsProcessingProvider : QObject
%Docstring
Returns an icon for the provider.
\see svgIconPath()
:rtype: QIcon
%End

virtual QString svgIconPath() const;
%Docstring
Returns a path to an SVG version of the provider's icon.
\see icon()
:rtype: str
%End

virtual QString id() const = 0;
@@ -50,32 +52,37 @@ class QgsProcessingProvider : QObject
should be a unique, short, character only string, eg "qgis" or "gdal". This
string should not be localised.
\see name()
:rtype: str
%End

virtual QString name() const = 0;
%Docstring
Returns the full provider name, which is used to describe the provider within the GUI.
This string should be localised.
\see id()
:rtype: str
%End

virtual bool canBeActivated() const;
%Docstring
Returns true if the provider can be activated, or false if it cannot be activated (e.g. due to
missing external dependencies).
\see isActive()
:rtype: bool
%End

virtual bool isActive() const;
%Docstring
Returns true if the provider is active and able to run algorithms.
:rtype: bool
%End

virtual QStringList supportedOutputRasterLayerExtensions() const;
%Docstring
Returns a list of the raster format file extensions supported by this provider.
\see supportedOutputVectorLayerExtensions()
\see supportedOutputTableExtensions()
:rtype: list of str
%End

virtual QStringList supportedOutputVectorLayerExtensions() const;
@@ -84,20 +91,23 @@ class QgsProcessingProvider : QObject
\see supportedOutputRasterLayerExtensions()
\see supportedOutputTableExtensions()
\see supportsNonFileBasedOutput()
:rtype: list of str
%End

virtual QStringList supportedOutputTableExtensions() const;
%Docstring
Returns a list of the table format file extensions supported by this provider.
\see supportedOutputRasterLayerExtensions()
\see supportedOutputVectorLayerExtensions()
:rtype: list of str
%End

virtual bool supportsNonFileBasedOutput() const;
%Docstring
Returns true if the provider supports non-file based outputs (such as memory layers
or direct database outputs).
\see supportedOutputVectorLayerExtensions()
:rtype: bool
%End

virtual bool load();
@@ -107,8 +117,9 @@ class QgsProcessingProvider : QObject
Subclasses should not individually load any algorithms in their load() implementations, as that must
occur within the loadAlgorithms() method. Instead, subclasses should call refreshAlgorithms()
from any overloaded load() method to trigger an initial load of the provider's algorithms.
\returns true if provider could be successfully loaded
:return: true if provider could be successfully loaded
\see unload()
:rtype: bool
%End

virtual void unload();
@@ -126,13 +137,15 @@ class QgsProcessingProvider : QObject
%Docstring
Returns a list of algorithms supplied by this provider.
\see algorithm()
:rtype: list of const QgsProcessingAlgorithm
%End

const QgsProcessingAlgorithm *algorithm( const QString &name ) const;
%Docstring
Returns the matching algorithm by name, or a None if no matching
algorithm is contained by this provider.
\see algorithms()
:rtype: QgsProcessingAlgorithm
%End

signals:
@@ -155,6 +168,7 @@ class QgsProcessingProvider : QObject
bool addAlgorithm( QgsProcessingAlgorithm *algorithm /Transfer/ );
%Docstring
Adds an algorithm to the provider. Ownership of the algorithm is transferred to the provider.
:rtype: bool
%End

private:
@@ -37,6 +37,7 @@ class QgsProcessingRegistry : QObject
QList<QgsProcessingProvider *> providers() const;
%Docstring
Get list of available providers.
:rtype: list of QgsProcessingProvider
%End

bool addProvider( QgsProcessingProvider *provider /Transfer/ );
@@ -48,38 +49,44 @@ class QgsProcessingRegistry : QObject
Adding a provider to the registry automatically triggers the providers QgsProcessingProvider.load()
method to populate the provider with algorithms.
\see removeProvider()
:rtype: bool
%End

bool removeProvider( QgsProcessingProvider *provider );
%Docstring
Removes a provider implementation from the registry (the provider object is deleted).
Returns false if the provider could not be removed (eg provider does not exist in the registry).
\see addProvider()
:rtype: bool
%End

bool removeProvider( const QString &providerId );
%Docstring
Removes a provider implementation from the registry (the provider object is deleted).
Returns false if the provider could not be removed (eg provider does not exist in the registry).
\see addProvider()
:rtype: bool
%End

QgsProcessingProvider *providerById( const QString &id );
%Docstring
Returns a matching provider by provider ID.
:rtype: QgsProcessingProvider
%End

QList< const QgsProcessingAlgorithm *> algorithms() const;
%Docstring
Returns a list of all available algorithms from registered providers.
\see algorithmById()
:rtype: list of const QgsProcessingAlgorithm
%End

const QgsProcessingAlgorithm *algorithmById( const QString &id ) const;
%Docstring
Finds an algorithm by its ID. If no matching algorithm is found, a None
is returned.
\see algorithms()
:rtype: QgsProcessingAlgorithm
%End

signals:
@@ -33,6 +33,7 @@ class QgsProcessingUtils
value.
\see compatibleVectorLayers()
\see compatibleLayers()
:rtype: list of QgsRasterLayer
%End

static QList< QgsVectorLayer * > compatibleVectorLayers( QgsProject *project,
@@ -50,6 +51,7 @@ class QgsProcessingUtils
value.
\see compatibleRasterLayers()
\see compatibleLayers()
:rtype: list of QgsVectorLayer
%End

static QList< QgsMapLayer * > compatibleLayers( QgsProject *project, bool sort = true );
@@ -61,6 +63,7 @@ class QgsProcessingUtils
value.
\see compatibleRasterLayers()
\see compatibleVectorLayers()
:rtype: list of QgsMapLayer
%End


@@ -74,6 +77,7 @@ class QgsProcessingUtils
for layers in the specified project, then those matching layers will be
returned.
\see mapLayerFromString()
:rtype: QgsMapLayer
%End

static QgsMapLayer *mapLayerFromString( const QString &string ) /Factory/;
@@ -83,12 +87,14 @@ class QgsProcessingUtils
then the layer at this file path will be loaded.
The caller takes responsibility for deleting the returned map layer.
\see mapLayerFromProject()
:rtype: QgsMapLayer
%End

static QString normalizeLayerSource( const QString &source );
%Docstring
Normalizes a layer source string for safe comparison across different
operating system environments.
:rtype: str
%End

};
Loading

0 comments on commit bfd37e1

Please sign in to comment.