ChunkedXMLInputSource.cc

Go to the documentation of this file.
00001 #include "ChunkedXMLInputSource.h"
00002 
00003 // qt
00004 #include <qcstring.h>
00005 #include <qdatastream.h>
00006 #include <iostream>
00007 
00008 using namespace std;
00009 
00010 // static const int MAX_CHUNK_LENGTH = 524288;
00011 // static const int MAX_CHUNK_LENGTH = 10000000;
00012 static const int MAX_CHUNK_LENGTH = 100000000;
00013 
00014 ChunkedXMLInputSource::ChunkedXMLInputSource( QIODevice* dev )
00015     : m_io( dev )
00016 {
00017     fetchData();
00018 }
00019 
00020 ChunkedXMLInputSource::~ChunkedXMLInputSource()
00021 {
00022 }
00023 
00024 void ChunkedXMLInputSource::fetchData()
00025 {
00026 //   cerr << "ChunkedXMLInputSource::fetchData"<<endl;
00027 //   cerr<<"Reading "<<MAX_CHUNK_LENGTH<<" bytes"<<endl;
00028     if ( m_io->atEnd() )
00029     {
00030         setData( QByteArray() );
00031         return;
00032     }
00033 
00034     QByteArray data;
00035     data.resize( MAX_CHUNK_LENGTH );
00036     QDataStream input( m_io );
00037     input.readRawBytes( data.data(), MAX_CHUNK_LENGTH );
00038     setData( data );
00039 }

Generated on Fri Jul 17 20:19:29 2009 for ngsview by  doxygen 1.5.1