File: common.conf

package info (click to toggle)
klayout 0.30.0-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 292,204 kB
  • sloc: cpp: 2,068,428; ruby: 47,823; xml: 26,924; python: 14,404; sh: 1,812; tcl: 212; perl: 170; makefile: 112; ansic: 42
file content (945 lines) | stat: -rw-r--r-- 33,398 bytes parent folder | download
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 (C) 2006-2018 Matthias Koefferlein
#
# This program 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 program 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 program; if not, write to the Free Software
# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
#

# --------------------------------------------------------------
# Provides the definitions of QCoreApplication, QApplication and QGuiApplication

def add_native_qapp_ctor_impl(cls)

  qapplication_ctor_code = <<'CODE'
  static %CLS% *ctor_%CLS%_Adaptor_args(const std::vector<std::string> &args%ADDARGS%)
  {
    //  %CLS% needs static sources, so we give it some.
    static char **argv = 0;
    static std::vector<std::string> args_copy;
    static int argc = 0;

    if (argv != 0) {
      throw tl::Exception(tl::to_string(QObject::tr("%CLS% cannot be instantiated twice")));
    }
    argv = new char *[args.size ()];
    args_copy = args;
    argc = int (args.size ());
    for (std::vector<std::string>::const_iterator a = args_copy.begin (); a != args_copy.end (); ++a) {
      argv[a - args_copy.begin ()] = (char *) a->c_str ();
    }

    return new %CLS%_Adaptor (argc, argv%ADDARGSCALL%);
  }

  %CLS%_Adaptor (int &argc, char **argv%ADDARGS%) : %CLS% (argc, argv%ADDARGSCALL%) { }
CODE

  qapplication_ctor_decl = <<'DECL'
    gsi::constructor("new", &%CLS%_Adaptor::ctor_%CLS%_Adaptor_args, gsi::arg ("argv")%ADDARGS%, "@brief Creates a new %CLS% object\n\n@param argv The command line arguments to pass to Qt%ADDDOC%")
DECL

  if cls == "QApplication" 
    add_native_impl(cls + "_Adaptor", 
                    qapplication_ctor_code.gsub("%CLS%", cls).gsub("%ADDARGS%", ", bool gui").gsub("%ADDARGSCALL%", ", gui"), 
                    qapplication_ctor_decl.gsub("%CLS%", cls).gsub("%ADDARGS%", ", gsi::arg (\"gui\", true)").gsub("%ADDDOC%", "\\n@param gui If true, a GUI-enabled application is constructed"))
  else
    add_native_impl(cls + "_Adaptor", 
                    qapplication_ctor_code.gsub("%CLS%", cls).gsub("%ADDARGS%", "").gsub("%ADDARGSCALL%", ""), 
                    qapplication_ctor_decl.gsub("%CLS%", cls).gsub("%ADDARGS%", "").gsub("%ADDDOC%", ""))
  end

end

# --------------------------------------------------------------
# Provides the definitions for QObject::findChild and QObject::findChildren

def add_native_impl_QObject_findChild()

  # alternative implementation for QObject::findChild using QObject for T
  add_native_impl("QObject", <<'CODE', <<'DECL')

#if QT_VERSION < 0x50000

#include <QRegExp>

  QObject *find_child_impl (QObject *object, const QString &name) 
  { 
    return object->findChild<QObject *> (name); 
  }
  QList<QObject *> find_children_impl (QObject *object, const QString &name)
  { 
    return object->findChildren<QObject *> (name); 
  }
  QList<QObject *> find_children_impl2 (QObject *object, const QRegExp &re)
  { 
    return object->findChildren<QObject *> (re); 
  }
#else

#include <QRegularExpression>

  QObject *find_child_impl (QObject *object, const QString &name, Qt::FindChildOptions options)
  { 
    return object->findChild<QObject *> (name, options); 
  }
  QList<QObject *> find_children_impl (QObject *object, const QString &name, Qt::FindChildOptions options)
  { 
    return object->findChildren<QObject *> (name, options); 
  }
  QList<QObject *> find_children_impl2 (QObject *object, const QRegularExpression &re, Qt::FindChildOptions options)
  { 
    return object->findChildren<QObject *> (re, options); 
  }
#endif
CODE
#if QT_VERSION < 0x50000
  gsi::method_ext("findChild", &find_child_impl, gsi::arg("name", QString(), "null"), "@brief Specialisation for findChild (uses QObject as T).") +
  gsi::method_ext("findChildren", &find_children_impl, gsi::arg("name", QString(), "null"), "@brief Specialisation for findChildren (uses QObject as T).") +
  gsi::method_ext("findChildren", &find_children_impl2, gsi::arg("re"), "@brief Specialisation for findChildren (uses QObject as T).") 
#else
  gsi::method_ext("findChild", &find_child_impl, gsi::arg("name", QString(), "null"), gsi::arg("options", Qt::FindChildrenRecursively, "Qt::FindChildrenRecursively"), "@brief Specialisation for findChild (uses QObject as T).") +
  gsi::method_ext("findChildren", &find_children_impl, gsi::arg("name", QString(), "null"), gsi::arg("options", Qt::FindChildrenRecursively, "Qt::FindChildrenRecursively"), "@brief Specialisation for findChildren (uses QObject as T).") +
  gsi::method_ext("findChildren", &find_children_impl2, gsi::arg("re"), gsi::arg("options", Qt::FindChildrenRecursively, "Qt::FindChildrenRecursively"), "@brief Specialisation for findChildren (uses QObject as T).") 
#endif
DECL

end

# --------------------------------------------------------------
# Add native implementations for QImage
# Constructor from raw packed data without the cleanup functions

def add_native_impl_QImage

  add_native_impl("QImage_Adaptor", <<'CODE', <<'DECL')

  //  NOTE: QImage does not take ownership of the data, so 
  //  we will provide a buffer to do so. This requires an additional 
  //  copy, but as GSI is not guaranteeing the lifetime of the 
  //  data, this is required here.
  class DataHolder
  {
  public:

    DataHolder() : mp_data(0) { }
    DataHolder(unsigned char *data) : mp_data(data) { }

    ~DataHolder() 
    { 
      if (mp_data) {
        delete[](mp_data); 
      }
      mp_data = 0;
    }

    static unsigned char *alloc(const std::string &data)
    {
      unsigned char *ptr = new unsigned char[data.size()];
      memcpy(ptr, data.c_str(), data.size());
      return ptr;
    }

  private:
    unsigned char *mp_data;
  };

  static QImage_Adaptor *new_qimage_from_data1(const std::string &data, int width, int height, int bytesPerLine, QImage::Format format) 
  {
    return new QImage_Adaptor(DataHolder::alloc(data), width, height, bytesPerLine, format);
  }

  static QImage_Adaptor *new_qimage_from_data2(const std::string &data, int width, int height, QImage::Format format) 
  {
    return new QImage_Adaptor(DataHolder::alloc(data), width, height, format);
  }

  QImage_Adaptor(unsigned char *data, int width, int height, int bytesPerLine, QImage::Format format)
    : QImage(data, width, height, bytesPerLine, format), m_holder(data)
  {
  }

  QImage_Adaptor(unsigned char *data, int width, int height, QImage::Format format)
    : QImage (data, width, height, format), m_holder(data)
  {
  }

  DataHolder m_holder;

CODE
  gsi::constructor("new", &QImage_Adaptor::new_qimage_from_data1, gsi::arg ("data"), gsi::arg ("width"), gsi::arg ("height"), gsi::arg ("bytesPerLine"), gsi::arg ("format"),
    "@brief QImage::QImage(const uchar *data, int width, int height, int bytesPerLine)\n"
    "The cleanupFunction parameter is available currently."
  ) +
  gsi::constructor("new", &QImage_Adaptor::new_qimage_from_data2, gsi::arg ("data"), gsi::arg ("width"), gsi::arg ("height"), gsi::arg ("format"),
    "@brief QImage::QImage(const uchar *data, int width, int height)\n"
    "The cleanupFunction parameter is available currently."
  )
DECL

end

# --------------------------------------------------------------
# Alternative implementation for QFont::Light, QFont::Bold, QFont::Normal, QFont::DemiBold, QFont::Black

def add_native_impl_QFont

  add_native_impl("QFont", <<'CODE', <<'DECL')
  static unsigned int font_const_light () { return (unsigned int) QFont::Light; }
  static unsigned int font_const_normal () { return (unsigned int) QFont::Normal; }
  static unsigned int font_const_demibold () { return (unsigned int) QFont::DemiBold; }
  static unsigned int font_const_bold () { return (unsigned int) QFont::Bold; }
  static unsigned int font_const_black () { return (unsigned int) QFont::Black; }
CODE
  gsi::method("Light", &font_const_light, "@brief Font weight constant 'QFont::Light'.") +
  gsi::method("Normal", &font_const_normal, "@brief Font weight constant 'QFont::Normal'.") +
  gsi::method("DemiBold", &font_const_demibold, "@brief Font weight constant 'QFont::DemiBold'.") +
  gsi::method("Bold", &font_const_bold, "@brief Font weight constant 'QFont::Bold'.") +
  gsi::method("Black", &font_const_black, "@brief Font weight constant 'QFont::Black'.")
DECL

end

# --------------------------------------------------------------
# Alternative implementation for QRegion

def add_native_impl_QRegion

  # alternative implementation for QRegion::setRects
  add_native_impl("QRegion", <<'CODE', <<'DECL')
  static void f_QRegion_setRects(QRegion *r, const std::vector<QRect> &rects)
  {
    if (! rects.empty ()) {
      return r->setRects (&rects.front (), int (rects.size ()));
    }
  }
CODE
  gsi::method_ext("setRects", &f_QRegion_setRects, "@brief Adaption of setRects without pointer.")
DECL

end

# --------------------------------------------------------------
# Alternative implementation for QPersistentQModelIndex

def add_native_impl_QPersistentQModelIndex

  # alternative implementation for QPersistentQModelIndex::operator const QModelIndex &
  add_native_impl("QPersistentModelIndex", <<'CODE', <<'DECL')
#if QT_VERSION < 0x60000
  static const QModelIndex &castToQModelIndex(const QPersistentModelIndex *m)
  {
    return m->operator const QModelIndex &();
  }
#else
  static QModelIndex castToQModelIndex(const QPersistentModelIndex *m)
  {
    return m->operator QModelIndex();
  }
#endif
CODE
  gsi::method_ext("castToQModelIndex", &castToQModelIndex, "@brief Binding for \"operator const QModelIndex &\".")
DECL
  
end

# --------------------------------------------------------------
# implementation of operator<< and operator>> for QDataStream

def add_native_impl_streams

  add_native_impl("QDataStream", <<'CODE', <<'DECL')
  static qint8 f_QDataStream_read_qint8(QDataStream *s)
  {
    qint8 v = 0;
    *s >> v;
    return v;
  }

  static quint8 f_QDataStream_read_quint8(QDataStream *s)
  {
    quint8 v = 0;
    *s >> v;
    return v;
  }

  static qint16 f_QDataStream_read_qint16(QDataStream *s)
  {
    qint16 v = 0;
    *s >> v;
    return v;
  }

  static quint16 f_QDataStream_read_quint16(QDataStream *s)
  {
    quint16 v = 0;
    *s >> v;
    return v;
  }

  static qint32 f_QDataStream_read_qint32(QDataStream *s)
  {
    qint32 v = 0;
    *s >> v;
    return v;
  }

  static quint32 f_QDataStream_read_quint32(QDataStream *s)
  {
    quint32 v = 0;
    *s >> v;
    return v;
  }

  static quint64 f_QDataStream_read_quint64(QDataStream *s)
  {
    quint64 v = 0;
    *s >> v;
    return v;
  }

  static qint64 f_QDataStream_read_qint64(QDataStream *s)
  {
    qint64 v = 0;
    *s >> v;
    return v;
  }

  static double f_QDataStream_read_double(QDataStream *s)
  {
    double v = 0;
    *s >> v;
    return v;
  }

  static float f_QDataStream_read_float(QDataStream *s)
  {
    float v = 0;
    *s >> v;
    return v;
  }

  static bool f_QDataStream_read_bool(QDataStream *s)
  {
    bool v = 0;
    *s >> v;
    return v;
  }

  static qt_gsi::Converter<QChar>::target_type f_QDataStream_read_qchar(QDataStream *s)
  {
    QChar v = QChar (0);
    *s >> v;
    return qt_gsi::Converter<QChar>::toc (v);
  }

  static qt_gsi::Converter<QList<int> >::target_type f_QDataStream_read_int_list(QDataStream *s)
  {
    QList<int> v;
    *s >> v;
    return qt_gsi::Converter<QList<int> >::toc (v);
  }

  static qt_gsi::Converter<QVector<int> >::target_type f_QDataStream_read_int_vector(QDataStream *s)
  {
    QVector<int> v;
    *s >> v;
    return qt_gsi::Converter<QVector<int> >::toc (v);
  }

  static QString f_QDataStream_read_string(QDataStream *s)
  {
    QString v;
    *s >> v;
    return v;
  }

  static qt_gsi::Converter<QByteArray>::target_type f_QDataStream_read_bytearray(QDataStream *s)
  {
    QByteArray v;
    *s >> v;
    return qt_gsi::Converter<QByteArray>::toc (v);
  }

  static QDataStream *f_QDataStream_put_qint8(QDataStream *s, qint8 v)
  {
    *s << v;
    return s;
  }

  static QDataStream *f_QDataStream_put_quint8(QDataStream *s, quint8 v)
  {
    *s << v;
    return s;
  }

  static QDataStream *f_QDataStream_put_qint16(QDataStream *s, qint16 v)
  {
    *s << v;
    return s;
  }

  static QDataStream *f_QDataStream_put_quint16(QDataStream *s, quint16 v)
  {
    *s << v;
    return s;
  }

  static QDataStream *f_QDataStream_put_qint32(QDataStream *s, qint32 v)
  {
    *s << v;
    return s;
  }

  static QDataStream *f_QDataStream_put_quint32(QDataStream *s, quint32 v)
  {
    *s << v;
    return s;
  }

  static QDataStream *f_QDataStream_put_qint64(QDataStream *s, qint64 v)
  {
    *s << v;
    return s;
  }

  static QDataStream *f_QDataStream_put_quint64(QDataStream *s, quint64 v)
  {
    *s << v;
    return s;
  }

  static QDataStream *f_QDataStream_put_float(QDataStream *s, float v)
  {
    *s << v;
    return s;
  }

  static QDataStream *f_QDataStream_put_double(QDataStream *s, double v)
  {
    *s << v;
    return s;
  }

  static QDataStream *f_QDataStream_put_bool(QDataStream *s, bool v)
  {
    *s << v;
    return s;
  }

  static QDataStream *f_QDataStream_put_qchar(QDataStream *s, const qt_gsi::Converter<QChar>::target_type &v)
  {
    *s << qt_gsi::Converter<QChar>::toq (v);
    return s;
  }

  static QDataStream *f_QDataStream_put_int_list(QDataStream *s, const qt_gsi::Converter<QList<int> >::target_type &v)
  {
    *s << qt_gsi::Converter<QList<int> >::toq (v);
    return s;
  }

  static QDataStream *f_QDataStream_put_int_vector(QDataStream *s, const qt_gsi::Converter<QVector<int> >::target_type &v)
  {
    *s << qt_gsi::Converter<QVector<int> >::toq (v);
    return s;
  }

  static QDataStream *f_QDataStream_put_string(QDataStream *s, const QString &v)
  {
    *s << v;
    return s;
  }

  static QDataStream *f_QDataStream_put_bytearray(QDataStream *s, const qt_gsi::Converter<class QByteArray>::target_type &v)
  {
    *s << qt_gsi::Converter<class QByteArray>::toq (v);
    return s;
  }

CODE
  gsi::method_ext("read_i8", &f_QDataStream_read_qint8, "@brief Non-ambiguous adaptation of the corresponding operator>>") +
  gsi::method_ext("read_ui8", &f_QDataStream_read_quint8, "@brief Non-ambiguous adaptation of the corresponding operator>>") +
  gsi::method_ext("read_i16", &f_QDataStream_read_qint16, "@brief Non-ambiguous adaptation of the corresponding operator>>") +
  gsi::method_ext("read_ui16", &f_QDataStream_read_quint16, "@brief Non-ambiguous adaptation of the corresponding operator>>") +
  gsi::method_ext("read_i32", &f_QDataStream_read_qint32, "@brief Non-ambiguous adaptation of the corresponding operator>>") +
  gsi::method_ext("read_ui32", &f_QDataStream_read_quint32, "@brief Non-ambiguous adaptation of the corresponding operator>>") +
  gsi::method_ext("read_i64", &f_QDataStream_read_qint64, "@brief Non-ambiguous adaptation of the corresponding operator>>") +
  gsi::method_ext("read_ui64", &f_QDataStream_read_quint64, "@brief Non-ambiguous adaptation of the corresponding operator>>") +
  gsi::method_ext("read_d", &f_QDataStream_read_double, "@brief Non-ambiguous adaptation of the corresponding operator>>") +
  gsi::method_ext("read_f", &f_QDataStream_read_float, "@brief Non-ambiguous adaptation of the corresponding operator>>") +
  gsi::method_ext("read_b", &f_QDataStream_read_bool, "@brief Non-ambiguous adaptation of the corresponding operator>>") +
  gsi::method_ext("read_qc", &f_QDataStream_read_qchar, "@brief Non-ambiguous adaptation of the corresponding operator>>") +
  gsi::method_ext("read_il", &f_QDataStream_read_int_list, "@brief Non-ambiguous adaptation of the corresponding operator>>") +
  gsi::method_ext("read_iv", &f_QDataStream_read_int_vector, "@brief Non-ambiguous adaptation of the corresponding operator>>") +
  gsi::method_ext("read_s", &f_QDataStream_read_string, "@brief Non-ambiguous adaptation of the corresponding operator>>") +
  gsi::method_ext("read_ba", &f_QDataStream_read_bytearray, "@brief Non-ambiguous adaptation of the corresponding operator>>") +
  gsi::method_ext("put_i8", &f_QDataStream_put_qint8, "@brief Non-ambiguous adaptation of the corresponding operator<<") +
  gsi::method_ext("put_ui8", &f_QDataStream_put_quint8, "@brief Non-ambiguous adaptation of the corresponding operator<<") +
  gsi::method_ext("put_i16", &f_QDataStream_put_qint16, "@brief Non-ambiguous adaptation of the corresponding operator<<") +
  gsi::method_ext("put_ui16", &f_QDataStream_put_quint16, "@brief Non-ambiguous adaptation of the corresponding operator<<") +
  gsi::method_ext("put_i32", &f_QDataStream_put_qint32, "@brief Non-ambiguous adaptation of the corresponding operator<<") +
  gsi::method_ext("put_ui32", &f_QDataStream_put_quint32, "@brief Non-ambiguous adaptation of the corresponding operator<<") +
  gsi::method_ext("put_i64", &f_QDataStream_put_qint64, "@brief Non-ambiguous adaptation of the corresponding operator<<") +
  gsi::method_ext("put_ui64", &f_QDataStream_put_quint64, "@brief Non-ambiguous adaptation of the corresponding operator<<") +
  gsi::method_ext("put_d", &f_QDataStream_put_double, "@brief Non-ambiguous adaptation of the corresponding operator<<") +
  gsi::method_ext("put_f", &f_QDataStream_put_float, "@brief Non-ambiguous adaptation of the corresponding operator<<") +
  gsi::method_ext("put_b", &f_QDataStream_put_bool, "@brief Non-ambiguous adaptation of the corresponding operator<<") +
  gsi::method_ext("put_qc", &f_QDataStream_put_qchar, "@brief Non-ambiguous adaptation of the corresponding operator<<") +
  gsi::method_ext("put_il", &f_QDataStream_put_int_list, "@brief Non-ambiguous adaptation of the corresponding operator<<") +
  gsi::method_ext("put_iv", &f_QDataStream_put_int_vector, "@brief Non-ambiguous adaptation of the corresponding operator<<") +
  gsi::method_ext("put_s", &f_QDataStream_put_string, "@brief Non-ambiguous adaptation of the corresponding operator<<") +
  gsi::method_ext("put_ba", &f_QDataStream_put_bytearray, "@brief Non-ambiguous adaptation of the corresponding operator<<") 
DECL

# implementation of operator<< and operator>> for QTextStream
add_native_impl("QTextStream", <<'CODE', <<'DECL')
  static short f_QTextStream_read_s(QTextStream *s)
  {
    short v = 0;
    *s >> v;
    return v;
  }

  static unsigned short f_QTextStream_read_us(QTextStream *s)
  {
    unsigned short v = 0;
    *s >> v;
    return v;
  }

  static int f_QTextStream_read_i(QTextStream *s)
  {
    int v = 0;
    *s >> v;
    return v;
  }

  static unsigned int f_QTextStream_read_ui(QTextStream *s)
  {
    unsigned int v = 0;
    *s >> v;
    return v;
  }

  static qulonglong f_QTextStream_read_ull(QTextStream *s)
  {
    qulonglong v = 0;
    *s >> v;
    return v;
  }

  static qlonglong f_QTextStream_read_ll(QTextStream *s)
  {
    qlonglong v = 0;
    *s >> v;
    return v;
  }

  static double f_QTextStream_read_double(QTextStream *s)
  {
    double v = 0;
    *s >> v;
    return v;
  }

  static float f_QTextStream_read_float(QTextStream *s)
  {
    float v = 0;
    *s >> v;
    return v;
  }

  static qt_gsi::Converter<QChar>::target_type f_QTextStream_read_qchar(QTextStream *s)
  {
    QChar v = QChar (0);
    *s >> v;
    return qt_gsi::Converter<QChar>::toc (v);
  }

  static QString f_QTextStream_read_string(QTextStream *s)
  {
    QString v;
    *s >> v;
    return v;
  }

  static qt_gsi::Converter<QByteArray>::target_type f_QTextStream_read_bytearray(QTextStream *s)
  {
    QByteArray v;
    *s >> v;
    return qt_gsi::Converter<QByteArray>::toc (v);
  }

  static QTextStream *f_QTextStream_put_s(QTextStream *s, short v)
  {
    *s << v;
    return s;
  }

  static QTextStream *f_QTextStream_put_us(QTextStream *s, unsigned short v)
  {
    *s << v;
    return s;
  }

  static QTextStream *f_QTextStream_put_i(QTextStream *s, int v)
  {
    *s << v;
    return s;
  }

  static QTextStream *f_QTextStream_put_ui(QTextStream *s, unsigned int v)
  {
    *s << v;
    return s;
  }

  static QTextStream *f_QTextStream_put_ll(QTextStream *s, qlonglong v)
  {
    *s << v;
    return s;
  }

  static QTextStream *f_QTextStream_put_ull(QTextStream *s, qulonglong v)
  {
    *s << v;
    return s;
  }

  static QTextStream *f_QTextStream_put_float(QTextStream *s, float v)
  {
    *s << v;
    return s;
  }

  static QTextStream *f_QTextStream_put_double(QTextStream *s, double v)
  {
    *s << v;
    return s;
  }

  static QTextStream *f_QTextStream_put_qchar(QTextStream *s, const qt_gsi::Converter<class QChar>::target_type v)
  {
    *s << qt_gsi::Converter<class QChar>::toq (v);
    return s;
  }

  static QTextStream *f_QTextStream_put_string(QTextStream *s, const QString &v)
  {
    *s << v;
    return s;
  }

  static QTextStream *f_QTextStream_put_bytearray(QTextStream *s, const qt_gsi::Converter<class QByteArray>::target_type &v)
  {
    *s << qt_gsi::Converter<class QByteArray>::toq (v);
    return s;
  }

CODE
  gsi::method_ext("read_s", &f_QTextStream_read_s, "@brief Non-ambiguous adaptation of the corresponding operator>>") +
  gsi::method_ext("read_us", &f_QTextStream_read_us, "@brief Non-ambiguous adaptation of the corresponding operator>>") +
  gsi::method_ext("read_i", &f_QTextStream_read_i, "@brief Non-ambiguous adaptation of the corresponding operator>>") +
  gsi::method_ext("read_ui", &f_QTextStream_read_ui, "@brief Non-ambiguous adaptation of the corresponding operator>>") +
  gsi::method_ext("read_ull", &f_QTextStream_read_ull, "@brief Non-ambiguous adaptation of the corresponding operator>>") +
  gsi::method_ext("read_ll", &f_QTextStream_read_ll, "@brief Non-ambiguous adaptation of the corresponding operator>>") +
  gsi::method_ext("read_d", &f_QTextStream_read_double, "@brief Non-ambiguous adaptation of the corresponding operator>>") +
  gsi::method_ext("read_f", &f_QTextStream_read_float, "@brief Non-ambiguous adaptation of the corresponding operator>>") +
  gsi::method_ext("read_qc", &f_QTextStream_read_qchar, "@brief Non-ambiguous adaptation of the corresponding operator>>") +
  gsi::method_ext("read_s", &f_QTextStream_read_string, "@brief Non-ambiguous adaptation of the corresponding operator>>") +
  gsi::method_ext("read_ba", &f_QTextStream_read_bytearray, "@brief Non-ambiguous adaptation of the corresponding operator>>") +
  gsi::method_ext("put_s", &f_QTextStream_put_s, "@brief Non-ambiguous adaptation of the corresponding operator<<") +
  gsi::method_ext("put_us", &f_QTextStream_put_us, "@brief Non-ambiguous adaptation of the corresponding operator<<") +
  gsi::method_ext("put_i", &f_QTextStream_put_i, "@brief Non-ambiguous adaptation of the corresponding operator<<") +
  gsi::method_ext("put_ui", &f_QTextStream_put_ui, "@brief Non-ambiguous adaptation of the corresponding operator<<") +
  gsi::method_ext("put_ull", &f_QTextStream_put_ull, "@brief Non-ambiguous adaptation of the corresponding operator<<") +
  gsi::method_ext("put_ll", &f_QTextStream_put_ll, "@brief Non-ambiguous adaptation of the corresponding operator<<") +
  gsi::method_ext("put_d", &f_QTextStream_put_double, "@brief Non-ambiguous adaptation of the corresponding operator<<") +
  gsi::method_ext("put_f", &f_QTextStream_put_float, "@brief Non-ambiguous adaptation of the corresponding operator<<") +
  gsi::method_ext("put_qc", &f_QTextStream_put_qchar, "@brief Non-ambiguous adaptation of the corresponding operator<<") +
  gsi::method_ext("put_s", &f_QTextStream_put_string, "@brief Non-ambiguous adaptation of the corresponding operator<<") +
  gsi::method_ext("put_ba", &f_QTextStream_put_bytearray, "@brief Non-ambiguous adaptation of the corresponding operator<<") 
DECL

end

# --------------------------------------------------------------
# enhance QPolygon by some missing methods because we dropped the base class and 
# support for db methods

# enhance QPolygon by some missing methods because we dropped the base class
def add_native_impl_polygons

  # enhance QPolygon by some missing methods because we dropped the base class
  add_native_impl("QPolygon", <<'CODE', <<'DECL')

#include "dbPolygon.h"

  static QPolygon *ctor_QPolygon_from_polygon (const db::Polygon &pts)
  {
    QPolygon *p = new QPolygon ();
    p->reserve (int (pts.hull ().size ()));
    for (db::Polygon::polygon_contour_iterator q = pts.begin_hull (); q != pts.end_hull (); ++q) {
      p->push_back (QPoint ((*q).x (), (*q).y ()));
    }
    return p;
  }

  static QPolygon *ctor_QPolygon_from_simple_polygon (const db::SimplePolygon &pts)
  {
    QPolygon *p = new QPolygon ();
    p->reserve (int (pts.hull ().size ()));
    for (db::SimplePolygon::polygon_contour_iterator q = pts.begin_hull (); q != pts.end_hull (); ++q) {
      p->push_back (QPoint ((*q).x (), (*q).y ()));
    }
    return p;
  }

  static QPolygon::const_iterator f_QPolygon_each_begin (const QPolygon *m)
  {
    return m->begin ();
  }

  static QPolygon::const_iterator f_QPolygon_each_end (const QPolygon *m)
  {
    return m->end ();
  }

  static QPoint f_QPolygon_at (const QPolygon *m, int i)
  {
    return m->at(i);
  }

  static QPoint f_QPolygon_front (const QPolygon *m)
  {
    return m->front();
  }

  static QPoint f_QPolygon_back (const QPolygon *m)
  {
    return m->back();
  }

  static int f_QPolygon_size (const QPolygon *m)
  {
    return m->size();
  }

  static void f_QPolygon_clear (QPolygon *m)
  {
    m->clear();
  }

  static void f_QPolygon_remove (QPolygon *m, int i)
  {
    m->remove (i);
  }

  static void f_QPolygon_insert (QPolygon *m, int i, const QPoint &p)
  {
    m->insert (i, p);
  }

  static void f_QPolygon_replace (QPolygon *m, int i, const QPoint &p)
  {
    m->replace (i, p);
  }

  static void f_QPolygon_pop_front (QPolygon *m)
  {
    m->pop_front ();
  }

  static void f_QPolygon_pop_back (QPolygon *m)
  {
    m->pop_back ();
  }

  static void f_QPolygon_push_front (QPolygon *m, const QPoint &p)
  {
    m->push_front (p);
  }

  static void f_QPolygon_push_back (QPolygon *m, const QPoint &p)
  {
    m->push_back (p);
  }

  static void f_QPolygon_reserve (QPolygon *m, int n)
  {
    m->reserve (n);
  }

  static void f_QPolygon_resize (QPolygon *m, int n)
  {
    m->resize (n);
  }

  static void f_QPolygon_fill (QPolygon *m, const QPoint &p, int n)
  {
    m->fill (p, n);
  }
CODE
  gsi::constructor("new", &ctor_QPolygon_from_polygon, gsi::arg ("p"), "@brief Creates a polygon from the given KLayout Polygon\nRemark: holes are not transferred into the QPolygon.") +
  gsi::constructor("new", &ctor_QPolygon_from_simple_polygon, gsi::arg ("p"), "@brief Creates a polygon from the given KLayout SimplePolygon") +
  gsi::iterator_ext ("each", &f_QPolygon_each_begin, &f_QPolygon_each_end, "@brief Iterates over all points of the polygon.") +
  gsi::method_ext("[]", &f_QPolygon_at, gsi::arg ("index"), "@brief Gets the point at the given position") +
  gsi::method_ext("front", &f_QPolygon_front, "@brief Gets the first point") +
  gsi::method_ext("back", &f_QPolygon_back, "@brief Gets the last point") +
  gsi::method_ext("size", &f_QPolygon_size, "@brief Gets the number of points in the polygon") +
  gsi::method_ext("clear", &f_QPolygon_clear, "@brief Empties the polygon") +
  gsi::method_ext("remove", &f_QPolygon_remove, gsi::arg ("index"), "@brief Removes the point at the given position") +
  gsi::method_ext("insert", &f_QPolygon_insert, gsi::arg ("p"), gsi::arg ("p"), "@brief Inserts the point after the given position") +
  gsi::method_ext("replace", &f_QPolygon_replace, gsi::arg ("p"), gsi::arg ("p"), "@brief Replaces the point at the given position") +
  gsi::method_ext("pop_front", &f_QPolygon_pop_front, "@brief Removes the point at the beginning of the list") +
  gsi::method_ext("pop_back", &f_QPolygon_pop_back, "@brief Removes the point at the end of the list") +
  gsi::method_ext("push_front", &f_QPolygon_push_front, gsi::arg ("p"), "@brief Inserts the point at the beginning of the list") +
  gsi::method_ext("push_back", &f_QPolygon_push_back, gsi::arg ("p"), "@brief Inserts the point at the end of the list") +
  gsi::method_ext("reserve", &f_QPolygon_reserve, gsi::arg ("n"), "@brief Reserve memory for the given number of points") +
  gsi::method_ext("resize", &f_QPolygon_resize, gsi::arg ("l"), "@brief Sets the number of points to the given length") +
  gsi::method_ext("fill", &f_QPolygon_fill, gsi::arg ("p"), gsi::arg ("l"), "@brief Resizes the polygon to l points and sets all elements to the given point") 
DECL

  # enhance QPolygonF by some missing methods because we dropped the base class
  add_native_impl("QPolygonF", <<'CODE', <<'DECL')

#include "dbPolygon.h"

  static QPolygonF *ctor_QPolygonF_from_polygon (const db::DPolygon &pts)
  {
    QPolygonF *p = new QPolygonF ();
    p->reserve (int (pts.hull ().size ()));
    for (db::DPolygon::polygon_contour_iterator q = pts.begin_hull (); q != pts.end_hull (); ++q) {
      p->push_back (QPointF ((*q).x (), (*q).y ()));
    }
    return p;
  }

  static QPolygonF *ctor_QPolygonF_from_simple_polygon (const db::DSimplePolygon &pts)
  {
    QPolygonF *p = new QPolygonF ();
    p->reserve (int (pts.hull ().size ()));
    for (db::DSimplePolygon::polygon_contour_iterator q = pts.begin_hull (); q != pts.end_hull (); ++q) {
      p->push_back (QPointF ((*q).x (), (*q).y ()));
    }
    return p;
  }

  static QPolygonF::const_iterator f_QPolygonF_each_begin (const QPolygonF *m)
  {
    return m->begin ();
  }

  static QPolygonF::const_iterator f_QPolygonF_each_end (const QPolygonF *m)
  {
    return m->end ();
  }

  static QPointF f_QPolygonF_at (const QPolygonF *m, int i)
  {
    return m->at(i);
  }

  static QPointF f_QPolygonF_front (const QPolygonF *m)
  {
    return m->front();
  }

  static QPointF f_QPolygonF_back (const QPolygonF *m)
  {
    return m->back();
  }

  static int f_QPolygonF_size (const QPolygonF *m)
  {
    return m->size();
  }

  static void f_QPolygonF_clear (QPolygonF *m)
  {
    m->clear();
  }

  static void f_QPolygonF_remove (QPolygonF *m, int i)
  {
    m->remove (i);
  }

  static void f_QPolygonF_insert (QPolygonF *m, int i, const QPointF &p)
  {
    m->insert (i, p);
  }

  static void f_QPolygonF_replace (QPolygonF *m, int i, const QPointF &p)
  {
    m->replace (i, p);
  }

  static void f_QPolygonF_pop_front (QPolygonF *m)
  {
    m->pop_front ();
  }

  static void f_QPolygonF_pop_back (QPolygonF *m)
  {
    m->pop_back ();
  }

  static void f_QPolygonF_push_front (QPolygonF *m, const QPointF &p)
  {
    m->push_front (p);
  }

  static void f_QPolygonF_push_back (QPolygonF *m, const QPointF &p)
  {
    m->push_back (p);
  }

  static void f_QPolygonF_reserve (QPolygonF *m, int n)
  {
    m->reserve (n);
  }

  static void f_QPolygonF_resize (QPolygonF *m, int n)
  {
    m->resize (n);
  }

  static void f_QPolygonF_fill (QPolygonF *m, const QPointF &p, int n)
  {
    m->fill (p, n);
  }
CODE
  gsi::constructor("new", &ctor_QPolygonF_from_polygon, gsi::arg ("p"), "@brief Creates a polygon from the given KLayout DPolygon\nRemark: holes are not transferred into the QPolygonF.") +
  gsi::constructor("new", &ctor_QPolygonF_from_simple_polygon, gsi::arg ("p"), "@brief Creates a polygon from the given KLayout DSimplePolygon") +
  gsi::iterator_ext ("each", &f_QPolygonF_each_begin, &f_QPolygonF_each_end, "@brief Iterates over all points of the polygon.") +
  gsi::method_ext("[]", &f_QPolygonF_at, gsi::arg ("index"), "@brief Gets the point at the given position") +
  gsi::method_ext("front", &f_QPolygonF_front, "@brief Gets the first point") +
  gsi::method_ext("back", &f_QPolygonF_back, "@brief Gets the last point") +
  gsi::method_ext("size", &f_QPolygonF_size, "@brief Gets the number of points in the polygon") +
  gsi::method_ext("clear", &f_QPolygonF_clear, "@brief Empties the polygon") +
  gsi::method_ext("remove", &f_QPolygonF_remove, gsi::arg ("index"), "@brief Removes the point at the given position") +
  gsi::method_ext("insert", &f_QPolygonF_insert, gsi::arg ("index"), gsi::arg ("p"), "@brief Inserts the point after the given position") +
  gsi::method_ext("replace", &f_QPolygonF_replace, gsi::arg ("index"), gsi::arg ("p"), "@brief Replaces the point at the given position") +
  gsi::method_ext("pop_front", &f_QPolygonF_pop_front, "@brief Removes the point at the beginning of the list") +
  gsi::method_ext("pop_back", &f_QPolygonF_pop_back, "@brief Removes the point at the end of the list") +
  gsi::method_ext("push_front", &f_QPolygonF_push_front, gsi::arg ("p"), "@brief Inserts the point at the beginning of the list") +
  gsi::method_ext("push_back", &f_QPolygonF_push_back, gsi::arg ("p"), "@brief Inserts the point at the end of the list") +
  gsi::method_ext("reserve", &f_QPolygonF_reserve, gsi::arg ("n"), "@brief Reserve memory for the given number of points") +
  gsi::method_ext("resize", &f_QPolygonF_resize, gsi::arg ("l"), "@brief Sets the number of points to the given length") +
  gsi::method_ext("fill", &f_QPolygonF_fill, gsi::arg ("p"), gsi::arg ("l"), "@brief Resizes the polygon to l points and sets all elements to the given point") 
DECL

end