Skip to content

Commit

Permalink
[sipify] Fix loss of class docstring if newline present between
Browse files Browse the repository at this point in the history
class doxygen and class definition
  • Loading branch information
nyalldawson committed Apr 17, 2017
1 parent d6e3da6 commit 798c318
Show file tree
Hide file tree
Showing 12 changed files with 93 additions and 3 deletions.
4 changes: 4 additions & 0 deletions python/core/annotations/qgshtmlannotation.sip
Expand Up @@ -14,6 +14,10 @@

class QgsHtmlAnnotation: QgsAnnotation
{
%Docstring
An annotation item that embeds HTML content.
.. versionadded:: 3.0
%End

%TypeHeaderCode
#include "qgshtmlannotation.h"
Expand Down
6 changes: 6 additions & 0 deletions python/core/qgsactionmanager.sip
Expand Up @@ -14,6 +14,12 @@

class QgsActionManager
{
%Docstring
Storage and management of actions associated with a layer.

Actions can trigger custom code or applications to be executed
based on attributes of a given feature.
%End

%TypeHeaderCode
#include "qgsactionmanager.h"
Expand Down
9 changes: 9 additions & 0 deletions python/core/qgsattributeeditorelement.sip
Expand Up @@ -11,6 +11,15 @@

class QgsAttributeEditorElement /Abstract/
{
%Docstring
This is an abstract base class for any elements of a drag and drop form.

This can either be a container which will be represented on the screen
as a tab widget or ca collapsible group box. Or it can be a field which will
then be represented based on the QgsEditorWidget type and configuration.
Or it can be a relation and embed the form of several children of another
layer.
%End

%TypeHeaderCode
#include "qgsattributeeditorelement.h"
Expand Down
5 changes: 5 additions & 0 deletions python/core/qgsattributetableconfig.sip
Expand Up @@ -12,6 +12,11 @@

class QgsAttributeTableConfig
{
%Docstring
This is a container for configuration of the attribute table.
The configuration is specific for one vector layer.
.. versionadded:: 2.16
%End

%TypeHeaderCode
#include "qgsattributetableconfig.h"
Expand Down
12 changes: 12 additions & 0 deletions python/core/qgsclipper.sip
Expand Up @@ -34,9 +34,21 @@ class QgsClipper


static const double MAX_X;
%Docstring
Maximum X-coordinate of the rectangular box used for clipping.
%End
static const double MIN_X;
%Docstring
Minimum X-coordinate of the rectangular box used for clipping.
%End
static const double MAX_Y;
%Docstring
Maximum Y-coordinate of the rectangular box used for clipping.
%End
static const double MIN_Y;
%Docstring
Minimum Y-coordinate of the rectangular box used for clipping.
%End


enum Boundary
Expand Down
32 changes: 32 additions & 0 deletions python/core/qgspropertytransformer.sip
Expand Up @@ -12,6 +12,24 @@

class QgsCurveTransform
{
%Docstring
Handles scaling of input values to output values by using a curve created
from smoothly joining a number of set control points.

QgsCurveTransform assists in creation of curve type transforms, typically seen in
raster image editing software (eg the curves dialog in GIMP or Photoshop).
Transforms are created by passing a number of set control points through which
the transform curve must pass. The curve is guaranteed to exactly pass through
these control points. Between control points the curve is smoothly interpolated
so that no disjoint sections or "corners" are present.

If the first or last control point are not located at x = 0 and x = 1 respectively,
then values outside this range will be mapped to the y value of either the first
or last control point. In other words, the curve will have a flat segment
for values outside of the control point range.

.. versionadded:: 3.0
%End

%TypeHeaderCode
#include "qgspropertytransformer.h"
Expand Down Expand Up @@ -297,6 +315,10 @@ class QgsPropertyTransformer

class QgsGenericNumericTransformer : QgsPropertyTransformer
{
%Docstring
QgsPropertyTransformer subclass for scaling an input numeric value into an output numeric value.
.. versionadded:: 3.0
%End

%TypeHeaderCode
#include "qgspropertytransformer.h"
Expand Down Expand Up @@ -437,6 +459,11 @@ class QgsGenericNumericTransformer : QgsPropertyTransformer

class QgsSizeScaleTransformer : QgsPropertyTransformer
{
%Docstring
QgsPropertyTransformer subclass for scaling a value into a size according to various
scaling methods.
.. versionadded:: 3.0
%End

%TypeHeaderCode
#include "qgspropertytransformer.h"
Expand Down Expand Up @@ -604,6 +631,11 @@ class QgsSizeScaleTransformer : QgsPropertyTransformer

class QgsColorRampTransformer : QgsPropertyTransformer
{
%Docstring
QgsPropertyTransformer subclass for transforming a numeric value into a color from a
color ramp.
.. versionadded:: 3.0
%End

%TypeHeaderCode
#include "qgspropertytransformer.h"
Expand Down
5 changes: 5 additions & 0 deletions python/gui/qgscheckablecombobox.sip
Expand Up @@ -15,6 +15,11 @@

class QgsCheckableComboBox : QComboBox
{
%Docstring
QComboBox subclass which allows selecting multiple items.
.. versionadded:: 3.0
*
%End

%TypeHeaderCode
#include "qgscheckablecombobox.h"
Expand Down
3 changes: 3 additions & 0 deletions python/gui/qgsmessagelogviewer.sip
Expand Up @@ -28,6 +28,9 @@ class QgsMessageLogViewer: QDialog
%End

public slots:
%Docstring
TODO QGIS 3.0: remove statusBar (it's unused)
%End
void logMessage( QString message, QString tag, QgsMessageLog::MessageLevel level );

protected:
Expand Down
8 changes: 7 additions & 1 deletion scripts/sipify.pl
Expand Up @@ -180,6 +180,7 @@ sub processDoxygenLine

# SIP_SKIP
if ( $line =~ m/SIP_SKIP/ ){
$comment = '';
next;
}

Expand Down Expand Up @@ -292,6 +293,7 @@ sub processDoxygenLine
}
print $line;
# enums don't have Docstring apparently
$comment = '';
next;
}

Expand Down Expand Up @@ -424,7 +426,11 @@ sub processDoxygenLine
}

# write comment
if ( $line =~ m/^\s*$/ || $line =~ m/\/\// || $line =~ m/\s*typedef / || $line =~ m/\s*struct / ){
if ( $line =~ m/^\s*$/ )
{
next;
}
elsif ( $line =~ m/\/\// || $line =~ m/\s*typedef / || $line =~ m/\s*struct / ){
$comment = '';
}
elsif ( $comment !~ m/^\s*$/ || $return_type ne ''){
Expand Down
6 changes: 4 additions & 2 deletions src/core/qgsclipper.h
Expand Up @@ -45,8 +45,6 @@ class CORE_EXPORT QgsClipper
{
public:

// Coordinates of the rectangular box that we trim to.
//
// These are the limits for X11 screen coordinates. The actual
// values are +/-32767, but we allow a little bit of space for
// rounding errors.
Expand All @@ -64,9 +62,13 @@ class CORE_EXPORT QgsClipper
// The limit is set to 30,000 instead of 32768 because that things
// still go wrong.

//! Maximum X-coordinate of the rectangular box used for clipping.
static const double MAX_X;
//! Minimum X-coordinate of the rectangular box used for clipping.
static const double MIN_X;
//! Maximum Y-coordinate of the rectangular box used for clipping.
static const double MAX_Y;
//! Minimum Y-coordinate of the rectangular box used for clipping.
static const double MIN_Y;


Expand Down
3 changes: 3 additions & 0 deletions tests/scripts/sipifyheader.expected.sip
Expand Up @@ -116,6 +116,8 @@ A multiline method signature
%End


void nonAnnotatedMethodFollowingSkip();

virtual QgsMapLayerRenderer *createMapRenderer( QgsRenderContext &rendererContext ) /Factory/;
%Docstring
Factory annotation
Expand Down Expand Up @@ -264,6 +266,7 @@ A constructor with definition in header on several lines

};


class AbstractClass /Abstract/
{
%Docstring
Expand Down
3 changes: 3 additions & 0 deletions tests/scripts/sipifyheader.h
Expand Up @@ -154,6 +154,8 @@ class CORE_EXPORT QgsSipifyHeader : public QtClass<QVariant>, private Ui::QgsBas
// Adding SIP_SKIP at the end of a line will discard this MethodCode
bool thisShouldBeSkipped() const SIP_SKIP;

void nonAnnotatedMethodFollowingSkip();

//! Factory annotation
virtual QgsMapLayerRenderer *createMapRenderer( QgsRenderContext &rendererContext ) override SIP_FACTORY;

Expand Down Expand Up @@ -286,6 +288,7 @@ class CORE_EXPORT ClassWithPrivateInheritanceOnly : private QgsBaseClass
* \ingroup core
* Documentation goes here
*/

class CORE_EXPORT AbstractClass SIP_ABSTRACT
{
public:
Expand Down

0 comments on commit 798c318

Please sign in to comment.