Skip to content

Commit

Permalink
[sipify] handle constrained annotation
Browse files Browse the repository at this point in the history
  • Loading branch information
3nids committed May 24, 2017
1 parent 563e7c1 commit f5e66dd
Show file tree
Hide file tree
Showing 8 changed files with 27 additions and 6 deletions.
1 change: 1 addition & 0 deletions cmake_templates/Doxyfile.in
Original file line number Diff line number Diff line change
Expand Up @@ -2052,6 +2052,7 @@ PREDEFINED =
EXPAND_AS_DEFINED = "SIP_ABSTRACT" \
"SIP_ARRAY" \
"SIP_ARRAYSIZE" \
"SIP_CONSTRAINED" \
"SIP_CONVERT_TO_SUBCLASS_CODE" \
"SIP_DEPRECATED" \
"SIP_END" \
Expand Down
6 changes: 6 additions & 0 deletions python/gui/qgsfeatureselectiondlg.sip
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,12 @@



// This is required for the ConvertToSubClassCode to work properly
// so RTTI for casting is available in the whole module.
%ModuleCode
#include "qgsfeatureselectiondlg.h"
%End

class QgsFeatureSelectionDlg : QDialog
{

Expand Down
4 changes: 2 additions & 2 deletions python/gui/qgsfieldvalidator.sip
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,8 @@ class QgsFieldValidator : QValidator
QgsFieldValidator( QObject *parent, const QgsField &field, const QString &defaultValue, const QString &dateFormat = "yyyy-MM-dd" );
~QgsFieldValidator();

virtual State validate( QString &SIP_CONSTRAINED, int &/In,Out/ ) const;
virtual void fixup( QString & ) const;
virtual State validate( QString &s /Constrained/, int &i /In,Out/ ) const;
virtual void fixup( QString &s /Constrained/ ) const;

QString dateFormat() const;
%Docstring
Expand Down
1 change: 1 addition & 0 deletions scripts/sipify.pl
Original file line number Diff line number Diff line change
Expand Up @@ -150,6 +150,7 @@ ()
$line =~ s/\bSIP_ARRAY\b/\/Array\//g;
$line =~ s/\bSIP_ARRAYSIZE\b/\/ArraySize\//g;
$line =~ s/\bSIP_DEPRECATED\b/\/Deprecated\//g;
$line =~ s/\bSIP_CONSTRAINED\b/\/Constrained\//g;
$line =~ s/\bSIP_FACTORY\b/\/Factory\//;
$line =~ s/\bSIP_IN\b/\/In\//g;
$line =~ s/\bSIP_INOUT\b/\/In,Out\//g;
Expand Down
5 changes: 5 additions & 0 deletions src/core/qgis_sip.h
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,11 @@
*/
#define SIP_DEPRECATED

/*
* http://pyqt.sourceforge.net/Docs/sip4/annotations.html?highlight=constrained#argument-annotation-Constrained
*/
#define SIP_CONSTRAINED

/*
* discard line
*/
Expand Down
8 changes: 8 additions & 0 deletions src/gui/qgsfeatureselectiondlg.h
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,14 @@ class QgsGenericFeatureSelectionManager;
#include "qgis.h"
#include "qgis_gui.h"

#ifdef SIP_RUN
// This is required for the ConvertToSubClassCode to work properly
// so RTTI for casting is available in the whole module.
% ModuleCode
#include "qgsfeatureselectiondlg.h"
% End
#endif

/** \ingroup gui
* \class QgsFeatureSelectionDlg
*/
Expand Down
4 changes: 2 additions & 2 deletions src/gui/qgsfieldvalidator.h
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,8 @@ class GUI_EXPORT QgsFieldValidator : public QValidator
QgsFieldValidator( QObject *parent, const QgsField &field, const QString &defaultValue, const QString &dateFormat = "yyyy-MM-dd" );
~QgsFieldValidator();

virtual State validate( QString &SIP_CONSTRAINED, int &SIP_INOUT ) const override;
virtual void fixup( QString & ) const override;
virtual State validate( QString &s SIP_CONSTRAINED, int &i SIP_INOUT ) const override;
virtual void fixup( QString &s SIP_CONSTRAINED ) const override;

QString dateFormat() const { return mDateFormat; }

Expand Down
4 changes: 2 additions & 2 deletions tests/src/python/acceptable_missing_doc.py
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@
"QgsVectorGradientColorRampDialog": ["setItemStopColor(const QColor &newColor)", "setColor1(const QColor &color)", "stopDoubleClicked(QTreeWidgetItem *item, int column)", "setStopColor(QTreeWidgetItem *item, const QColor &color)", "QgsVectorGradientColorRampDialog(QgsVectorGradientColorRamp *ramp, QWidget *parent=nullptr)", "setColor2(const QColor &color)", "addStop()", "toggledStops(bool on)", "removeStop()", "updateStops()", "updatePreview()"],
"QgsCptCityColorRampDialog": ["clearCopyingInfo()", "showAll()", "saveAsGradientRamp() const ", "updatePreview(bool clear=false)", "setTreeModel(QgsCptCityBrowserModel *model)", "updateCopyingInfo(const QMap< QString, QString > &copyingMap)", "QgsCptCityColorRampDialog(QgsCptCityColorRamp *ramp, QWidget *parent=nullptr)", "updateTreeView(QgsCptCityDataItem *item, bool resetRamp=true)", "onFinished()", "updateRamp()", "populateVariants()", "updateListWidget(QgsCptCityDataItem *item)", "selectedName() const "],
"QgsComposerMouseHandles": ["SnapGuideMode", "composition()", "QgsComposerMouseHandles(QgsComposition *composition)", "setComposition(QgsComposition *c)", "ItemPositionMode"],
"QgsExpressionBuilderDialog": ["QgsExpressionBuilderDialog(QgsVectorLayer *layer, const QString &startText=QString(), QWidget *parent=nullptr, const QString &key=\"generic\", const QgsExpressionContext &context=QgsExpressionContext())", "expressionText()", "setExpressionText(const QString &text)"],
"QgsExpressionBuilderDialog": ["QgsExpressionBuilderDialog(QgsVectorLayer *layer, const QString &startText=QString(), QWidget *parent SIP_TRANSFERTHIS=nullptr, const QString &key=\"generic\", const QgsExpressionContext &context=QgsExpressionContext())", "expressionText()", "setExpressionText(const QString &text)"],
"QgsProviderMetadata": ["QgsProviderMetadata(const QString &_key, const QString &_description, const QString &_library)"],
"QgsAbstractFeatureIteratorFromSource": ["QgsAbstractFeatureIteratorFromSource(T *source, bool ownSource, const QgsFeatureRequest &request)"],
"pal::PolygonCostCalculator": ["PolygonCostCalculator(LabelPosition *lp)", "update(pal::PointSet *pset)", "getCost()", "getLabel()"],
Expand Down Expand Up @@ -607,7 +607,7 @@
"QgsRasterBandStats": ["Stats"],
"QgsFeatureSelectionModel": ["setFeatureSelectionManager(QgsIFeatureSelectionManager *featureSelectionManager)", "QgsFeatureSelectionModel(QAbstractItemModel *model, QgsFeatureModel *featureModel, QgsIFeatureSelectionManager *featureSelectionHandler, QObject *parent)"],
"QgsComposerMultiFrameCommand": ["multiFrame() const ", "saveAfterState()", "previousState() const ", "checkFirstRun()", "QgsComposerMultiFrameCommand(QgsComposerMultiFrame *multiFrame, const QString &text, QUndoCommand *parent=0)", "restoreState(QDomDocument &stateDoc)", "afterState() const ", "savePreviousState()", "saveState(QDomDocument &stateDoc)"],
"QgsExtentGroupBox": ["extentState() const ", "currentCrs() const ", "setOutputExtentFromLineEdit()", "setOutputExtent(const QgsRectangle &r, const QgsCoordinateReferenceSystem &srcCrs, ExtentState state)", "updateTitle()", "ExtentState", "originalCrs() const ", "QgsExtentGroupBox(QWidget *parent=0)", "groupBoxClicked()", "originalExtent() const ", "currentExtent() const "],
"QgsExtentGroupBox": ["extentState() const ", "currentCrs() const ", "setOutputExtentFromLineEdit()", "setOutputExtent(const QgsRectangle &r, const QgsCoordinateReferenceSystem &srcCrs, QgsExtentGroupBox::ExtentState state)", "updateTitle()", "ExtentState", "originalCrs() const ", "QgsExtentGroupBox(QWidget *parent=0)", "groupBoxClicked()", "originalExtent() const ", "currentExtent() const "],
"QgsComposerAttributeTableCompare": ["operator()(const QgsAttributeMap &m1, const QgsAttributeMap &m2)"],
"QgsSpinBox": ["ClearValueMode", "showClearButton() const ", "QgsSpinBox(QWidget *parent=nullptr)"],
"QgsComposerItem": ["beginItemCommand(const QString &text)", "endItemCommand()", "ItemType", "removeItems()", "deleteHAlignSnapItem()", "deleteVAlignSnapItem()", "ItemPositionMode", "cancelCommand()", "deleteAlignItems()"],
Expand Down

0 comments on commit f5e66dd

Please sign in to comment.