File: qgsfeaturestore.sip.in

package info (click to toggle)
qgis 3.40.11%2Bdfsg-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 1,183,800 kB
  • sloc: cpp: 1,595,841; python: 372,637; xml: 23,474; sh: 3,761; perl: 3,664; ansic: 2,257; sql: 2,137; yacc: 1,068; lex: 577; javascript: 540; lisp: 411; makefile: 154
file content (187 lines) | stat: -rw-r--r-- 4,694 bytes parent folder | download | duplicates (6)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
/************************************************************************
 * This file has been generated automatically from                      *
 *                                                                      *
 * src/core/qgsfeaturestore.h                                           *
 *                                                                      *
 * Do not edit manually ! Edit header and run scripts/sipify.py again   *
 ************************************************************************/


class QgsFeatureStore : QgsFeatureSink
{
%Docstring(signature="appended")
A container for features with the same fields and crs.
%End

%TypeHeaderCode
#include "qgsfeaturestore.h"
%End
  public:
    QgsFeatureStore();

    QgsFeatureStore( const QgsFields &fields, const QgsCoordinateReferenceSystem &crs );
%Docstring
Constructor
%End

    QgsFields fields() const;
%Docstring
Returns the store's field list.

.. seealso:: :py:func:`setFields`
%End

    void setFields( const QgsFields &fields );
%Docstring
Sets the store's ``fields``. Every contained feature's fields will be
reset to match ``fields``.

.. seealso:: :py:func:`fields`
%End

    QgsCoordinateReferenceSystem crs() const;
%Docstring
Returns the store's coordinate reference system.

.. seealso:: :py:func:`setCrs`
%End

    void setCrs( const QgsCoordinateReferenceSystem &crs );
%Docstring
Sets the store's ``crs``.

.. seealso:: :py:func:`crs`
%End

    virtual bool addFeature( QgsFeature &feature, QgsFeatureSink::Flags flags = QgsFeatureSink::Flags() );

    virtual bool addFeatures( QgsFeatureList &features, QgsFeatureSink::Flags flags = QgsFeatureSink::Flags() );


    int count() const;
%Docstring
Returns the number of features contained in the store.
%End


    Py_ssize_t __len__() const;
%Docstring
Returns the number of features contained in the store.
%End
%MethodCode
    sipRes = sipCpp->count();
%End

    //! Ensures that bool(obj) returns ``True`` (otherwise __len__() would be used)
    int __bool__() const;
%MethodCode
    sipRes = true;
%End

    QgsFeatureList features() const;
%Docstring
Returns the list of features contained in the store.
%End

    void setParams( const QMap<QString, QVariant> &parameters );
%Docstring
Sets a map of optional ``parameters`` for the store.

.. seealso:: :py:func:`params`
%End

    QMap<QString, QVariant> params() const;
%Docstring
Returns the map of optional parameters.

.. seealso:: :py:func:`setParams`
%End

};

typedef QVector<QgsFeatureStore> QgsFeatureStoreList;

%MappedType QgsFeatureStoreList
{
%TypeHeaderCode
#include "qgsfeaturestore.h"
%End

%ConvertFromTypeCode
  // Create the list.
  PyObject *l;

  if ( ( l = PyList_New( sipCpp->size() ) ) == NULL )
    return NULL;

  // Set the list elements.
  for ( int i = 0; i < sipCpp->size(); ++i )
  {
    QgsFeatureStore *v = new QgsFeatureStore( sipCpp->at( i ) );
    PyObject *tobj;

    if ( ( tobj = sipConvertFromNewType( v, sipType_QgsFeatureStore, Py_None ) ) == NULL )
    {
      Py_DECREF( l );
      delete v;

      return NULL;
    }

    PyList_SET_ITEM( l, i, tobj );
  }

  return l;
%End

%ConvertToTypeCode
  // Check the type if that is all that is required.
  if ( sipIsErr == NULL )
  {
    if ( !PyList_Check( sipPy ) )
      return 0;

    for ( Py_ssize_t i = 0; i < PyList_GET_SIZE( sipPy ); ++i )
      if ( !sipCanConvertToType( PyList_GET_ITEM( sipPy, i ), sipType_QgsFeatureStore, SIP_NOT_NONE ) )
        return 0;

    return 1;
  }

  QgsFeatureStoreList *qv = new QgsFeatureStoreList;
  Py_ssize_t listSize = PyList_GET_SIZE( sipPy );
  qv->reserve( listSize );

  for ( Py_ssize_t i = 0; i < listSize; ++i )
  {
    PyObject *obj = PyList_GET_ITEM( sipPy, i );
    int state;
    QgsFeatureStore *t = reinterpret_cast<QgsFeatureStore *>( sipConvertToType( obj, sipType_QgsFeatureStore, sipTransferObj, SIP_NOT_NONE, &state, sipIsErr ) );

    if ( *sipIsErr )
    {
      sipReleaseType( t, sipType_QgsFeatureStore, state );

      delete qv;
      return 0;
    }

    qv->append( *t );
    sipReleaseType( t, sipType_QgsFeatureStore, state );
  }

  *sipCppPtr = qv;

  return sipGetState( sipTransferObj );
%End
};



/************************************************************************
 * This file has been generated automatically from                      *
 *                                                                      *
 * src/core/qgsfeaturestore.h                                           *
 *                                                                      *
 * Do not edit manually ! Edit header and run scripts/sipify.py again   *
 ************************************************************************/