Split up in qt.core.
Annotate for file src/lib/qstring.cpp
2009-04-05 tobias 1 #include <QString>
17:56:16 ' 2
2009-05-11 tobias 3 #include "cl_smoke_qt.h"
12:07:17 ' 4
2009-04-05 tobias 5 /** @file
17:56:16 ' 6 * @brief QString conversion. */
' 7
' 8 extern "C" {
' 9
' 10 /** Converts a QString to a QByteArray.
' 11 * @param qstring Pointer to a QString
' 12 *
' 13 * @return a pointer to a newly allocated char array.
' 14 */
2009-05-11 tobias 15 CL_SMOKE_QT_EXPORT void*
2010-01-10 tobias 16 cl_smoke_qstring_to_byte_array(const void* qstring)
2009-04-05 tobias 17 {
17:56:16 ' 18 const QString* string = static_cast<const QString*>(qstring);
' 19
' 20 return new QByteArray(string->toLocal8Bit());
' 21 }
' 22
' 23 /** Frees an QString.
' 24 * @param qstring the QString to free
' 25 */
2009-05-11 tobias 26 CL_SMOKE_QT_EXPORT void
2010-01-10 tobias 27 cl_smoke_free_qstring(void* qstring)
2009-04-05 tobias 28 {
17:56:16 ' 29 delete static_cast<QString*>(qstring);
' 30 }
' 31
' 32 /** Converts a string to a QString.
' 33 * @param data a char array
' 34 * @param length the length of @a data
' 35 *
' 36 * @return a newly allocated QString
' 37 */
2009-05-11 tobias 38 CL_SMOKE_QT_EXPORT void*
2010-01-10 tobias 39 cl_smoke_string_to_qstring(const char* data, int length)
2009-04-05 tobias 40 {
17:56:16 ' 41 return new QString(QString::fromLocal8Bit(data, length));
' 42 }
' 43
' 44 } // extern "C"