~ubuntu-branches/ubuntu/utopic/pyside/utopic

« back to all changes in this revision

Viewing changes to PySide/QtCore/qbytearray_conversions.h

  • Committer: Bazaar Package Importer
  • Author(s): Didier Raboud
  • Date: 2011-02-18 18:01:00 UTC
  • mfrom: (1.2.3 upstream) (6.1.6 experimental)
  • Revision ID: james.westby@ubuntu.com-20110218180100-vaczjij7g08fzfme
Tags: 1.0.0~rc1-1
* New 1.0.0~rc1 upstream release
  - Bump the B-D chain versions:
    + apiextractor to 0.10.0-2~
    + generatorrunner to 0.6.6
    + shiboken to 1.0.0~rc1
* Update patches to ~rc1.
* debian/watch: update to handle Release Candidates too.
* Bump XS-Python-Version to >= 2.6.

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
namespace Shiboken {
 
2
 
 
3
inline bool Converter<QByteArray>::checkType(PyObject* pyObj)
 
4
{
 
5
    return ValueTypeConverter<QByteArray>::checkType(pyObj);
 
6
}
 
7
 
 
8
inline bool Converter<QByteArray>::isConvertible(PyObject* pyObj)
 
9
{
 
10
    if (ValueTypeConverter<QByteArray>::isConvertible(pyObj))
 
11
        return true;
 
12
    SbkObjectType* shiboType = reinterpret_cast<SbkObjectType*>(SbkType< ::QByteArray >());
 
13
    return Shiboken::Converter<const char *>::checkType(pyObj)
 
14
        || (ObjectType::isExternalConvertible(shiboType, pyObj));
 
15
}
 
16
 
 
17
inline QByteArray Converter<QByteArray>::toCpp(PyObject* pyObj)
 
18
{
 
19
    if (pyObj == Py_None)
 
20
        return 0;
 
21
    else if (PyObject_TypeCheck(pyObj, SbkType<QByteArray>()))
 
22
        return *Converter<QByteArray*>::toCpp(pyObj);
 
23
    else if (PyString_Check(pyObj))
 
24
        return QByteArray(PyString_AS_STRING(pyObj), PyString_GET_SIZE(pyObj));
 
25
    else
 
26
        return ValueTypeConverter<QByteArray>::toCpp(pyObj);
 
27
}
 
28
 
 
29
inline PyObject* Converter<QByteArray>::toPython(const ::QByteArray& cppObj)
 
30
{
 
31
    return ValueTypeConverter<QByteArray>::toPython(cppObj);
 
32
}
 
33
 
 
34
}