initial import
src/lib/qstringlist.cpp
Sun Apr 5 19:56:16 CEST 2009 Tobias Rautenkranz <tobias@rautenkranz.ch>
* initial import
--- old-qt.core/src/lib/qstringlist.cpp 1970-01-01 01:00:00.000000000 +0100
+++ new-qt.core/src/lib/qstringlist.cpp 2014-11-11 13:37:04.000000000 +0100
@@ -0,0 +1,69 @@
+#include <QStringList>
+#include <QtDebug>
+#include <cstring>
+
+/** @file
+ * @brief QStringList conversion. */
+
+extern "C" {
+
+/** Returns the number of items of @a string_list.
+ * @param string_list the QStringList
+ *
+ * @return the number of items
+ */
+int
+qt_smoke_string_list_size(const void* string_list)
+{
+ Q_ASSERT(string_list);
+ return static_cast<const QStringList*>(string_list)->size();
+}
+
+/** Returns the byte array of @a string_list at position @a index.
+ * @param string_list the QStringList
+ * @param index the index of the string
+ *
+ * @return a new allocated byte-array
+ */
+void*
+qt_smoke_string_list_at(const void* string_list, int index)
+{
+ Q_ASSERT(string_list);
+ const QStringList* list = static_cast<const QStringList*>(string_list);
+
+ Q_ASSERT(0 <= index && index < list->size());
+
+ return new QByteArray(list->at(index).toLocal8Bit());
+}
+
+/** Free a QStringList.
+ * @param string_list the QStringList to free
+ */
+void
+qt_smoke_free_string_list(void* string_list)
+{
+ delete static_cast<QStringList*>(string_list);
+}
+
+/** Allocates a new QStringList.
+ *
+ * @return a new QStringList
+ */
+void*
+qt_smoke_make_string_list()
+{
+ return new QStringList();
+}
+
+/** Appends @a string to @a string_list
+ * @param string_list the QStringList
+ * @param data the string
+ * @param length the length of @a data
+ */
+void
+qt_smoke_string_list_append(void* string_list, const char* data, int length)
+{
+ static_cast<QStringList*>(string_list)->append(QString::fromLocal8Bit(data, length));
+}
+
+} // extern "C"