Syntax error with SIP 4.19.13 and struct

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

Syntax error with SIP 4.19.13 and struct

Alessandro Pasotti
Hi,

I'm building the bindings for a class that looks like this (snippet):

class CORE_EXPORT QgsDataProvider : public QObject
{
    Q_OBJECT
  public:
    struct ProviderOptions
    {
      QgsCoordinateTransformContext coordinateTransformContext;
    };
    QgsDataProvider( const QString &uri = QString(), const QgsDataProvider::ProviderOptions &options = QgsDataProvider::ProviderOptions() ):
      mDataSourceURI( uri ),
      mOptions( options )
    {
    }
}

SIP code is (snippe)t:

class QgsDataProvider : QObject
{
%TypeHeaderCode
#include "qgsdataprovider.h"
%End
  public:
   struct ProviderOptions
    {
      QgsCoordinateTransformContext coordinateTransformContext;
    };

    QgsDataProvider( const QString &uri = QString(), const QgsDataProvider::ProviderOptions &options = QgsDataProvider::ProviderOptions() ):
...


The error message is
qgsdataprovider.sip:76: syntax error
line 76 is the last line of the above snippet.


Any idea what's going on here?

Thanks!

--
Alessandro Pasotti
w3:   www.itopen.it

_______________________________________________
PyQt mailing list    [hidden email]
https://www.riverbankcomputing.com/mailman/listinfo/pyqt
Reply | Threaded
Open this post in threaded view
|

Re: Syntax error with SIP 4.19.13 and struct

Phil Thompson-5
On 21 Mar 2019, at 10:05 am, Alessandro Pasotti <[hidden email]> wrote:

>
> Hi,
>
> I'm building the bindings for a class that looks like this (snippet):
>
> class CORE_EXPORT QgsDataProvider : public QObject
> {
>     Q_OBJECT
>   public:
>     struct ProviderOptions
>     {
>       QgsCoordinateTransformContext coordinateTransformContext;
>     };
>     QgsDataProvider( const QString &uri = QString(), const QgsDataProvider::ProviderOptions &options = QgsDataProvider::ProviderOptions() ):
>       mDataSourceURI( uri ),
>       mOptions( options )
>     {
>     }
> }
>
> SIP code is (snippe)t:
>
> class QgsDataProvider : QObject
> {
> %TypeHeaderCode
> #include "qgsdataprovider.h"
> %End
>   public:
>    struct ProviderOptions
>     {
>       QgsCoordinateTransformContext coordinateTransformContext;
>     };
>
>     QgsDataProvider( const QString &uri = QString(), const QgsDataProvider::ProviderOptions &options = QgsDataProvider::ProviderOptions() ):
> ...
>
>
> The error message is
> qgsdataprovider.sip:76: syntax error
> line 76 is the last line of the above snippet.
>
>
> Any idea what's going on here?

You have a syntax error. There seems to be a colon when a semi-colon is expected.

Phil
_______________________________________________
PyQt mailing list    [hidden email]
https://www.riverbankcomputing.com/mailman/listinfo/pyqt
Reply | Threaded
Open this post in threaded view
|

Re: Syntax error with SIP 4.19.13 and struct

Alessandro Pasotti

Thanks!

We are using an automatic SIP file generator, unfortunately it's quite picky about inline initializers.


On Thu, Mar 21, 2019 at 11:11 AM Phil Thompson <[hidden email]> wrote:
On 21 Mar 2019, at 10:05 am, Alessandro Pasotti <[hidden email]> wrote:
>
> Hi,
>
> I'm building the bindings for a class that looks like this (snippet):
>
> class CORE_EXPORT QgsDataProvider : public QObject
> {
>     Q_OBJECT
>   public:
>     struct ProviderOptions
>     {
>       QgsCoordinateTransformContext coordinateTransformContext;
>     };
>     QgsDataProvider( const QString &uri = QString(), const QgsDataProvider::ProviderOptions &options = QgsDataProvider::ProviderOptions() ):
>       mDataSourceURI( uri ),
>       mOptions( options )
>     {
>     }
> }
>
> SIP code is (snippe)t:
>
> class QgsDataProvider : QObject
> {
> %TypeHeaderCode
> #include "qgsdataprovider.h"
> %End
>   public:
>    struct ProviderOptions
>     {
>       QgsCoordinateTransformContext coordinateTransformContext;
>     };
>
>     QgsDataProvider( const QString &uri = QString(), const QgsDataProvider::ProviderOptions &options = QgsDataProvider::ProviderOptions() ):
> ...
>
>
> The error message is
> qgsdataprovider.sip:76: syntax error
> line 76 is the last line of the above snippet.
>
>
> Any idea what's going on here?

You have a syntax error. There seems to be a colon when a semi-colon is expected.

Phil


--
Alessandro Pasotti
w3:   www.itopen.it

_______________________________________________
PyQt mailing list    [hidden email]
https://www.riverbankcomputing.com/mailman/listinfo/pyqt