1 #include "cl_smoke_qt.h"
7 * @brief QStringList conversion. */
11 /** Returns the number of items of @a string_list.
12 * @param string_list the QStringList
14 * @return the number of items
16 CL_SMOKE_QT_EXPORT int
17 cl_smoke_string_list_size(const void* string_list)
19 Q_ASSERT(string_list);
20 return static_cast<const QStringList*>(string_list)->size();
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
27 * @return a new allocated byte-array
29 CL_SMOKE_QT_EXPORT void*
30 cl_smoke_string_list_at(const void* string_list, int index)
32 Q_ASSERT(string_list);
33 const QStringList* list = static_cast<const QStringList*>(string_list);
35 Q_ASSERT(0 <= index && index < list->size());
37 return new QByteArray(list->at(index).toLocal8Bit());
40 /** Free a QStringList.
41 * @param string_list the QStringList to free
43 CL_SMOKE_QT_EXPORT void
44 cl_smoke_free_string_list(void* string_list)
46 delete static_cast<QStringList*>(string_list);
49 /** Allocates a new QStringList.
51 * @return a new QStringList
53 CL_SMOKE_QT_EXPORT void*
54 cl_smoke_make_string_list()
56 return new QStringList();
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
64 CL_SMOKE_QT_EXPORT void
65 cl_smoke_string_list_append(void* string_list, const char* data, int length)
67 static_cast<QStringList*>(string_list)->append(QString::fromLocal8Bit(data, length));