summaryrefslogtreecommitdiffstats
path: root/python/pykde/sip/kdecore/bytearray.sip
blob: 74e31dcb0dff01aee61c2e595b3a353e33971b45 (plain)
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
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
//
//     Copyright 2004 Jim Bublitz <jbublitz@nwinternet.com>
//     Earlier copyrights 1998 - 2003 Jim Bublitz and/or Phil Thompson
//     may also apply

//            module kdecore  version KDE_3_2_2


// This software 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.
//
// This software is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public
// License along with this library; see the file COPYING.
// If not, write to the Free Software Foundation, Inc.,
// 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.

%ModuleHeaderCode
#include <qvariant.h>
#include <sipdcopQValueList.h>
%End


void dcop_add (QDataStream&, int /Constrained/, const QCString& = "int");
//void dcop_add (QDataStream&, longlong);
//void dcop_add (QDataStream&, ulonglong);
void dcop_add (QDataStream&, double, const QCString& = "double");
void dcop_add (QDataStream&, QString);
void dcop_add (QDataStream&, QStringList);
void dcop_add (QDataStream&, QCString);
void dcop_add (QDataStream&, KURL);
void dcop_add (QDataStream&, KURL::List);
void dcop_add (QDataStream&, QSize);
void dcop_add (QDataStream&, QRect);
void dcop_add (QDataStream&, QRegion);
void dcop_add (QDataStream&, QPoint);
void dcop_add (QDataStream&, QFont);
void dcop_add (QDataStream&, QCursor);
void dcop_add (QDataStream&, QPixmap);
void dcop_add (QDataStream&, QColor);
void dcop_add (QDataStream&, QColorGroup);
void dcop_add (QDataStream&, QPalette);
void dcop_add (QDataStream&, QBrush);
void dcop_add (QDataStream&, QWidget::FocusPolicy);
void dcop_add (QDataStream&, DCOPRef);
void dcop_add (QDataStream&, QVariant);
void dcop_add (QDataStream&, QDate);
void dcop_add (QDataStream&, QTime);
void dcop_add (QDataStream&, QDateTime);
void dcop_add (QDataStream&, QImage);
void dcop_add (QDataStream&, QKeySequence);
void dcop_add (QDataStream&, QPen);
void dcop_add (QDataStream&, QPicture);
void dcop_add (QDataStream&, QPointArray);

void dcop_add (QDataStream&, SIP_PYDICT, QCString);
%MethodCode
    int iserr = 0;
    if (*a2 == "QMap<QCString,DCOPRef>")
    {
        QMap<QCString,DCOPRef> *map = (QMap<QCString,DCOPRef> *)sipForceConvertTo_QMap_0200QCString_0200DCOPRef(a1, &iserr);

        if (iserr)
        {
            sipIsErr = 1;
            return 0;
        }
        *a0 << *map;
    }
    else if (*a2 == "QMap<QString,DCOPRef>")
    {
        QMap<QString,DCOPRef> *map = (QMap<QString,DCOPRef> *)sipForceConvertTo_QMap_0200QString_0200DCOPRef(a1, &iserr);

        if (iserr)
        {
            sipIsErr = 1;
            return 0;
        }
        *a0 << *map;
    }
%End


void dcop_add (QDataStream&, SIP_PYLIST, QCString);
%MethodCode
    int iserr = 0;
    if (*a2 == "QValueList<QCString>")
    {
        QValueList<QCString> *list = (QValueList<QCString> *)sipForceConvertTo_QValueList_0200QCString (a1, &iserr);

        if (iserr)
        {
            sipIsErr = 1;
            return 0;
        }
        *a0 << *list;
    }
    else if (*a2 == "QValueList<DCOPRef>")
    {
        QValueList<DCOPRef> *list = (QValueList<DCOPRef> *)sipForceConvertTo_QValueList_0200DCOPRef (a1, &iserr);

        if (iserr)
        {
            sipIsErr = 1;
            return 0;
        }
        *a0 << *list;
    }
%End


void dcop_next (QDataStream&, QCString&);
%MethodCode
    if (*a1 == "char")
    {
        Q_INT8 res;
        *a0 >> res;
        return PyInt_FromLong ((long)res);
    }
    else if (*a1 == "bool")
    {
        bool res;
        *a0 >> res;
        return PyBool_FromLong ((long)res);
    }
    else if (*a1 == "int")
    {
        int res;
        *a0 >> res;
        return PyInt_FromLong ((long)res);
    }
    else if (*a1 == "long")
    {
        long res;
        *a0 >> res;
        return PyLong_FromLong (res);
    }
    else if (*a1 == "short")
    {
        short res;
        *a0 >> res;
        return PyInt_FromLong ((long)res);
    }
    if (*a1 == "uchar" || *a1 == "unsigned char")
    {
        Q_UINT8 res;
        *a0 >> res;
        return PyInt_FromLong ((long)res);
    }
    else if (*a1 == "uint" || *a1 == "unsigned int")
    {
        unsigned int res;
        *a0 >> res;
        return PyInt_FromLong ((long)res);
    }
    else if (*a1 == "ulong" || *a1 == "unsigned long")
    {
        unsigned long res;
        *a0 >> res;
        return PyLong_FromLong (res);
    }
    else if (*a1 == "Q_INT32")
    {
        Q_INT32 res;
        *a0 >> res;
        return PyLong_FromLong ((long)res);
    }
    else if (*a1 == "pid_t")
    {
        pid_t res;
        *a0 >> res;
        return PyLong_FromLong ((long)res);
    }
    else if (*a1 == "ushort" || *a1 == "unsigned short")
    {
        unsigned short res;
        *a0 >> res;
        return PyInt_FromLong ((long)res);
    }
    else if (*a1 == "float")
    {
        float res;
        *a0 >> res;
        return PyFloat_FromDouble ((double)res);
    }
    else if (*a1 == "double")
    {
        double res;
        *a0 >> res;
        return PyFloat_FromDouble (res);
    }
    else if (*a1 == "QString")
    {
        QString res;
        *a0 >> res;
        return sipBuildResult (NULL, "N", new QString (res),sipClass_QString);
    }
    else if (*a1 == "QStringList")
    {
        QStringList res;
        *a0 >> res;
        return sipBuildResult (NULL, "N", new QStringList (res),sipClass_QStringList);
    }
    else if (*a1 == "QCString")
    {
        QCString res;
        *a0 >> res;
        return sipBuildResult (NULL, "N", new QCString (res),sipClass_QCString);
    }
    else if (*a1 == "KURL")
    {
        KURL res;
        *a0 >> res;
        return sipBuildResult (NULL, "N", new KURL (res),sipClass_KURL);
    }
    else if (*a1 == "KURL::List")
    {
        KURL::List res;
        *a0 >> res;
        return sipBuildResult (NULL, "N", new KURL::List (res),sipClass_KURL_List);
    }
    else if (*a1 == "QSize")
    {
        QSize res;
        *a0 >> res;
        return sipBuildResult (NULL, "N", new QSize (res),sipClass_QSize);
    }
    else if (*a1 == "QRect")
    {
        QRect res;
        *a0 >> res;
        return sipBuildResult (NULL, "N", new QRect (res),sipClass_QRect);
    }
    else if (*a1 == "QRegion")
    {
        QRect res;
        *a0 >> res;
        return sipBuildResult (NULL, "N", new QRegion (res),sipClass_QRegion);
    }
    else if (*a1 == "QPoint")
    {
        QPoint res;
        *a0 >> res;
        return sipBuildResult (NULL, "N", new QPoint (res),sipClass_QPoint);
    }
    else if (*a1 == "QFont")
    {
        QFont res;
        *a0 >> res;
        return sipBuildResult (NULL, "N", new QFont (res),sipClass_QFont);
    }
    else if (*a1 == "QCursor")
    {
        QCursor res;
        *a0 >> res;
        return sipBuildResult (NULL, "N", new QCursor (res),sipClass_QCursor);
    }
    else if (*a1 == "QPixmap")
    {
        QPixmap res;
        *a0 >> res;
        return sipBuildResult (NULL, "N", new QPixmap (res),sipClass_QPixmap);
    }
    else if (*a1 == "QColor")
    {
        QColor res;
        *a0 >> res;
        return sipBuildResult (NULL, "N", new QColor (res),sipClass_QColor);
    }
    else if (*a1 == "QColorGroup")
    {
        QColorGroup res;
        *a0 >> res;
        return sipBuildResult (NULL, "N", new QColorGroup (res),sipClass_QColorGroup);
    }
    else if (*a1 == "QPalette")
    {
        QPalette res;
        *a0 >> res;
        return sipBuildResult (NULL, "N", new QPalette (res),sipClass_QPalette);
    }
    else if (*a1 == "QBrush")
    {
        QBrush res;
        *a0 >> res;
        return sipBuildResult (NULL, "N", new QBrush (res),sipClass_QBrush);
    }
    else if (*a1 == "FocusPolicy")
    {
        unsigned int res;
        *a0 >> res;
        return PyInt_FromLong ((long)res);
    }
    else if (*a1 == "DCOPRef")
    {
        DCOPRef res;
        *a0 >> res;
        return sipBuildResult (NULL, "N", new DCOPRef (res),sipClass_DCOPRef);
    }
    else if (*a1 == "QVariant")
    {
        QVariant res;
        *a0 >> res;
        return sipBuildResult (NULL, "N", new QVariant (res),sipClass_QVariant);
    }
    else if (*a1 == "QDate")
    {
        QDate res;
        *a0 >> res;
        return sipBuildResult (NULL, "N", new QDate (res),sipClass_QDate);
    }
    else if (*a1 == "QTime")
    {
        QTime res;
        *a0 >> res;
        return sipBuildResult (NULL, "N", new QTime (res),sipClass_QTime);
    }
    else if (*a1 == "QDateTime")
    {
        QDateTime res;
        *a0 >> res;
        return sipBuildResult (NULL, "N", new QDateTime (res),sipClass_QDateTime);
    }
    else if (*a1 == "QImage")
    {
        QImage res;
        *a0 >> res;
        return sipBuildResult (NULL, "N", new QImage (res),sipClass_QImage);
    }
    else if (*a1 == "QKeySequence")
    {
        QKeySequence res;
        *a0 >> res;
        return sipBuildResult (NULL, "N", new QKeySequence (res),sipClass_QKeySequence);
    }
    else if (*a1 == "QPen")
    {
        QPen res;
        *a0 >> res;
        return sipBuildResult (NULL, "N", new QPen (res),sipClass_QPen);
    }
    else if (*a1 == "QPicture")
    {
        QPicture res;
        *a0 >> res;
        return sipBuildResult (NULL, "N", new QPicture (res),sipClass_QPicture);
    }
    else if (*a1 == "QPointArray")
    {
        QPointArray res;
        *a0 >> res;
        return sipBuildResult (NULL, "N", new QPointArray (res),sipClass_QPointArray);
    }
    else if (*a1 == "QMap<QCString,DCOPRef>")
    {
        QMap<QCString, DCOPRef> res;
        *a0 >> res;
//        return sipConvertFrom_QMap_0200QCString_0200DCOPRef (&res);
        return sipConvertFromMappedType (&res, &sipMappedTypeDef_QMap_0200QCString_0200DCOPRef, NULL);
    }
    else if (*a1 == "QMap<QString,DCOPRef>")
    {
        QMap<QString, DCOPRef> res;
        *a0 >> res;
//        return sipConvertFrom_QMap_0200QString_0200DCOPRef (&res);
        return sipConvertFromMappedType (&res, &sipMappedTypeDef_QMap_0200QString_0200DCOPRef, NULL);
    }
    else if (*a1 == "QValueList<QCString>")
    {
        QValueList<QCString> res;
        *a0 >> res;
//        return sipConvertFrom_QValueList_0200QCString (&res);
        return sipConvertFromMappedType (&res, (sipMappedType *) sipFindMappedType ("sipMappedTypeDef_QValueList_0200QCString"), NULL);
    }
    else if (*a1 == "QValueList<DCOPRef>" || *a1 == "QCStringList")
    {
        QValueList<DCOPRef> res;
        *a0 >> res;
//        return sipConvertFrom_QValueList_0200DCOPRef (&res);
        return sipConvertFromMappedType (&res, &sipMappedTypeDef_QValueList_0200DCOPRef, NULL);
    }

%End

%ModuleHeaderCode
#include <qcstring.h>
#include <qdatastream.h>
#include <dcopref.h>
%End

%ModuleCode

void dcop_add (QDataStream& s, int value, const QCString& type_)
{
    if (type_ == "char")
        s << (Q_INT8)value;
    else if (type_ == "bool")
        s << (bool)value;
    else if (type_ == "short")
        s << (short)value;
    else if (type_ == "int")
        s << (int)value;
    else if (type_ == "long")
        s << (long)value;
    else if (type_== "uchar" || type_ == "unsigned char")
        s << (Q_UINT8)value;
    else if (type_ == "ushort" || type_ == "unsigned short")
        s << (ushort)value;
    else if (type_ == "uint" || type_ == "unsigned int")
        s << (uint)value;
    else if (type_ == "ulong" || type_ == "unsigned long")
        s << (long)value;
}

/*void dcop_add (QDataStream& s, longlong value)
{
    s << value;
}

void dcop_add (QDataStream& s, ulonglong value)
{
    s << value;
}*/

void dcop_add (QDataStream& s, double value, const QCString& type_)
{
    if (type_ == "double")
        s << value;
    else if (type_ == "float")
        s << (float)value;
}

void dcop_add (QDataStream& s, QString value)
{
    s << value;
}

void dcop_add (QDataStream& s, QStringList value)
{
    s << value;
}

void dcop_add (QDataStream& s, QCString value)
{
    s << value;
}

void dcop_add (QDataStream& s, KURL value)
{
    s << value;
}

void dcop_add (QDataStream& s, KURL::List value)
{
    s << value;
}

void dcop_add (QDataStream& s, QSize value)
{
    s << value;
}

void dcop_add (QDataStream& s, QRect value)
{
    s << value;
}

void dcop_add (QDataStream& s, QRegion value)
{
    s << value;
}

void dcop_add (QDataStream& s, QPoint value)
{
    s << value;
}

void dcop_add (QDataStream& s, QFont value)
{
    s << value;
}

void dcop_add (QDataStream& s, QCursor value)
{
    s << value;
}

void dcop_add (QDataStream& s, QPixmap value)
{
    s << value;
}

void dcop_add (QDataStream& s, QColor value)
{
    s << value;
}

void dcop_add (QDataStream& s, QColorGroup value)
{
    s << value;
}

void dcop_add (QDataStream& s, QPalette value)
{
    s << value;
}

void dcop_add (QDataStream& s, QBrush value)
{
    s << value;
}

void dcop_add (QDataStream& s, QWidget::FocusPolicy value)
{
    s << value;
}

void dcop_add (QDataStream& s, DCOPRef value)
{
    s << value;
}

void dcop_add (QDataStream& s, QVariant value)
{
    s << value;
}

void dcop_add (QDataStream& s, QDate value)
{
    s << value;
}

void dcop_add (QDataStream& s, QTime value)
{
    s << value;
}

void dcop_add (QDataStream& s, QDateTime value)
{
    s << value;
}

void dcop_add (QDataStream& s, QImage value)
{
    s << value;
}

void dcop_add (QDataStream& s, QKeySequence value)
{
    s << value;
}

void dcop_add (QDataStream& s, QPen value)
{
    s << value;
}

void dcop_add (QDataStream& s, QPicture value)
{
    s << value;
}

void dcop_add (QDataStream& s, QPointArray value)
{
    s << value;
}

%End


%MappedType QMap<QCString,DCOPRef>
//converts a Python dict of QCString:DCOPRef
{
%TypeHeaderCode
#include <qmap.h>
#include <sipdcopDCOPRef.h>
#include <sipqtQCString.h>
//typedef QMap<QCString,DCOPRef> DCOPRefMap;
%End

%ConvertFromTypeCode
    // Convert to a Python dict

    if (!sipCpp)
        return PyDict_New();

    PyObject *dict;

    // Create the dictionary.

    if ((dict = PyDict_New()) == NULL)
        return NULL;

    // Get it.

    const QMap<QCString,DCOPRef> cppmap = *sipCpp;
    QMap<QCString,DCOPRef>::ConstIterator it;

    for (it = cppmap.begin (); it != cppmap.end (); ++it)
    {
        QCString acpp = it.key ();
        DCOPRef bcpp = it.data ();
        PyObject *ainst;
        PyObject *binst;
        if (((ainst = sipBuildResult (NULL, "N", new QCString (acpp), sipClass_QCString)) == NULL)
            || ((binst = sipBuildResult (NULL, "N", new DCOPRef (bcpp), sipClass_DCOPRef)) == NULL)
            || (PyDict_SetItem (dict, ainst, binst) < 0))
        {
            Py_XDECREF (ainst);
            Py_XDECREF (binst);
            Py_DECREF (dict);
            return NULL;
        }
    }

    return dict;
%End


%ConvertToTypeCode
    // Convert a Python dictionary to a QMap on the heap.

    if (sipIsErr == NULL)
        return PyDict_Check(sipPy);


    QMap<QCString,DCOPRef> *cppmap = new QMap<QCString,DCOPRef>;

    PyObject *aelem, *belem;
    int pos = 0;
    QCString *acpp;
    DCOPRef *bcpp;

    while (PyDict_Next(sipPy, &pos, &aelem, &belem))
    {
        int iserr = 0;

        if (iserr)
        {
            *sipIsErr = 1;
            delete cppmap;
            return 0;
        }
        acpp = (QCString *)sipForceConvertTo_QCString (aelem, &iserr);
        bcpp = (DCOPRef *)sipForceConvertTo_DCOPRef (belem, &iserr);
        cppmap->insert (*acpp, *bcpp);
    }

    *sipCppPtr = cppmap;

    return 1;
%End
};

%MappedType QMap<QString,DCOPRef>
//converts a Python dict of QString:DCOPRef
{
%TypeHeaderCode
#include <qmap.h>
#include <sipdcopDCOPRef.h>
#include <sipqtQString.h>
//typedef QMap<QString,DCOPRef> DCOPRefMap;
%End

%ConvertFromTypeCode
    // Convert to a Python dict

    if (!sipCpp)
        return PyDict_New();

    PyObject *dict;

    // Create the dictionary.

    if ((dict = PyDict_New()) == NULL)
        return NULL;

    // Get it.

    const QMap<QString,DCOPRef> cppmap = *sipCpp;
    QMap<QString,DCOPRef>::ConstIterator it;

    for (it = cppmap.begin (); it != cppmap.end (); ++it)
    {
        QString acpp = it.key ();
        DCOPRef bcpp = it.data ();
        PyObject *ainst;
        PyObject *binst;
        if (((ainst = sipBuildResult (NULL, "N", new QString (acpp), sipClass_QString)) == NULL)
            || ((binst = sipBuildResult (NULL, "N", new DCOPRef (bcpp), sipClass_DCOPRef)) == NULL)
            || (PyDict_SetItem (dict, ainst, binst) < 0))
        {
            Py_XDECREF (ainst);
            Py_XDECREF (binst);
            Py_DECREF (dict);
            return NULL;
        }
    }

    return dict;
%End


%ConvertToTypeCode
    // Convert a Python dictionary to a QMap on the heap.

    if (sipIsErr == NULL)
        return PyDict_Check(sipPy);


    QMap<QString,DCOPRef> *cppmap = new QMap<QString,DCOPRef>;

    PyObject *aelem, *belem;
    int pos = 0;
    QString *acpp;
    DCOPRef *bcpp;

    while (PyDict_Next(sipPy, &pos, &aelem, &belem))
    {
        int iserr = 0;

        if (iserr)
        {
            *sipIsErr = 1;
            delete cppmap;
            return 0;
        }

        acpp = (QString *)sipForceConvertTo_QString (aelem, &iserr);
        bcpp = (DCOPRef *)sipForceConvertTo_DCOPRef (belem, &iserr);
  
        cppmap->insert (*acpp, *bcpp);
    }

    *sipCppPtr = cppmap;

    return 1;
%End
};


%MappedType QValueList<DCOPRef>
//converts a Python list of DCOPRef
{
%TypeHeaderCode
#include <qvaluelist.h>
%End

%ConvertFromTypeCode
    if (!sipCpp)
        return PyList_New(0);

    // Create the list
    PyObject *pylist;
    if ((pylist = PyList_New(0)) == NULL)
        return NULL;

    QValueList<DCOPRef> *cpplist = (QValueList<DCOPRef> *)sipCpp;
    PyObject *inst;

    // Get it.
    QValueList<DCOPRef>::Iterator it;
    for( it = cpplist->begin(); it != cpplist->end(); ++it )
    {
        if (((inst = sipBuildResult (NULL, "N", new DCOPRef (*it), sipClass_DCOPRef)) == NULL)
            || PyList_Append (pylist, inst) < 0)
        {
            Py_DECREF (pylist);
            return NULL;
        }
    }

    return pylist;
%End


%ConvertToTypeCode
    if (sipIsErr == NULL)
        return PyList_Check(sipPy);

    QValueList<DCOPRef> *cpplist = new QValueList<DCOPRef>;

    PyObject *elem;
    DCOPRef *cpp;
    int iserr = 0;

    for (int i = 0; i < PyList_Size (sipPy); i++)
    {
        elem = PyList_GET_ITEM (sipPy, i);
        cpp = (DCOPRef *)sipForceConvertTo_DCOPRef (elem, &iserr);
        if (iserr)
        {
            *sipIsErr = 1;
            delete cpplist;
            return 0;
        }

        cpplist->append (*cpp);
    }

    *sipCppPtr = cpplist;

    return 1;
%End
};