#include #include #include #include #include #include "qfactoryinterface.h" #include "gen_qfactoryinterface.h" extern "C" { extern void miqt_exec_callback(void* cb, int argc, void* argv); } void QFactoryInterface_Keys(const QFactoryInterface* self, char*** _out, int** _out_Lengths, size_t* _out_len) { QStringList ret = self->keys(); // Convert QStringList from C++ memory to manually-managed C memory char** __out = static_cast(malloc(sizeof(char*) * ret.length())); int* __out_Lengths = static_cast(malloc(sizeof(int) * ret.length())); for (size_t i = 0, e = ret.length(); i < e; ++i) { // Convert QString from UTF-16 in C++ RAII memory to UTF-8 in manually-managed C memory QByteArray b = ret[i].toUtf8(); __out[i] = static_cast(malloc(b.length())); memcpy(__out[i], b.data(), b.length()); __out_Lengths[i] = b.length(); } *_out = __out; *_out_Lengths = __out_Lengths; *_out_len = ret.length(); } void QFactoryInterface_Delete(QFactoryInterface* self) { delete self; }