// qchar.sip generated by MetaSIP on Sun Apr 21 13:02:15 2013
//
// This file is part of the QtCore Python extension module.
//
// Copyright (c) 2013 Riverbank Computing Limited <info@riverbankcomputing.com>
// 
// This file is part of PyQt.
// 
// This file may be used under the terms of the GNU General Public
// License versions 2.0 or 3.0 as published by the Free Software
// Foundation and appearing in the files LICENSE.GPL2 and LICENSE.GPL3
// included in the packaging of this file.  Alternatively you may (at
// your option) use any later version of the GNU General Public
// License if such license has been publicly approved by Riverbank
// Computing Limited (or its successors, if any) and the KDE Free Qt
// Foundation. In addition, as a special exception, Riverbank gives you
// certain additional rights. These rights are described in the Riverbank
// GPL Exception version 1.1, which can be found in the file
// GPL_EXCEPTION.txt in this package.
// 
// If you are unsure which license is appropriate for your use, please
// contact the sales department at sales@riverbankcomputing.com.
// 
// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.


%ModuleCode
#include <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

%If (!Py_v3)
    SIP_PYOBJECT __unicode__() const /DocType="unicode"/;
%MethodCode
        sipRes = qpycore_PyObject_FromQString(QString(*sipCpp));
%End

%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/);
