aboutsummaryrefslogtreecommitdiffstats
path: root/PySide/QtCore/qstring_conversions.h
diff options
context:
space:
mode:
Diffstat (limited to 'PySide/QtCore/qstring_conversions.h')
-rw-r--r--PySide/QtCore/qstring_conversions.h49
1 files changed, 0 insertions, 49 deletions
diff --git a/PySide/QtCore/qstring_conversions.h b/PySide/QtCore/qstring_conversions.h
deleted file mode 100644
index 33c393b1f..000000000
--- a/PySide/QtCore/qstring_conversions.h
+++ /dev/null
@@ -1,49 +0,0 @@
-namespace Shiboken {
-
-template<>
-inline PyTypeObject* SbkType<QString>()
-{
- return &PyUnicode_Type;
-}
-
-template<>
-struct Converter<QString>
-{
- static bool checkType(PyObject* pyObj)
- {
- return Shiboken::String::check(pyObj);
- }
-
- static bool isConvertible(PyObject* pyObj)
- {
- return Shiboken::String::isConvertible(pyObj);
- }
-
- static QString toCpp(PyObject* pyObj)
- {
- if (PyUnicode_Check(pyObj)) {
- Py_UNICODE* unicode = PyUnicode_AS_UNICODE(pyObj);
- #if defined(Py_UNICODE_WIDE) || defined(__CYGWIN__)
- // cast as Py_UNICODE can be a different type
- return QString::fromUcs4(reinterpret_cast<const uint*>(unicode));
- #else
- return QString::fromUtf16(unicode, PyUnicode_GET_SIZE(pyObj));
- #endif
- } else if (Shiboken::String::check(pyObj)) {
- return QString(Shiboken::String::toCString(pyObj));
- }
- return QString();
- }
-
- static PyObject* toPython(void* cppObj) { return toPython(*reinterpret_cast<QString*>(cppObj)); }
- static PyObject* toPython(const QString& cppObj)
- {
- const int N = cppObj.length();
- wchar_t* str = new wchar_t[N];
- cppObj.toWCharArray(str);
- PyObject* pyObj = PyUnicode_FromWideChar(str, N);
- delete[] str;
- return pyObj;
- }
-};
-}