Split up in qt.core.
Annotate for file src/lib/qstringlist.cpp
2010-01-10 tobias 1 #include "cl_smoke_qt.h"
08:52:09 ' 2
2009-04-05 tobias 3 #include <QStringList>
17:56:16 ' 4 #include <QtDebug>
2009-05-11 tobias 5
2009-04-05 tobias 6 /** @file
17:56:16 ' 7 * @brief QStringList conversion. */
' 8
' 9 extern "C" {
' 10
' 11 /** Returns the number of items of @a string_list.
' 12 * @param string_list the QStringList
' 13 *
' 14 * @return the number of items
' 15 */
2009-05-11 tobias 16 CL_SMOKE_QT_EXPORT int
2010-01-10 tobias 17 cl_smoke_string_list_size(const void* string_list)
2009-04-05 tobias 18 {
17:56:16 ' 19 Q_ASSERT(string_list);
' 20 return static_cast<const QStringList*>(string_list)->size();
' 21 }
' 22
' 23 /** Returns the byte array of @a string_list at position @a index.
' 24 * @param string_list the QStringList
' 25 * @param index the index of the string
' 26 *
' 27 * @return a new allocated byte-array
' 28 */
2009-05-11 tobias 29 CL_SMOKE_QT_EXPORT void*
2010-01-10 tobias 30 cl_smoke_string_list_at(const void* string_list, int index)
2009-04-05 tobias 31 {
17:56:16 ' 32 Q_ASSERT(string_list);
' 33 const QStringList* list = static_cast<const QStringList*>(string_list);
' 34
' 35 Q_ASSERT(0 <= index && index < list->size());
' 36
' 37 return new QByteArray(list->at(index).toLocal8Bit());
' 38 }
' 39
' 40 /** Free a QStringList.
' 41 * @param string_list the QStringList to free
' 42 */
2009-05-11 tobias 43 CL_SMOKE_QT_EXPORT void
2010-01-10 tobias 44 cl_smoke_free_string_list(void* string_list)
2009-04-05 tobias 45 {
17:56:16 ' 46 delete static_cast<QStringList*>(string_list);
' 47 }
' 48
' 49 /** Allocates a new QStringList.
' 50 *
' 51 * @return a new QStringList
' 52 */
2009-05-11 tobias 53 CL_SMOKE_QT_EXPORT void*
2010-01-10 tobias 54 cl_smoke_make_string_list()
2009-04-05 tobias 55 {
17:56:16 ' 56 return new QStringList();
' 57 }
' 58
' 59 /** Appends @a string to @a string_list
' 60 * @param string_list the QStringList
' 61 * @param data the string
' 62 * @param length the length of @a data
' 63 */
2009-05-11 tobias 64 CL_SMOKE_QT_EXPORT void
2010-01-10 tobias 65 cl_smoke_string_list_append(void* string_list, const char* data, int length)
2009-04-05 tobias 66 {
17:56:16 ' 67 static_cast<QStringList*>(string_list)->append(QString::fromLocal8Bit(data, length));
' 68 }
' 69
' 70 } // extern "C"