#include <qcstring.h>
#include <qvaluelist.h>
#include <qdom.h>
#include <qxml.h>
#include <vector>
#include <iostream>
Include dependency graph for trappervector.h:
This graph shows which files directly or indirectly include this file:
Go to the source code of this file.
Classes | |
class | TrapperVector< T > |
To store an array of values. It's a template class to be used in the serializing bytearray and import/export to dom tree. More... | |
Functions | |
template<class T> | |
QDataStream & | operator<< (QDataStream &stream, TrapperVector< T > &t) |
template<class T> | |
QDataStream & | operator>> (QDataStream &stream, TrapperVector< T > &t) |
|
Todo: But a problem with this approach might be that the endian awareness of QDataStream might be lost, when we don't serialize the types one by one. It might be a problem when moving berkeley dbs around archictures. But berkeley db probably doesn't allow this anyway? Definition at line 209 of file trappervector.h. 00210 { 00211 if ( t.size() > 0 ) { 00212 00213 00214 00215 const char * dataPtr = t.data() ; 00216 00217 #if defined(QT_DEBUG) 00218 00219 if ( t.size() != 0 ) { 00220 Q_CHECK_PTR( dataPtr ); 00221 } 00222 int a = t.size(); 00223 qDebug("stream.writeBytes , t.size()=%d",a); 00224 #endif 00225 00226 stream.writeBytes( dataPtr, t.size() ); 00227 } 00228 else { 00229 stream<<0; 00230 } 00231 00232 00233 return stream; 00234 }
|
|
Todo: But a problem with this approach might be that the endian awareness of QDataStream might be lost, when we don't serialize the types one by one. It might be a problem when moving berkeley dbs around archictures. But berkeley db probably doesn't allow this anyway? Definition at line 242 of file trappervector.h. References TrapperVector< T >::data(), and TrapperVector< T >::resize(). 00243 { 00244 Q_UINT32 len; 00245 stream >> len; 00246 00247 if ( len > 0 ) { 00248 t.resize( len ); 00249 char * dataPtr = const_cast< char * >( t.data() ); 00250 Q_CHECK_PTR( dataPtr ); 00251 if ( !dataPtr ) { 00252 cerr<<"len: "<<len<<endl; 00253 } 00254 00255 00256 #if defined(QT_DEBUG) 00257 // wrapping macro around should not be a must ... fix this 00258 qDebug("stream.readRawBytes, len=%d",len); 00259 #endif 00260 // if ( dataPtr ) { 00261 stream.readRawBytes( dataPtr, len ); 00262 // } 00263 } 00264 00265 return stream; 00266 }
|