[Gambas-devel] QMap<QString,QString> my implementation in DCOP class file.
Brought to you by:
gambas
From: Carlo S. <cs...@li...> - 2005-02-24 08:56:31
|
Hi, I have try to manage QMap<QString,QString> type in CApplication.cpp. I have implemented it like this: ... #include <qmap.h> ... enum { QT_T_VOID, ... QT_T_QMAP_QSTRING, }; ... { "QMap<QString,QString>",(GB_TYPE)"Collection" }, { NULL } }; ... //My implementation. else if (type == QT_T_QMAP_QSTRING) { GB_COLLECTION aCollection; GB_STRING aKey; GB_STRING aValue; //Redefine a type for QMap of QString typedef QMap<QString,QString> Map; Map r; reply >> r; //Create a new Collection GB.Collection.New(&aCollection,GB_COMP_BINARY); //Create an Map Iterator for navigate a Map Map::Iterator it; for (it =r.begin() ;it != r.end();it++) { #ifdef DEBUG_ME //This is correct qDebug("QMAP %s->%s", it.key().latin1(),it.data().latin1()); #endif //Create e new GB_STRING that contain a Key (QString) GB.NewString((char **)&aKey,it.key().latin1(),0); //Generate a new GB_STRING theat cantain a Value (QString) GB.NewString((char **)&aValue,it.data().latin1(),0); //aValue is NULL??? WHY qDebug("aValue: %s-%s",aKey,aValue); //Here is the crash //GB.Collection.Set(&aCollection,&aKey,GB.StringLength((char *)&aKey),(GB_VARIANT *)&aValue); //GB.Collection.Set(&aCollection,it.key().latin1(),it.key().length(),(GB_VARIANT*)it.data().latin1()); } //return a Collection GB.ReturnObject(aCollection); } Can you help me? |