summaryrefslogtreecommitdiffstats
path: root/sip/kdecore/bytearray.sip
blob: aae47803b0ebd26372dca54ccc85672d1265b9f1 (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
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
//
//     Copyright 2004 Jim Bublitz <jbublitz@nwinternet.com>
//     Earlier copyrights 1998 - 2003 Jim Bublitz and/or Phil Thompson
//     may also apply

//            module tdecore  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>
%End


void dcop_add (QDataStream&, QWidget::FocusPolicy /Constrained/);
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&, 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&, QByteArray);

void dcop_add (QDataStream&, SIP_PYDICT, QCString);
%MethodCode
    const sipTypeDef *map_td = sipFindType(*a2);

    if (map_td)
    {
        int iserr = 0;
        void *map_v;

        map_v = sipForceConvertToType(a1, map_td, NULL,
                SIP_NOT_NONE|SIP_NO_CONVERTORS, NULL, &iserr);

        if (iserr)
        {
            sipIsErr = 1;
        }
        else if (*a2 == "QMap<QCString,DCOPRef>")
        {
            QMap<QCString,DCOPRef> *map = (QMap<QCString,DCOPRef> *)map_v;

            *a0 << *map;
        }
        else if (*a2 == "QMap<QString,DCOPRef>")
        {
            QMap<QString,DCOPRef> *map = (QMap<QString,DCOPRef> *)map_v;

            *a0 << *map;
        }
        else if (*a2 == "QMap<QString,QString>")
        {
            QMap<QString,QString> *map = (QMap<QString,QString> *)map_v;

            *a0 << *map;
        }
        else if (*a2 == "QMap<QString,QByteArray>")
        {
            QMap<QString,QByteArray> *map = (QMap<QString,QByteArray> *)map_v;

            *a0 << *map;
        }
    }
%End


void dcop_add (QDataStream&, SIP_PYLIST, QCString);
%MethodCode
    const sipTypeDef *list_td = sipFindType(*a2);

    if (list_td)
    {
        int iserr = 0;
        void *list_v;

        list_v = sipForceConvertToType(a1, list_td, NULL,
                SIP_NOT_NONE|SIP_NO_CONVERTORS, NULL, &iserr);

        if (iserr)
        {
            sipIsErr = 1;
        }
        else if (*a2 == "QValueList<QCString>")
        {
            QValueList<QCString> *list = (QValueList<QCString> *)list_v;

            *a0 << *list;
        }
        else if (*a2 == "QValueList<DCOPRef>")
        {
            QValueList<DCOPRef> *list = (QValueList<DCOPRef> *)list_v;

            *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 sipConvertFromNewType(new QString(res), sipType_QString, NULL);
    }
    else if (*a1 == "QStringList")
    {
        QStringList res;
        *a0 >> res;
        return sipConvertFromNewType(new QStringList(res), sipType_QStringList, NULL);
    }
    else if (*a1 == "QCString")
    {
        QCString res;
        *a0 >> res;
        return sipConvertFromNewType(new QCString(res), sipType_QCString, NULL);
    }
    else if (*a1 == "KURL")
    {
        KURL res;
        *a0 >> res;
        return sipConvertFromNewType(new KURL(res), sipType_KURL, NULL);
    }
    else if (*a1 == "KURL::List")
    {
        KURL::List res;
        *a0 >> res;
        return sipConvertFromNewType(new KURL::List(res), sipType_KURL_List, NULL);
    }
    else if (*a1 == "QSize")
    {
        QSize res;
        *a0 >> res;
        return sipConvertFromNewType(new QSize(res), sipType_QSize, NULL);
    }
    else if (*a1 == "QRect")
    {
        QRect res;
        *a0 >> res;
        return sipConvertFromNewType(new QRect(res), sipType_QRect, NULL);
    }
    else if (*a1 == "QRegion")
    {
        QRect res;
        *a0 >> res;
        return sipConvertFromNewType(new QRegion(res), sipType_QRegion, NULL);
    }
    else if (*a1 == "QPoint")
    {
        QPoint res;
        *a0 >> res;
        return sipConvertFromNewType(new QPoint(res), sipType_QPoint, NULL);
    }
    else if (*a1 == "QFont")
    {
        QFont res;
        *a0 >> res;
        return sipConvertFromNewType(new QFont(res), sipType_QFont, NULL);
    }
    else if (*a1 == "QCursor")
    {
        QCursor res;
        *a0 >> res;
        return sipConvertFromNewType(new QCursor(res), sipType_QCursor, NULL);
    }
    else if (*a1 == "QPixmap")
    {
        QPixmap res;
        *a0 >> res;
        return sipConvertFromNewType(new QPixmap(res), sipType_QPixmap, NULL);
    }
    else if (*a1 == "QColor")
    {
        QColor res;
        *a0 >> res;
        return sipConvertFromNewType(new QColor(res), sipType_QColor, NULL);
    }
    else if (*a1 == "QColorGroup")
    {
        QColorGroup res;
        *a0 >> res;
        return sipConvertFromNewType(new QColorGroup(res), sipType_QColorGroup, NULL);
    }
    else if (*a1 == "QPalette")
    {
        QPalette res;
        *a0 >> res;
        return sipConvertFromNewType(new QPalette(res), sipType_QPalette, NULL);
    }
    else if (*a1 == "QBrush")
    {
        QBrush res;
        *a0 >> res;
        return sipConvertFromNewType(new QBrush(res), sipType_QBrush, NULL);
    }
    else if (*a1 == "FocusPolicy")
    {
        unsigned int res;
        *a0 >> res;
        return PyInt_FromLong ((long)res);
    }
    else if (*a1 == "DCOPRef")
    {
        DCOPRef res;
        *a0 >> res;
        return sipConvertFromNewType(new DCOPRef(res), sipType_DCOPRef, NULL);
    }
    else if (*a1 == "QVariant")
    {
        QVariant res;
        *a0 >> res;
        return sipConvertFromNewType(new QVariant(res), sipType_QVariant, NULL);
    }
    else if (*a1 == "QDate")
    {
        QDate res;
        *a0 >> res;
        return sipConvertFromNewType(new QDate(res), sipType_QDate, NULL);
    }
    else if (*a1 == "QTime")
    {
        QTime res;
        *a0 >> res;
        return sipConvertFromNewType(new QTime(res), sipType_QTime, NULL);
    }
    else if (*a1 == "QDateTime")
    {
        QDateTime res;
        *a0 >> res;
        return sipConvertFromNewType(new QDateTime(res), sipType_QDateTime, NULL);
    }
    else if (*a1 == "QImage")
    {
        QImage res;
        *a0 >> res;
        return sipConvertFromNewType(new QImage(res), sipType_QImage, NULL);
    }
    else if (*a1 == "QKeySequence")
    {
        QKeySequence res;
        *a0 >> res;
        return sipConvertFromNewType(new QKeySequence(res), sipType_QKeySequence, NULL);
    }
    else if (*a1 == "QPen")
    {
        QPen res;
        *a0 >> res;
        return sipConvertFromNewType(new QPen(res), sipType_QPen, NULL);
    }
    else if (*a1 == "QPicture")
    {
        QPicture res;
        *a0 >> res;
        return sipConvertFromNewType(new QPicture(res), sipType_QPicture, NULL);
    }
    else if (*a1 == "QPointArray")
    {
        QPointArray res;
        *a0 >> res;
        return sipConvertFromNewType(new QPointArray(res), sipType_QPointArray, NULL);
    }
    else if (*a1 == "QByteArray")
    {
        QByteArray res;
        *a0 >> res;
        return sipConvertFromNewType(new QByteArray(res), sipType_QByteArray, NULL);
    }
    else if (*a1 == "QMap<QCString,DCOPRef>")
    {
        QMap<QCString, DCOPRef> res;
        *a0 >> res;
        return sipConvertFromType(&res, sipFindType(*a1), NULL);
    }
    else if (*a1 == "QMap<QString,DCOPRef>")
    {
        QMap<QString, DCOPRef> res;
        *a0 >> res;
        return sipConvertFromType(&res, sipFindType(*a1), NULL);
    }
    else if (*a1 == "QMap<QString,QString>")
    {
        QMap<QString, QString> res;
        *a0 >> res;
        return sipConvertFromType(&res, sipFindType(*a1), NULL);
    }
    else if (*a1 == "QMap<QString,QByteArray>")
    {
        QMap<QString, QByteArray> res;
        *a0 >> res;
        return sipConvertFromType(&res, sipFindType(*a1), NULL);
    }
    else if (*a1 == "QValueList<QCString>")
    {
        QValueList<QCString> res;
        *a0 >> res;
        return sipConvertFromType(&res, sipFindType(*a1), NULL);
    }
    else if (*a1 == "QValueList<DCOPRef>" || *a1 == "QCStringList")
    {
        QValueList<DCOPRef> res;
        *a0 >> res;
        return sipConvertFromType(&res, sipFindType(*a1), 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;
}

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

%End


%MappedType QMap<QCString,DCOPRef>
//converts a Python dict of QCString:DCOPRef
{
%TypeHeaderCode
#include <qmap.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 = NULL;
        if (((ainst = sipConvertFromNewType(new QCString(acpp), sipType_QCString, NULL)) == NULL)
            || ((binst = sipConvertFromNewType(new DCOPRef(bcpp), sipType_DCOPRef, NULL)) == 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;
    SIP_SSIZE_T pos = 0;
    QCString *acpp;
    DCOPRef *bcpp;

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

        acpp = (QCString *)sipForceConvertToType(aelem, sipType_QCString, sipTransferObj, SIP_NOT_NONE|SIP_NO_CONVERTORS, NULL, &iserr);
        bcpp = (DCOPRef *)sipForceConvertToType(belem, sipType_DCOPRef, sipTransferObj, SIP_NOT_NONE|SIP_NO_CONVERTORS, NULL, &iserr);

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

        cppmap->insert (*acpp, *bcpp);
    }

    *sipCppPtr = cppmap;

    return 1;
%End
};

%MappedType QMap<QString,DCOPRef>
//converts a Python dict of QString:DCOPRef
{
%TypeHeaderCode
#include <qmap.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 = NULL;
        if (((ainst = sipConvertFromNewType(new QString(acpp), sipType_QString, sipTransferObj)) == NULL)
            || ((binst = sipConvertFromNewType(new DCOPRef(bcpp), sipType_DCOPRef, sipTransferObj)) == 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;
    SIP_SSIZE_T pos = 0;
    QString *acpp;
    DCOPRef *bcpp;

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

        acpp = (QString *)sipForceConvertToType(aelem, sipType_QString, sipTransferObj, SIP_NOT_NONE, &acpp_state, &iserr);
        bcpp = (DCOPRef *)sipForceConvertToType(belem, sipType_DCOPRef, sipTransferObj, SIP_NOT_NONE|SIP_NO_CONVERTORS, NULL, &iserr);
  
        if (iserr)
        {
            if (acpp)
                sipReleaseType(acpp, sipType_QString, acpp_state);

            *sipIsErr = 1;
            delete cppmap;
            return 0;
        }

        cppmap->insert (*acpp, *bcpp);

        sipReleaseType(acpp, sipType_QString, acpp_state);
    }

    *sipCppPtr = cppmap;

    return 1;
%End
};


//%MappedType QMap<QString,QString> is available in tdecore/kconfig.sip


%MappedType QMap<QString,QByteArray>
//converts a Python dict of QString:QByteArray
{
%TypeHeaderCode
#include <qmap.h>
%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,QByteArray> cppmap = *sipCpp;
    QMap<QString,QByteArray>::ConstIterator it;

    for (it = cppmap.begin (); it != cppmap.end (); ++it)
    {
        QString acpp = it.key ();
        QByteArray bcpp = it.data ();
        PyObject *ainst;
        PyObject *binst = NULL;
        if (((ainst = sipConvertFromNewType(new QString(acpp), sipType_QString, sipTransferObj)) == NULL)
            || ((binst = sipConvertFromNewType(new QByteArray(bcpp), sipType_QByteArray, sipTransferObj)) == 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<QString,QByteArray> on the heap.

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

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

    PyObject *aelem, *belem;
    SIP_SSIZE_T pos = 0;
    QString *acpp;
    QByteArray *bcpp;

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

        acpp = (QString *)sipForceConvertToType(aelem, sipType_QString, sipTransferObj, SIP_NOT_NONE, &acpp_state, &iserr);
        bcpp = (QByteArray *)sipForceConvertToType(belem, sipType_QByteArray, sipTransferObj, SIP_NOT_NONE, &bcpp_state, &iserr);
  
        if (iserr)
        {
            if (acpp)
                sipReleaseType(acpp, sipType_QString, acpp_state);

            *sipIsErr = 1;
            delete cppmap;
            return 0;
        }

        cppmap->insert (*acpp, *bcpp);

        sipReleaseType(acpp, sipType_QString, acpp_state);
        sipReleaseType(bcpp, sipType_QByteArray, bcpp_state);
    }

    *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 = sipConvertFromNewType(new DCOPRef(*it), sipType_DCOPRef, NULL)) == 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 *)sipForceConvertToType(elem, sipType_DCOPRef, sipTransferObj, SIP_NOT_NONE|SIP_NO_CONVERTORS, NULL, &iserr);
        if (iserr)
        {
            *sipIsErr = 1;
            delete cpplist;
            return 0;
        }

        cpplist->append (*cpp);
    }

    *sipCppPtr = cpplist;

    return 1;
%End
};