// start the document
mxHandler->setDocumentLocator( mxLocator );
mxHandler->startDocument();
// parse the stream
mxStack.reset( new prv::ContextStack( mxHandler ) );
sal_Int32 nRecId = 0;
StreamDataSequence aRecData; while( lclReadNextRecord( nRecId, aRecData, *maSource.mxInStream ) )
{ // create record stream object from imported record data
SequenceInputStream aRecStrm( aRecData ); // try to leave a context, there may be other incomplete contexts on the stack if( const RecordInfo* pEndRecInfo = getEndRecordInfo( nRecId ) )
{ // finalize contexts without record identifier for context end while( !mxStack->empty() && !mxStack->hasCurrentEndRecId() )
mxStack->popContext(); // finalize the current context and pop context info from stack
OSL_ENSURE( mxStack->getCurrentRecId() == pEndRecInfo->mnStartRecId, "RecordParser::parseStream - context records mismatch" );
ContextHandlerRef xCurrContext = mxStack->getCurrentContext(); if( xCurrContext.is() )
{ // context end record may contain some data, handle it as simple record
aRecStrm.seekToStart();
xCurrContext->startRecord( nRecId, aRecStrm );
xCurrContext->endRecord( nRecId );
}
mxStack->popContext();
} else
{ // end context with incomplete record id, if the same id comes again if( (mxStack->getCurrentRecId() == nRecId) && !mxStack->hasCurrentEndRecId() )
mxStack->popContext(); // try to start a new context
ContextHandlerRef xCurrContext = mxStack->getCurrentContext(); if( xCurrContext.is() )
{
aRecStrm.seekToStart();
xCurrContext = xCurrContext->createRecordContext( nRecId, aRecStrm );
} // track all context identifiers on the stack (do not push simple records) const RecordInfo* pStartRecInfo = getStartRecordInfo( nRecId ); if( pStartRecInfo )
mxStack->pushContext( *pStartRecInfo, xCurrContext ); // import the record if( xCurrContext.is() )
{ // import the record
aRecStrm.seekToStart();
xCurrContext->startRecord( nRecId, aRecStrm ); // end simple records (context records are finished in ContextStack::popContext) if( !pStartRecInfo )
xCurrContext->endRecord( nRecId );
}
}
} // close remaining contexts (missing context end records or stream error) while( !mxStack->empty() )
mxStack->popContext();
mxStack.reset();
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.