File: qchar.sip

package info (click to toggle)
python-qt4 4.11.4%2Bdfsg-2
  • links: PTS, VCS
  • area: main
  • in suites: stretch
  • size: 40,148 kB
  • ctags: 6,150
  • sloc: python: 125,936; cpp: 12,628; xml: 292; makefile: 259; php: 27; sh: 2
file content (520 lines) | stat: -rw-r--r-- 11,518 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
// qchar.sip generated by MetaSIP
//
// This file is part of the QtCore Python extension module.
//
// Copyright (c) 2015 Riverbank Computing Limited <info@riverbankcomputing.com>
// 
// This file is part of PyQt4.
// 
// This file may be used under the terms of the GNU General Public License
// version 3.0 as published by the Free Software Foundation and appearing in
// the file LICENSE included in the packaging of this file.  Please review the
// following information to ensure the GNU General Public License version 3.0
// requirements will be met: http://www.gnu.org/copyleft/gpl.html.
// 
// If you do not wish to use this file under the terms of the GPL version 3.0
// then you may purchase a commercial license.  For more information contact
// info@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 <qchar.h>
%End

struct QLatin1Char /API=QString: - 2/
{
%TypeHeaderCode
#include <qchar.h>
%End

%PickleCode
    char ch = sipCpp->toLatin1();
    
    sipRes = Py_BuildValue((char *)"(s#)", &ch, 1);
%End

    explicit QLatin1Char(char c /Encoding="Latin-1"/);
    SIP_PYOBJECT __repr__() const /DocType="str"/;
%MethodCode
        char ch = sipCpp->toLatin1();
        PyObject *str = SIPBytes_FromStringAndSize(&ch, 1);
        
        if (str)
        {
        #if PY_MAJOR_VERSION >= 3
            sipRes = PyUnicode_FromFormat("PyQt4.QtCore.QLatin1Char(%R)", str);
        #else
            sipRes = PyString_FromString("PyQt4.QtCore.QLatin1Char(");
            PyString_ConcatAndDel(&sipRes, PyObject_Repr(str));
            PyString_ConcatAndDel(&sipRes, PyString_FromString(")"));
        #endif
        
            Py_DECREF(str);
        }
%End

    char toLatin1() const /Encoding="None"/;
    ushort unicode() const;
};

// class QChar /API=QString:2 - ,DocType="str"/
%MappedType QChar /API=QString:2 -,DocType="str"/
{
%TypeHeaderCode
#include <qchar.h>
%End

%ConvertToTypeCode
if (sipIsErr == NULL)
#if PY_MAJOR_VERSION < 3
    return (PyString_Check(sipPy) || PyUnicode_Check(sipPy));
#else
    return PyUnicode_Check(sipPy);
#endif

#if PY_MAJOR_VERSION < 3
if (PyString_Check(sipPy))
{
    if (PyString_GET_SIZE(sipPy) != 1)
    {
        PyErr_SetString(PyExc_ValueError, "string of length 1 expected");
        *sipIsErr = 1;
        return 0;
    }

    *sipCppPtr = new QChar(*PyString_AS_STRING(sipPy));

    return sipGetState(sipTransferObj);
}
#endif

QString qs = qpycore_PyObject_AsQString(sipPy);

if (qs.size() != 1)
{
    PyErr_SetString(PyExc_ValueError, "string of length 1 expected");
    *sipIsErr = 1;
    return 0;
}

*sipCppPtr = new QChar(qs.at(0));

return sipGetState(sipTransferObj);
%End

%ConvertFromTypeCode
    return qpycore_PyObject_FromQString(QString(*sipCpp));
%End
};

class QChar /API=QString: - 2/
{
%TypeHeaderCode
#include <qchar.h>
%End

%TypeCode
// This is needed by __hash__().
#include <qhash.h>
%End

%PickleCode
    sipRes = Py_BuildValue((char *)"(H)", sipCpp->unicode());
%End

public:
    QChar();
%If (Qt_5_0_0 -)
    explicit QChar(char c /Encoding="Latin-1"/);
%End
%If (- Qt_5_0_0)
    QChar(char c /Encoding="Latin-1"/);
%End
    QChar(QLatin1Char ch);
    QChar(uchar c, uchar r);
    QChar(int rc);
    QChar(QChar::SpecialCharacter s /Constrained/);
    SIP_PYOBJECT __repr__() const /DocType="str"/;
%MethodCode
        sipRes =
        #if PY_MAJOR_VERSION >= 3
            PyUnicode_FromFormat
        #else
            PyString_FromFormat
        #endif
                ("PyQt4.QtCore.QChar(0x%04x)", sipCpp->unicode());
%End

    SIP_PYOBJECT __str__() const /DocType="str"/;
%MethodCode
        sipRes = qpycore_PyObject_FromQString(QString(*sipCpp));
%End

    long __hash__() const;
%MethodCode
        sipRes = qHash(*sipCpp);
%End

    enum SpecialCharacter
    {
        Null,
        Nbsp,
        ReplacementCharacter,
        ObjectReplacementCharacter,
        ByteOrderMark,
        ByteOrderSwapped,
        ParagraphSeparator,
        LineSeparator,
%If (Qt_5_0_0 -)
        Tabulation,
%End
%If (Qt_5_0_0 -)
        LineFeed,
%End
%If (Qt_5_0_0 -)
        CarriageReturn,
%End
%If (Qt_5_0_0 -)
        Space,
%End
%If (Qt_5_0_0 -)
        SoftHyphen,
%End
%If (Qt_5_0_0 -)
        LastValidCodePoint,
%End
    };

    enum Category
    {
%If (- Qt_5_0_0)
        NoCategory,
%End
        Mark_NonSpacing,
        Mark_SpacingCombining,
        Mark_Enclosing,
        Number_DecimalDigit,
        Number_Letter,
        Number_Other,
        Separator_Space,
        Separator_Line,
        Separator_Paragraph,
        Other_Control,
        Other_Format,
        Other_Surrogate,
        Other_PrivateUse,
        Other_NotAssigned,
        Letter_Uppercase,
        Letter_Lowercase,
        Letter_Titlecase,
        Letter_Modifier,
        Letter_Other,
        Punctuation_Connector,
        Punctuation_Dash,
%If (- Qt_5_0_0)
        Punctuation_Dask,
%End
        Punctuation_Open,
        Punctuation_Close,
        Punctuation_InitialQuote,
        Punctuation_FinalQuote,
        Punctuation_Other,
        Symbol_Math,
        Symbol_Currency,
        Symbol_Modifier,
        Symbol_Other,
    };

    enum Direction
    {
        DirL,
        DirR,
        DirEN,
        DirES,
        DirET,
        DirAN,
        DirCS,
        DirB,
        DirS,
        DirWS,
        DirON,
        DirLRE,
        DirLRO,
        DirAL,
        DirRLE,
        DirRLO,
        DirPDF,
        DirNSM,
        DirBN,
    };

    enum Decomposition
    {
        NoDecomposition,
        Canonical,
        Font,
        NoBreak,
        Initial,
        Medial,
        Final,
        Isolated,
        Circle,
        Super,
        Sub,
        Vertical,
        Wide,
        Narrow,
        Small,
        Square,
        Compat,
        Fraction,
    };

    enum Joining
    {
        OtherJoining,
        Dual,
        Right,
        Center,
    };

    enum CombiningClass
    {
        Combining_BelowLeftAttached,
        Combining_BelowAttached,
        Combining_BelowRightAttached,
        Combining_LeftAttached,
        Combining_RightAttached,
        Combining_AboveLeftAttached,
        Combining_AboveAttached,
        Combining_AboveRightAttached,
        Combining_BelowLeft,
        Combining_Below,
        Combining_BelowRight,
        Combining_Left,
        Combining_Right,
        Combining_AboveLeft,
        Combining_Above,
        Combining_AboveRight,
        Combining_DoubleBelow,
        Combining_DoubleAbove,
        Combining_IotaSubscript,
    };

    enum UnicodeVersion
    {
        Unicode_Unassigned,
        Unicode_1_1,
        Unicode_2_0,
        Unicode_2_1_2,
        Unicode_3_0,
        Unicode_3_1,
        Unicode_3_2,
        Unicode_4_0,
%If (Qt_4_3_0 -)
        Unicode_4_1,
%End
%If (Qt_4_3_0 -)
        Unicode_5_0,
%End
%If (Qt_5_0_0 -)
        Unicode_5_1,
%End
%If (Qt_5_0_0 -)
        Unicode_5_2,
%End
%If (Qt_5_0_0 -)
        Unicode_6_0,
%End
%If (Qt_5_0_0 -)
        Unicode_6_1,
%End
%If (Qt_5_0_0 -)
        Unicode_6_2,
%End
    };

    int digitValue() const;
    QChar toLower() const;
    QChar toUpper() const;
    QChar::Category category() const;
    QChar::Direction direction() const;
    QChar::Joining joining() const;
    bool hasMirrored() const;
    bool isLower() const;
    bool isUpper() const;
    QChar mirroredChar() const;
    QString decomposition() const;
    QChar::Decomposition decompositionTag() const;
    unsigned char combiningClass() const;
    QChar::UnicodeVersion unicodeVersion() const;
%If (PyQt_Deprecated_5_0)
    char toAscii() const /Encoding="None"/;
%End
    ushort unicode() const;
%If (PyQt_Deprecated_5_0)
    static QChar fromAscii(char c /Encoding="ASCII"/);
%End
    bool isNull() const;
    bool isPrint() const;
    bool isPunct() const;
    bool isSpace() const;
    bool isMark() const;
    bool isLetter() const;
    bool isNumber() const;
    bool isLetterOrNumber() const;
    bool isDigit() const;
    bool isSymbol() const;
    uchar cell() const;
    uchar row() const;
    char toLatin1() const /Encoding="None"/;
    static QChar fromLatin1(char c /Encoding="Latin-1"/);
    void setCell(uchar acell);
    void setRow(uchar arow);
%If (Qt_4_3_0 -)
    QChar toTitleCase() const;
%End
%If (Qt_4_3_0 -)
    QChar toCaseFolded() const;
%End
%If (Qt_4_3_0 -)
    bool isTitleCase() const;
%End
%If (Qt_4_3_0 -)
    bool isHighSurrogate() const;
%End
%If (Qt_4_3_0 -)
    bool isLowSurrogate() const;
%End
%If (Qt_4_3_0 -)
    static uint surrogateToUcs4(ushort high, ushort low);
%End
%If (Qt_4_3_0 -)
    static uint surrogateToUcs4(QChar high, QChar low);
%End
%If (Qt_4_3_0 -)
    static ushort highSurrogate(uint ucs4);
%End
%If (Qt_4_3_0 -)
    static ushort lowSurrogate(uint ucs4);
%End
%If (Qt_4_3_0 -)
    static QChar::Category category(uint ucs4);
%End
%If (Qt_4_3_0 -)
    static QChar::Direction direction(uint ucs4);
%End
%If (Qt_4_3_0 -)
    static QChar::Joining joining(uint ucs4);
%End
%If (Qt_4_3_0 -)
    static unsigned char combiningClass(uint ucs4);
%End
%If (Qt_4_3_0 -)
    static uint mirroredChar(uint ucs4);
%End
%If (Qt_4_3_0 -)
    static QChar::Decomposition decompositionTag(uint ucs4);
%End
%If (Qt_4_3_0 -)
    static int digitValue(uint ucs4);
%End
%If (Qt_4_3_0 -)
    static uint toLower(uint ucs4);
%End
%If (Qt_4_3_0 -)
    static uint toUpper(uint ucs4);
%End
%If (Qt_4_3_0 -)
    static uint toTitleCase(uint ucs4);
%End
%If (Qt_4_3_0 -)
    static uint toCaseFolded(uint ucs4);
%End
%If (Qt_4_3_0 -)
    static QChar::UnicodeVersion unicodeVersion(uint ucs4);
%End
%If (Qt_4_3_0 -)
    static QString decomposition(uint ucs4);
%End
%If (Qt_4_7_0 -)
    static bool isHighSurrogate(uint ucs4);
%End
%If (Qt_4_7_0 -)
    static bool isLowSurrogate(uint ucs4);
%End
%If (Qt_4_7_0 -)
    static bool requiresSurrogates(uint ucs4);
%End
%If (Qt_4_8_0 -)
    static QChar::UnicodeVersion currentUnicodeVersion();
%End
%If (Qt_5_0_0 -)
    bool isNonCharacter() const;
%End
%If (Qt_5_0_0 -)
    bool isSurrogate() const;
%End
%If (Qt_5_0_0 -)
    static bool isNonCharacter(uint ucs4);
%End
%If (Qt_5_0_0 -)
    static bool isSurrogate(uint ucs4);
%End
%If (Qt_5_0_0 -)
    static bool hasMirrored(uint ucs4);
%End
%If (Qt_5_0_0 -)
    static bool isPrint(uint ucs4);
%End
%If (Qt_5_0_0 -)
    static bool isMark(uint ucs4);
%End
%If (Qt_5_0_0 -)
    static bool isPunct(uint ucs4);
%End
%If (Qt_5_0_0 -)
    static bool isSymbol(uint ucs4);
%End
%If (Qt_5_0_0 -)
    static bool isSpace(uint ucs4);
%End
%If (Qt_5_0_0 -)
    static bool isLetter(uint ucs4);
%End
%If (Qt_5_0_0 -)
    static bool isNumber(uint ucs4);
%End
%If (Qt_5_0_0 -)
    static bool isLetterOrNumber(uint ucs4);
%End
%If (Qt_5_0_0 -)
    static bool isDigit(uint ucs4);
%End
%If (Qt_5_0_0 -)
    static bool isLower(uint ucs4);
%End
%If (Qt_5_0_0 -)
    static bool isUpper(uint ucs4);
%End
%If (Qt_5_0_0 -)
    static bool isTitleCase(uint ucs4);
%End
};

bool operator==(QChar c1, QChar c2);
bool operator!=(QChar c1, QChar c2);
bool operator<=(QChar c1, QChar c2);
bool operator>=(QChar c1, QChar c2);
bool operator<(QChar c1, QChar c2);
bool operator>(QChar c1, QChar c2);
%If (Qt_5_0_0 -)
QDataStream &operator<<(QDataStream &, QChar /Constrained/);
%End
%If (- Qt_5_0_0)
QDataStream &operator<<(QDataStream &, const QChar & /Constrained/);
%End
QDataStream &operator>>(QDataStream &, QChar & /Constrained/);