This file is indexed.

/usr/share/sip/PyQt4/QtGui/qpolygon.sip is in python-qt4-dev 4.9.1-2ubuntu1.

This file is owned by root:root, with mode 0o644.

The actual contents of the file can be viewed below.

  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
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
// qpolygon.sip generated by MetaSIP on Fri Feb 10 10:35:12 2012
//
// This file is part of the QtGui Python extension module.
//
// Copyright (c) 2011 Riverbank Computing Limited <info@riverbankcomputing.com>
// 
// This file is part of PyQt.
// 
// This file may be used under the terms of the GNU General Public
// License versions 2.0 or 3.0 as published by the Free Software
// Foundation and appearing in the files LICENSE.GPL2 and LICENSE.GPL3
// included in the packaging of this file.  Alternatively you may (at
// your option) use any later version of the GNU General Public
// License if such license has been publicly approved by Riverbank
// Computing Limited (or its successors, if any) and the KDE Free Qt
// Foundation. In addition, as a special exception, Riverbank gives you
// certain additional rights. These rights are described in the Riverbank
// GPL Exception version 1.1, which can be found in the file
// GPL_EXCEPTION.txt in this package.
// 
// If you are unsure which license is appropriate for your use, please
// contact the sales department at sales@riverbankcomputing.com.
// 
// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.


%ModuleCode
#include <qpolygon.h>
%End

class QPolygon
{
%TypeHeaderCode
#include <qpolygon.h>
%End

%TypeCode
// Set the points of a polygon from a Python list.
static bool setPointsFromList(QPolygon *poly, PyObject *l)
{
    int *coords = new int[PyList_GET_SIZE(l)];

    for (SIP_SSIZE_T i = 0; i < PyList_GET_SIZE(l); ++i)
    {
        coords[i] = SIPLong_AsLong(PyList_GET_ITEM(l, i));

        if (PyErr_Occurred() != NULL)
        {
            delete[] coords;
            return false;
        }
    }

    poly->setPoints(PyList_GET_SIZE(l) >> 1, coords);

    delete[] coords;
    return true;
}
%End

%PickleCode
    PyObject *pl = PyList_New(sipCpp->count() * 2);
    
    for (int p = 0, i = 0; i < sipCpp->count(); ++i, p += 2)
    {
        int x, y;
    
        sipCpp->point(i, &x, &y);
    
        PyList_SET_ITEM(pl, p, SIPLong_FromLong(x));
        PyList_SET_ITEM(pl, p + 1, SIPLong_FromLong(y));
    }
    
    sipRes = Py_BuildValue((char *)"(N)", pl);
%End

public:
    QPolygon();
    ~QPolygon();
    QPolygon(const QPolygon &a);
    QPolygon(const QVector<QPoint> &v);
    QPolygon(const QRect &rectangle, bool closed = false);
    QPolygon(int asize);
    QPolygon(SIP_PYLIST points /DocType="list-of-int"/) /NoDerived/;
%MethodCode
        sipCpp = new QPolygon();
        
        if (!setPointsFromList(sipCpp, a0))
        {
            delete sipCpp;
            sipCpp = 0;
            sipIsErr = 1;
        }
%End

    QPolygon(const QVariant &variant) /NoDerived/;
%MethodCode
        sipCpp = new QPolygon(qVariantValue<QPolygon>(*a0));
%End

    void translate(int dx, int dy);
    QRect boundingRect() const;
    QPoint point(int index) const;
    void setPoints(SIP_PYLIST points /DocType="list-of-int"/);
%MethodCode
        if (!setPointsFromList(sipCpp, a0))
            sipIsErr = 1;
%End

    void setPoints(int firstx, int firsty, ...);
%MethodCode
        // Accept at least one pair of integer coordinates.
        int nPoints = 1 + ((PyTuple_GET_SIZE(a2) + 1) >> 1);
        
        int *points = new int[nPoints * 2];
        
        points[0] = a0;
        points[1] = a1;
        
        for (SIP_SSIZE_T i = 0; i < PyTuple_GET_SIZE(a2); ++i)
            points[2 + i] = SIPLong_AsLong(PyTuple_GET_ITEM(a2, i));
        
        sipCpp->setPoints(nPoints, points);
        
        delete[] points;
%End

    void putPoints(int index, int firstx, int firsty, ...);
%MethodCode
        // Accept at least one pair of integer coordinates.
        int nPoints = 1 + ((PyTuple_GET_SIZE(a3) + 1) >> 1);
        
        int *points = new int[nPoints * 2];
        
        points[0] = a1;
        points[1] = a2;
        
        for (SIP_SSIZE_T i = 0; i < PyTuple_GET_SIZE(a3); ++i)
            points[2 + i] = SIPLong_AsLong(PyTuple_GET_ITEM(a3, i));
        
        sipCpp->putPoints(a0, nPoints, points);
        
        delete[] points;
%End

    void putPoints(int index, int nPoints, const QPolygon &fromPolygon, int from = 0);
    void setPoint(int index, const QPoint &pt);
    void setPoint(int index, int x, int y);
    void translate(const QPoint &offset);
%If (Qt_4_3_0 -)
    bool containsPoint(const QPoint &pt, Qt::FillRule fillRule) const;
%End
%If (Qt_4_3_0 -)
    QPolygon united(const QPolygon &r) const;
%End
%If (Qt_4_3_0 -)
    QPolygon intersected(const QPolygon &r) const;
%End
%If (Qt_4_3_0 -)
    QPolygon subtracted(const QPolygon &r) const;
%End
%If (Qt_4_6_0 -)
    QPolygon translated(int dx, int dy) const;
%End
%If (Qt_4_6_0 -)
    QPolygon translated(const QPoint &offset) const;
%End
// Methods inherited from QVector<QPoint> and Python special methods.
// Keep in sync with QPolygonF and QXmlStreamAttributes.

void append(const QPoint &value);
const QPoint &at(int i) const;
void clear();
bool contains(const QPoint &value) const;
int count(const QPoint &value) const;
int count() const /__len__/;
void *data();

// Note the Qt return value is discarded as it would require handwritten code
// and seems pretty useless.
void fill(const QPoint &value, int size = -1);

QPoint &first();
int indexOf(const QPoint &value, int from = 0) const;
void insert(int i, const QPoint &value);
bool isEmpty() const;
QPoint &last();
int lastIndexOf(const QPoint &value, int from = -1) const;

// Note the Qt return type is QVector<QPoint>.
QPolygon mid(int pos, int length = -1) const;

void prepend(const QPoint &value);
void remove(int i);
void remove(int i, int count);
void replace(int i, const QPoint &value);
int size() const;
QPoint value(int i) const;
QPoint value(int i, const QPoint &defaultValue) const;
bool operator!=(const QPolygon &other) const;

// Note the Qt return type is QVector<QPoint>.
QPolygon operator+(const QPolygon &other) const;

QPolygon &operator+=(const QPolygon &other);
QPolygon &operator+=(const QPoint &value);
bool operator==(const QPolygon &other) const;

SIP_PYOBJECT operator<<(const QPoint &value);
%MethodCode
    *a0 << *a1;

    sipRes = sipArg0;
    Py_INCREF(sipRes);
%End

QPoint &operator[](int i);
%MethodCode
SIP_SSIZE_T idx = sipConvertFromSequenceIndex(a0, sipCpp->count());

if (idx < 0)
    sipIsErr = 1;
else
    sipRes = new QPoint(sipCpp->operator[]((int)idx));
%End

// Some additional Python special methods.

void __setitem__(int i, const QPoint &value);
%MethodCode
int len;

len = sipCpp->count();

if ((a0 = (int)sipConvertFromSequenceIndex(a0, len)) < 0)
    sipIsErr = 1;
else
    (*sipCpp)[a0] = *a1;
%End

void __setitem__(SIP_PYSLICE slice, const QPolygon &list);
%MethodCode
SIP_SSIZE_T len, start, stop, step, slicelength, i;

len = sipCpp->count();

#if PY_VERSION_HEX >= 0x03020000
if (PySlice_GetIndicesEx(a0, len, &start, &stop, &step, &slicelength) < 0)
#else
if (PySlice_GetIndicesEx((PySliceObject *)a0, len, &start, &stop, &step, &slicelength) < 0)
#endif
    sipIsErr = 1;
else
{
    int vlen = a1->count();

    if (vlen != slicelength)
    {
        sipBadLengthForSlice(vlen, slicelength);
        sipIsErr = 1;
    }
    else
    {
        QVector<QPoint>::const_iterator it = a1->begin();

        for (i = 0; i < slicelength; ++i)
        {
            (*sipCpp)[start] = *it;
            start += step;
            ++it;
        }
    }
}
%End

void __delitem__(int i);
%MethodCode
int len;

len = sipCpp->count();

if ((a0 = (int)sipConvertFromSequenceIndex(a0, len)) < 0)
    sipIsErr = 1;
else
    sipCpp->remove(a0);
%End

void __delitem__(SIP_PYSLICE slice);
%MethodCode
SIP_SSIZE_T len, start, stop, step, slicelength, i;

len = sipCpp->count();

#if PY_VERSION_HEX >= 0x03020000
if (PySlice_GetIndicesEx(a0, len, &start, &stop, &step, &slicelength) < 0)
#else
if (PySlice_GetIndicesEx((PySliceObject *)a0, len, &start, &stop, &step, &slicelength) < 0)
#endif
    sipIsErr = 1;
else
    for (i = 0; i < slicelength; ++i)
    {
        sipCpp->remove(start);
        start += step - 1;
    }
%End

QPolygon &operator[](SIP_PYSLICE slice);
%MethodCode
SIP_SSIZE_T len, start, stop, step, slicelength, i;

len = sipCpp->count();

#if PY_VERSION_HEX >= 0x03020000
if (PySlice_GetIndicesEx(a0, len, &start, &stop, &step, &slicelength) < 0)
#else
if (PySlice_GetIndicesEx((PySliceObject *)a0, len, &start, &stop, &step, &slicelength) < 0)
#endif
    sipIsErr = 1;
else
{
    sipRes = new QPolygon();

    for (i = 0; i < slicelength; ++i)
    {
        (*sipRes) += (*sipCpp)[start];
        start += step;
    }
}
%End

int __contains__(const QPoint &value);
%MethodCode
// It looks like you can't assign QBool to int.
sipRes = bool(sipCpp->contains(*a0));
%End
%If (Qt_4_8_0 -)
    void swap(QPolygon &other);
%End
};

class QPolygonF
{
%TypeHeaderCode
#include <qpolygon.h>
%End

public:
    QPolygonF();
    ~QPolygonF();
    QPolygonF(const QPolygonF &a);
    QPolygonF(const QVector<QPointF> &v);
    QPolygonF(const QRectF &r);
    QPolygonF(const QPolygon &a);
    QPolygonF(int asize);
    void translate(const QPointF &offset);
    QPolygon toPolygon() const;
    bool isClosed() const;
    QRectF boundingRect() const;
    void translate(qreal dx, qreal dy);
%If (Qt_4_3_0 -)
    bool containsPoint(const QPointF &pt, Qt::FillRule fillRule) const;
%End
%If (Qt_4_3_0 -)
    QPolygonF united(const QPolygonF &r) const;
%End
%If (Qt_4_3_0 -)
    QPolygonF intersected(const QPolygonF &r) const;
%End
%If (Qt_4_3_0 -)
    QPolygonF subtracted(const QPolygonF &r) const;
%End
%If (Qt_4_6_0 -)
    QPolygonF translated(const QPointF &offset) const;
%End
%If (Qt_4_6_0 -)
    QPolygonF translated(qreal dx, qreal dy) const;
%End
// Methods inherited from QVector<QPointF> and Python special methods.
// Keep in sync with QPolygon and QXmlStreamAttributes.

void append(const QPointF &value);
const QPointF &at(int i) const;
void clear();
bool contains(const QPointF &value) const;
int count(const QPointF &value) const;
int count() const /__len__/;
void *data();

// Note the Qt return value is discarded as it would require handwritten code
// and seems pretty useless.
void fill(const QPointF &value, int size = -1);

QPointF &first();
int indexOf(const QPointF &value, int from = 0) const;
void insert(int i, const QPointF &value);
bool isEmpty() const;
QPointF &last();
int lastIndexOf(const QPointF &value, int from = -1) const;

// Note the Qt return type is QVector<QPointF>.
QPolygonF mid(int pos, int length = -1) const;

void prepend(const QPointF &value);
void remove(int i);
void remove(int i, int count);
void replace(int i, const QPointF &value);
int size() const;
QPointF value(int i) const;
QPointF value(int i, const QPointF &defaultValue) const;
bool operator!=(const QPolygonF &other) const;

// Note the Qt return type is QVector<QPointF>.
QPolygonF operator+(const QPolygonF &other) const;

QPolygonF &operator+=(const QPolygonF &other);
QPolygonF &operator+=(const QPointF &value);
bool operator==(const QPolygonF &other) const;

SIP_PYOBJECT operator<<(const QPointF &value);
%MethodCode
    *a0 << *a1;

    sipRes = sipArg0;
    Py_INCREF(sipRes);
%End

QPointF &operator[](int i);
%MethodCode
SIP_SSIZE_T idx = sipConvertFromSequenceIndex(a0, sipCpp->count());

if (idx < 0)
    sipIsErr = 1;
else
    sipRes = new QPointF(sipCpp->operator[]((int)idx));
%End

// Some additional Python special methods.

void __setitem__(int i, const QPointF &value);
%MethodCode
int len;

len = sipCpp->count();

if ((a0 = (int)sipConvertFromSequenceIndex(a0, len)) < 0)
    sipIsErr = 1;
else
    (*sipCpp)[a0] = *a1;
%End

void __setitem__(SIP_PYSLICE slice, const QPolygonF &list);
%MethodCode
SIP_SSIZE_T len, start, stop, step, slicelength, i;

len = sipCpp->count();

#if PY_VERSION_HEX >= 0x03020000
if (PySlice_GetIndicesEx(a0, len, &start, &stop, &step, &slicelength) < 0)
#else
if (PySlice_GetIndicesEx((PySliceObject *)a0, len, &start, &stop, &step, &slicelength) < 0)
#endif
    sipIsErr = 1;
else
{
    int vlen = a1->count();

    if (vlen != slicelength)
    {
        sipBadLengthForSlice(vlen, slicelength);
        sipIsErr = 1;
    }
    else
    {
        QVector<QPointF>::const_iterator it = a1->begin();

        for (i = 0; i < slicelength; ++i)
        {
            (*sipCpp)[start] = *it;
            start += step;
            ++it;
        }
    }
}
%End

void __delitem__(int i);
%MethodCode
int len;

len = sipCpp->count();

if ((a0 = (int)sipConvertFromSequenceIndex(a0, len)) < 0)
    sipIsErr = 1;
else
    sipCpp->remove(a0);
%End

void __delitem__(SIP_PYSLICE slice);
%MethodCode
SIP_SSIZE_T len, start, stop, step, slicelength, i;

len = sipCpp->count();

#if PY_VERSION_HEX >= 0x03020000
if (PySlice_GetIndicesEx(a0, len, &start, &stop, &step, &slicelength) < 0)
#else
if (PySlice_GetIndicesEx((PySliceObject *)a0, len, &start, &stop, &step, &slicelength) < 0)
#endif
    sipIsErr = 1;
else
    for (i = 0; i < slicelength; ++i)
    {
        sipCpp->remove(start);
        start += step - 1;
    }
%End

QPolygonF &operator[](SIP_PYSLICE slice);
%MethodCode
SIP_SSIZE_T len, start, stop, step, slicelength, i;

len = sipCpp->count();

#if PY_VERSION_HEX >= 0x03020000
if (PySlice_GetIndicesEx(a0, len, &start, &stop, &step, &slicelength) < 0)
#else
if (PySlice_GetIndicesEx((PySliceObject *)a0, len, &start, &stop, &step, &slicelength) < 0)
#endif
    sipIsErr = 1;
else
{
    sipRes = new QPolygonF();

    for (i = 0; i < slicelength; ++i)
    {
        (*sipRes) += (*sipCpp)[start];
        start += step;
    }
}
%End

int __contains__(const QPointF &value);
%MethodCode
// It looks like you can't assign QBool to int.
sipRes = bool(sipCpp->contains(*a0));
%End
%If (Qt_4_8_0 -)
    void swap(QPolygonF &other);
%End
};

QDataStream &operator<<(QDataStream &stream, const QPolygonF &array /Constrained/);
QDataStream &operator>>(QDataStream &stream, QPolygonF &array /Constrained/);
%If (Qt_4_4_0 -)
QDataStream &operator<<(QDataStream &stream, const QPolygon &polygon /Constrained/);
%End
%If (Qt_4_4_0 -)
QDataStream &operator>>(QDataStream &stream, QPolygon &polygon /Constrained/);
%End