2017-03-29 16:15:07 +02:00
|
|
|
/***************************************************************************
|
|
|
|
sipifyheader.h - Demo for sipify.pl
|
|
|
|
--------------------------------------
|
|
|
|
Date : 28.03.2017
|
|
|
|
Copyright : (C) 2017 Denis Rouzaud
|
|
|
|
email : denis.rouzaud@gmail.com
|
|
|
|
***************************************************************************
|
|
|
|
* *
|
|
|
|
* 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. *
|
|
|
|
* *
|
|
|
|
***************************************************************************/
|
|
|
|
|
|
|
|
#ifndef SIPIFYHEADER_H
|
|
|
|
#define SIPIFYHEADER_H
|
|
|
|
|
|
|
|
#include "qgis_core.h"
|
|
|
|
#include <QtClass>
|
|
|
|
|
|
|
|
#include "sipifyheader.h"
|
|
|
|
|
|
|
|
// one shall include qgis.h to use SIP annotations
|
|
|
|
#include "qgis.h"
|
|
|
|
|
|
|
|
class QgsForwardDeclaration;
|
|
|
|
|
|
|
|
|
|
|
|
/***************************************************************************
|
|
|
|
* This is some random block comment that will not be displayed.
|
|
|
|
* Block comments shall will placed upon class, method, enum without
|
|
|
|
* any blank lines in between.
|
|
|
|
****************************************************************************/
|
|
|
|
|
|
|
|
// typedef have no Docstring, so commenting here will not be used
|
|
|
|
#ifdef SIP_RUN
|
|
|
|
typedef qint64 QgsFeatureId;
|
|
|
|
#else
|
|
|
|
typedef WhatEver ShouldNotBeDisplayed;
|
|
|
|
#endif
|
|
|
|
|
2017-03-30 09:57:22 +02:00
|
|
|
typedef QSet<QgsFeatureId SIP_PYTYPE( qint64 )> QgsFeatureIds;
|
|
|
|
typedef QMap<QgsFeatureId SIP_PYTYPE( qint64 ), QgsAttributeMap SIP_PYTYPE( 'QMap<int, QVariant>' )> QgsChangedAttributesMap;
|
|
|
|
typedef QMap<QgsFeatureId, QgsAttributeMap> SIP_PYTYPE( 'QMap<qint64, QMap<int, QVariant> >' ) QgsChangedAttributesMap;
|
|
|
|
typedef QMap<QgsFeatureId, QPair<QMap<Something, Complex> >> SIP_PYTYPE( 'QMap<qint64, QMap<int, QVariant>>' ) QgsChangedAttributesMap;
|
|
|
|
|
2017-03-29 16:15:07 +02:00
|
|
|
/** \ingroup core
|
|
|
|
* A super QGIS class
|
|
|
|
*/
|
|
|
|
#ifndef SIP_RUN // following will be hidden
|
|
|
|
class CORE_EXPORT QgsSuperClass : public QtClass<QVariant>
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
//! A constructor with definition in header
|
|
|
|
QgsSuperClass()
|
|
|
|
: QtClass<QVariant>()
|
|
|
|
{}
|
|
|
|
};
|
|
|
|
#else // following will be displayed in generated file
|
|
|
|
typedef QVector<QVariant> QgsSuperClass;
|
|
|
|
|
|
|
|
% MappedType QgsSuperClass
|
|
|
|
{
|
|
|
|
// The annotations are modified by astyle (these will be fixed by sipify.pl)
|
|
|
|
% TypeHeaderCode
|
|
|
|
#include <qgssipifyheader.h>
|
|
|
|
% End
|
|
|
|
|
|
|
|
% ConvertFromTypeCode
|
|
|
|
// Create the list.
|
|
|
|
PyObject *l;
|
|
|
|
return l;
|
|
|
|
% End
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
|
|
|
|
/** \ingroup core
|
|
|
|
* Documentation goes here
|
2017-04-05 10:32:27 +10:00
|
|
|
*
|
|
|
|
* Here's some comment mentioning another class QgsAutoAwesomemater::makeAwesome.
|
2017-04-03 01:06:33 +02:00
|
|
|
* \since QGIS 3.0
|
2017-04-02 20:52:50 +10:00
|
|
|
* \note some other note
|
2017-03-29 16:15:07 +02:00
|
|
|
*/
|
2017-04-05 09:54:27 +02:00
|
|
|
class CORE_EXPORT QgsSipifyHeader : public QtClass<QVariant>, private Ui::QgsBaseClass
|
2017-03-29 16:15:07 +02:00
|
|
|
{
|
2017-04-02 12:53:31 +02:00
|
|
|
|
|
|
|
#ifdef SIP_RUN
|
|
|
|
SIP_CONVERT_TO_SUBCLASS_CODE
|
|
|
|
if ( sipCpp->headerType() == QgsSipifyHeader::Special )
|
|
|
|
sipType = sipType_QgsSpecialSipifyHeader;
|
|
|
|
else
|
|
|
|
sipType = sipType_QgsStandardSipifyHeader;
|
|
|
|
SIP_END
|
|
|
|
#endif
|
|
|
|
|
2017-03-29 16:15:07 +02:00
|
|
|
public:
|
|
|
|
//! This is an enum
|
|
|
|
enum MyEnum
|
|
|
|
{
|
|
|
|
Success = 0, //!< Edit operation was successful
|
|
|
|
NoSuccess = 1, //!< Edit operation resulted in an empty geometry
|
2017-04-03 14:09:28 +10:00
|
|
|
ImaginarySuccess = 1 << 3, //!< Edit operation resulted in an imaginary geometry
|
|
|
|
RecursiveSuccess = 1 << 4, //!< Edit operation resulted in an n-dimensional wormhole
|
2017-03-29 16:15:07 +02:00
|
|
|
};
|
2017-04-03 13:53:29 +10:00
|
|
|
Q_DECLARE_FLAGS( Flags, MyEnum )
|
2017-03-29 16:15:07 +02:00
|
|
|
|
2017-04-04 10:37:58 +02:00
|
|
|
/**
|
|
|
|
* Docstring headers for structs are not supported by sip (as of 4.18) and
|
|
|
|
* therefore this docstring must not to be copied to the sipfile.
|
|
|
|
*/
|
|
|
|
struct Data
|
|
|
|
{
|
|
|
|
QString name;
|
|
|
|
int count;
|
|
|
|
};
|
|
|
|
|
2017-03-29 16:15:07 +02:00
|
|
|
//! A constructor with definition in header
|
|
|
|
explicit QgsSipifyHeader()
|
|
|
|
: QtClass<QVariant>()
|
|
|
|
, QgsBaseClass()
|
|
|
|
{}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* A classic constructor with arguments
|
|
|
|
*/
|
|
|
|
QgsSipifyHeader( QWidget *parent SIP_TRANSFERTHIS = nullptr );
|
|
|
|
|
2017-04-02 10:54:04 +02:00
|
|
|
//! A constructor with no empty `()`
|
|
|
|
QgsSipifyHeader( bool a = true )
|
|
|
|
: mMember( nullptr )
|
|
|
|
{}
|
|
|
|
|
|
|
|
//! A constructor with some special character types
|
|
|
|
QgsSipifyHeader( QList<Point> a, const Issues &b = Issues::weDontHaveIssues(), QgsClass *b = nullptr )
|
|
|
|
: mMember( nullptr )
|
|
|
|
{}
|
|
|
|
|
2017-04-02 16:21:23 +10:00
|
|
|
//! Default constructor
|
|
|
|
QgsSipifyHeader() = default;
|
|
|
|
|
2017-04-02 12:53:31 +02:00
|
|
|
//! Assignment operator should be removed in sip
|
|
|
|
QgsSipifyHeader &operator=( const QgsSipifyHeader other );
|
|
|
|
|
|
|
|
//! Comparison operator should be kept
|
|
|
|
bool operator==( const QgsSipifyHeader other );
|
|
|
|
|
2017-03-29 16:15:07 +02:00
|
|
|
//! A multiline method signature
|
|
|
|
void multilineMethod( const QgsPoint &startPoint,
|
|
|
|
QgsFeatureId featureId,
|
|
|
|
QgsVectorLayer *vl,
|
|
|
|
QgsSnapper::SnappingType snap_to ) const;
|
|
|
|
|
|
|
|
// Adding SIP_SKIP at the end of a line will discard this MethodCode
|
|
|
|
bool thisShouldBeSkipped() const SIP_SKIP;
|
|
|
|
|
|
|
|
//! Factory annotation
|
|
|
|
virtual QgsMapLayerRenderer *createMapRenderer( QgsRenderContext &rendererContext ) override SIP_FACTORY;
|
|
|
|
|
2017-04-02 21:19:52 +10:00
|
|
|
SomeObject *createAnother() SIP_FACTORY { return something; }
|
|
|
|
|
2017-03-29 16:15:07 +02:00
|
|
|
/**
|
|
|
|
* My long doc string
|
|
|
|
* is not very interesting!
|
|
|
|
*/
|
|
|
|
void LongDocStringMethod();
|
|
|
|
|
2017-04-02 21:28:20 +10:00
|
|
|
/**
|
|
|
|
* \brief some brief
|
2017-04-03 13:14:52 +10:00
|
|
|
* My long doc \a string
|
2017-04-02 21:28:20 +10:00
|
|
|
* is not very interesting!
|
2017-04-05 10:32:27 +10:00
|
|
|
* Here's some comment mentioning another class QgsAutoAwesomemater::makeLessAwesome.
|
2017-04-02 21:28:20 +10:00
|
|
|
*/
|
|
|
|
void LongDocStringMethodWithBrief();
|
|
|
|
|
2017-04-07 09:19:34 +10:00
|
|
|
/**
|
|
|
|
* I return a pointer. If something bad happens, I return nullptr.
|
2017-04-07 11:23:53 +10:00
|
|
|
* \returns pointer to something cool
|
2017-04-07 09:19:34 +10:00
|
|
|
*/
|
|
|
|
MyPointer *pointerReturnValue();
|
|
|
|
|
2017-03-29 16:15:07 +02:00
|
|
|
bool isOKwithErrMesg( QString &ErrMsg SIP_OUT );
|
|
|
|
|
|
|
|
void InOutParam( bool &ok = true SIP_INOUT );
|
|
|
|
|
|
|
|
void setDiagramRenderer( QgsDiagramRenderer *r SIP_TRANSFER );
|
|
|
|
|
2017-03-30 09:57:22 +02:00
|
|
|
void differentDefaultValue( bool defaultValue = true SIP_PYDEFAULTVALUE( false ), QWidget *parent = nullptr, QString msg = QString() SIP_PYDEFAULTVALUE( "hello" ) );
|
|
|
|
|
2017-04-02 10:54:04 +02:00
|
|
|
void differentType( QList<QgsFeatureId> SIP_PYTYPE( QList<qint64> ) & list );
|
2017-03-30 09:57:22 +02:00
|
|
|
|
|
|
|
//! complex default value and type (i.e. containing commas) should be given as a string with single quotes
|
|
|
|
void complexDefaultValueAndType( QList<QPair<QgsFeatureId SIP_PYTYPE( qint64 ), QMap<int, QString>>> list = QList<QPair<QgsFeatureId, QMap<int, QString>>>() SIP_PYDEFAULTVALUE( 'QList<QPair<qint64, QMap<int, QString>>>()' ) );
|
|
|
|
|
2017-04-07 11:23:53 +10:00
|
|
|
inline int inlineKeyWordShouldNotAppear();
|
2017-03-29 16:15:07 +02:00
|
|
|
|
|
|
|
QString labelForRange( double lower, double upper ) const SIP_PYNAME( labelForLowerUpper );
|
|
|
|
|
|
|
|
void setComposition( QgsComposition *c SIP_KEEPREFERENCE );
|
|
|
|
|
|
|
|
void removeProxyFactory( QNetworkProxyFactory *factory SIP_TRANSFERBACK );
|
|
|
|
|
2017-04-02 10:54:04 +02:00
|
|
|
bool removeFunctionBody( const QList<int, QString> &list, QgsVectorLayer *vl ) { doSomething; return true; } // some comments
|
2017-03-29 16:15:07 +02:00
|
|
|
|
2017-04-07 09:14:44 +10:00
|
|
|
//! Removing function body with namespaced return value
|
|
|
|
QgsRaster::RasterBuildPyramids buildPyramidsFlag() const { return mBuildPyramidsFlag; }
|
|
|
|
|
2017-03-29 16:15:07 +02:00
|
|
|
bool deletedFunction() = delete; // some comments
|
|
|
|
|
2017-04-02 20:45:41 +02:00
|
|
|
virtual int overriddenProperty() override { return 42; } // if in doubt, comment it out
|
|
|
|
|
2017-04-07 11:23:53 +10:00
|
|
|
QString returnTypeString() const;
|
|
|
|
|
|
|
|
double returnTypeDouble() const;
|
|
|
|
|
|
|
|
QList< QgsAnnotation * > returnTypeList();
|
|
|
|
|
|
|
|
QVector< QgsAnnotation > returnTypeVector();
|
|
|
|
|
|
|
|
QStringList returnTypeStringList();
|
|
|
|
|
|
|
|
QSet<QgsActionScope> returnTypeSet();
|
|
|
|
|
2017-03-29 16:15:07 +02:00
|
|
|
protected:
|
|
|
|
bool thisShouldBeListed();
|
|
|
|
|
2017-04-05 09:46:14 +02:00
|
|
|
Whatever skipMember;
|
|
|
|
Whatever::Something *alsoSkipMember = nullptr;
|
|
|
|
|
2017-03-29 16:15:07 +02:00
|
|
|
private:
|
|
|
|
void privateMethodAreNotShown();
|
|
|
|
#ifdef SIP_RUN
|
|
|
|
void privateMethodSIPRUNareShown();
|
|
|
|
#endif
|
|
|
|
public:
|
|
|
|
void FallBackToPublic();
|
|
|
|
|
|
|
|
private:
|
|
|
|
void PrivateAgain();
|
|
|
|
|
2017-04-03 08:38:23 +02:00
|
|
|
struct ProcessFeatureWrapper
|
|
|
|
{
|
|
|
|
QgsGeometrySnapper *instance = nullptr;
|
|
|
|
double snapTolerance;
|
|
|
|
SnapMode mode;
|
|
|
|
explicit ProcessFeatureWrapper( QgsGeometrySnapper *_instance, double snapTolerance, SnapMode mode )
|
|
|
|
: instance( _instance )
|
|
|
|
, snapTolerance( snapTolerance )
|
|
|
|
, mode( mode )
|
|
|
|
{}
|
|
|
|
void operator()( QgsFeature &feature ) { return instance->processFeature( feature, snapTolerance, mode ); }
|
|
|
|
};
|
|
|
|
|
|
|
|
enum PointFlag { SnappedToRefNode, SnappedToRefSegment, Unsnapped };
|
2017-03-29 16:15:07 +02:00
|
|
|
};
|
|
|
|
|
2017-04-02 20:30:22 +10:00
|
|
|
/**
|
|
|
|
* \class ClassWithPrivateInheritanceOnly
|
|
|
|
* \ingroup core
|
|
|
|
* Documentation goes here
|
|
|
|
*/
|
2017-03-29 16:15:07 +02:00
|
|
|
class CORE_EXPORT ClassWithPrivateInheritanceOnly : private QgsBaseClass
|
|
|
|
{
|
2017-04-07 10:36:40 +02:00
|
|
|
public:
|
2017-03-29 16:15:07 +02:00
|
|
|
//! A constructor with definition in header on several lines
|
|
|
|
explicit ClassWithPrivateInheritanceOnly()
|
|
|
|
: QtClass<QVariant>()
|
|
|
|
, QgsBaseClass()
|
|
|
|
{
|
|
|
|
doWhatYouLike();
|
|
|
|
haveFun();
|
|
|
|
}
|
|
|
|
|
2017-04-07 10:36:40 +02:00
|
|
|
};
|
2017-03-29 16:15:07 +02:00
|
|
|
|
2017-04-05 14:14:25 +02:00
|
|
|
/**
|
|
|
|
* \class AbstractClass
|
|
|
|
* \ingroup core
|
|
|
|
* Documentation goes here
|
|
|
|
*/
|
|
|
|
class CORE_EXPORT AbstractClass SIP_ABSTRACT
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
//! A constructor
|
|
|
|
explicit AbstractClass()
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
private:
|
|
|
|
|
|
|
|
/**
|
|
|
|
* This method should be overridden by subclasses but not exposed to the public
|
|
|
|
* or protected API.
|
|
|
|
*/
|
|
|
|
virtual QString reason() = 0;
|
|
|
|
}
|
|
|
|
|
2017-04-03 13:53:29 +10:00
|
|
|
Q_DECLARE_OPERATORS_FOR_FLAGS( QgsSipifyHeader::Flags )
|
|
|
|
|
2017-03-29 16:15:07 +02:00
|
|
|
|
|
|
|
#endif
|