Remove wrapper for classes: QString, QStringRef, QLatin1String, QStringMatcher, QChar and QLatin1Char.

This commit is contained in:
Hugo Parente Lima 2010-06-03 15:34:17 -03:00
commit e39bfefde9
32 changed files with 187 additions and 1189 deletions

View file

@ -1,43 +0,0 @@
#if PY_VERSION_HEX < 0x03000000
// QByteArray buffer protocol functions
// see: http://www.python.org/dev/peps/pep-3118/
extern "C" {
static Py_ssize_t SbkQString_segcountproc(PyObject* self, Py_ssize_t* lenp)
{
if (lenp)
*lenp = self->ob_type->tp_as_sequence->sq_length(self);
return 1;
}
static Py_ssize_t SbkQString_readbufferproc(PyObject* self, Py_ssize_t segment, char** ptrptr)
{
if (segment || Shiboken::cppObjectIsInvalid(self))
return -1;
QString* cppSelf = Converter<QString*>::toCpp(self);
QByteArray decodedData = cppSelf->toLocal8Bit();
Shiboken::AutoDecRef decodedString(PyString_FromStringAndSize(decodedData.constData(), decodedData.size()));
// delete __encodedStr attr if it exists
Shiboken::AutoDecRef attrName(PyString_FromStringAndSize("__encodedStr", sizeof("__encodedStr")-1));
if (PyObject_HasAttr(self, attrName))
PyObject_DelAttr(self, attrName);
PyObject_SetAttr(self, attrName, decodedString);
*ptrptr = PyString_AS_STRING(decodedString.object());
return decodedData.size();
}
PyBufferProcs SbkQStringBufferProc = {
/*bf_getreadbuffer*/ 0,
/*bf_getwritebuffer*/ 0,
/*bf_getsegcount*/ &SbkQString_segcountproc,
/*bf_getcharbuffer*/ &SbkQString_readbufferproc
};
}
#endif

View file

@ -1,6 +0,0 @@
static long QStringCustomHashFunction(const QString& str)
{
QByteArray data = str.toUtf8();
Shiboken::AutoDecRef unicodeObj(PyUnicode_DecodeUTF8(data.constData(), data.length(), 0));
return unicodeObj->ob_type->tp_hash(unicodeObj);
}