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