diff options
Diffstat (limited to 'src/Qt4/qlistconverter.cpp')
-rw-r--r-- | src/Qt4/qlistconverter.cpp | 40 |
1 files changed, 40 insertions, 0 deletions
diff --git a/src/Qt4/qlistconverter.cpp b/src/Qt4/qlistconverter.cpp new file mode 100644 index 0000000..4ce0845 --- /dev/null +++ b/src/Qt4/qlistconverter.cpp @@ -0,0 +1,40 @@ +#include "qlistconverter.h" + +#include <QStringList> +#include <QString> + +struct StringList +{ + char **list; + unsigned int count; +}; + +namespace CppPortage{ + +QListConverter::QListConverter(QObject *parent) + :QObject(parent) +{} + +StringList* QListConverter::QStringListToStringList(QStringList qstringList) +{ + StringList *stringList = stringListCreate(qstringList.size());//create a new StringList + + for (int i = 0; i <= qstringList.size(); i++) { + char c = *(qstringList.at(i).toUtf8().data()); + stringListInsertAt(stringList, i, &c); + } + + return stringList; +} + +QStringList QListConverter::StringListToQStringList(StringList *stringList) +{ + QStringList qstringList; + + for (int i = 0; i <= stringList->count; i++) { + qstringList.insert(i, stringListGetAt(stringList, i)); + } + + return qstringList; +} +}//end namespace
\ No newline at end of file |