fastparser:: move Entity:: code into the anonymous namespace.
Change-Id: I564e35aa63e4c01cc1a0fb45f674dc1a2a0e89ec
This commit is contained in:
@@ -528,6 +528,52 @@ Event& Entity::getEvent( CallbackType aType )
|
|||||||
return rEvent;
|
return rEvent;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// throw an exception, but avoid callback if
|
||||||
|
// during a threaded produce
|
||||||
|
void Entity::throwException( const ::rtl::Reference< FastLocatorImpl > &xDocumentLocator,
|
||||||
|
bool mbDuringParse )
|
||||||
|
{
|
||||||
|
// Error during parsing !
|
||||||
|
SAXParseException aExcept(
|
||||||
|
lclGetErrorMessage( XML_GetErrorCode( mpParser ),
|
||||||
|
xDocumentLocator->getSystemId(),
|
||||||
|
xDocumentLocator->getLineNumber() ),
|
||||||
|
Reference< XInterface >(),
|
||||||
|
Any( &maSavedException, getCppuType( &maSavedException ) ),
|
||||||
|
xDocumentLocator->getPublicId(),
|
||||||
|
xDocumentLocator->getSystemId(),
|
||||||
|
xDocumentLocator->getLineNumber(),
|
||||||
|
xDocumentLocator->getColumnNumber()
|
||||||
|
);
|
||||||
|
|
||||||
|
// error handler is set, it may throw the exception
|
||||||
|
if( !mbDuringParse || !mbEnableThreads )
|
||||||
|
{
|
||||||
|
if (mxErrorHandler.is() )
|
||||||
|
mxErrorHandler->fatalError( Any( aExcept ) );
|
||||||
|
}
|
||||||
|
|
||||||
|
// error handler has not thrown, but parsing must stop => throw ourselves
|
||||||
|
throw aExcept;
|
||||||
|
}
|
||||||
|
|
||||||
|
// In the single threaded case we emit events via our C
|
||||||
|
// callbacks, so any exception caught must be queued up until
|
||||||
|
// we can safely re-throw it from our C++ parent of parse()
|
||||||
|
//
|
||||||
|
// If multi-threaded, we need to push an EXCEPTION event, at
|
||||||
|
// which point we transfer ownership of maSavedException to
|
||||||
|
// the consuming thread.
|
||||||
|
void Entity::saveException( const Exception &e )
|
||||||
|
{
|
||||||
|
// only store the first exception
|
||||||
|
if( !maSavedException.hasValue() )
|
||||||
|
{
|
||||||
|
maSavedException <<= e;
|
||||||
|
XML_StopParser( mpParser, /* resumable? */ XML_FALSE );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
} // namespace
|
} // namespace
|
||||||
|
|
||||||
namespace sax_fastparser {
|
namespace sax_fastparser {
|
||||||
@@ -1009,35 +1055,6 @@ const Entity& FastSaxParserImpl::getEntity() const
|
|||||||
return maEntities.top();
|
return maEntities.top();
|
||||||
}
|
}
|
||||||
|
|
||||||
// throw an exception, but avoid callback if
|
|
||||||
// during a threaded produce
|
|
||||||
void Entity::throwException( const ::rtl::Reference< FastLocatorImpl > &xDocumentLocator,
|
|
||||||
bool mbDuringParse )
|
|
||||||
{
|
|
||||||
// Error during parsing !
|
|
||||||
SAXParseException aExcept(
|
|
||||||
lclGetErrorMessage( XML_GetErrorCode( mpParser ),
|
|
||||||
xDocumentLocator->getSystemId(),
|
|
||||||
xDocumentLocator->getLineNumber() ),
|
|
||||||
Reference< XInterface >(),
|
|
||||||
Any( &maSavedException, getCppuType( &maSavedException ) ),
|
|
||||||
xDocumentLocator->getPublicId(),
|
|
||||||
xDocumentLocator->getSystemId(),
|
|
||||||
xDocumentLocator->getLineNumber(),
|
|
||||||
xDocumentLocator->getColumnNumber()
|
|
||||||
);
|
|
||||||
|
|
||||||
// error handler is set, it may throw the exception
|
|
||||||
if( !mbDuringParse || !mbEnableThreads )
|
|
||||||
{
|
|
||||||
if (mxErrorHandler.is() )
|
|
||||||
mxErrorHandler->fatalError( Any( aExcept ) );
|
|
||||||
}
|
|
||||||
|
|
||||||
// error handler has not thrown, but parsing must stop => throw ourselves
|
|
||||||
throw aExcept;
|
|
||||||
}
|
|
||||||
|
|
||||||
// starts parsing with actual parser !
|
// starts parsing with actual parser !
|
||||||
void FastSaxParserImpl::parse()
|
void FastSaxParserImpl::parse()
|
||||||
{
|
{
|
||||||
@@ -1068,23 +1085,6 @@ void FastSaxParserImpl::parse()
|
|||||||
produce( DONE );
|
produce( DONE );
|
||||||
}
|
}
|
||||||
|
|
||||||
// In the single threaded case we emit events via our C
|
|
||||||
// callbacks, so any exception caught must be queued up until
|
|
||||||
// we can safely re-throw it from our C++ parent of parse()
|
|
||||||
//
|
|
||||||
// If multi-threaded, we need to push an EXCEPTION event, at
|
|
||||||
// which point we transfer ownership of maSavedException to
|
|
||||||
// the consuming thread.
|
|
||||||
void Entity::saveException( const Exception &e )
|
|
||||||
{
|
|
||||||
// only store the first exception
|
|
||||||
if( !maSavedException.hasValue() )
|
|
||||||
{
|
|
||||||
maSavedException <<= e;
|
|
||||||
XML_StopParser( mpParser, /* resumable? */ XML_FALSE );
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
//------------------------------------------
|
//------------------------------------------
|
||||||
//
|
//
|
||||||
// The C-Callbacks
|
// The C-Callbacks
|
||||||
|
Reference in New Issue
Block a user