LibreOffice Module sax (master) 1
Public Member Functions | Public Attributes | Private Member Functions | Private Attributes | List of all members
sax_fastparser::FastSaxParserImpl Class Reference
Collaboration diagram for sax_fastparser::FastSaxParserImpl:
[legend]

Public Member Functions

 FastSaxParserImpl ()
 
 ~FastSaxParserImpl ()
 
void parseStream (const css::xml::sax::InputSource &aInputSource)
 
void setFastDocumentHandler (const css::uno::Reference< css::xml::sax::XFastDocumentHandler > &Handler)
 
void setTokenHandler (const css::uno::Reference< css::xml::sax::XFastTokenHandler > &Handler)
 
void registerNamespace (const OUString &NamespaceURL, sal_Int32 NamespaceToken)
 
OUString const & getNamespaceURL (std::u16string_view rPrefix)
 
void setErrorHandler (const css::uno::Reference< css::xml::sax::XErrorHandler > &Handler)
 
void setNamespaceHandler (const css::uno::Reference< css::xml::sax::XFastNamespaceHandler > &Handler)
 
void setCustomEntityNames (const ::css::uno::Sequence<::css::beans::Pair<::rtl::OUString, ::rtl::OUString > > &replacements)
 
void callbackStartElement (const xmlChar *localName, const xmlChar *prefix, const xmlChar *URI, int numNamespaces, const xmlChar **namespaces, int numAttributes, const xmlChar **attributes)
 
void callbackEndElement ()
 
void callbackCharacters (const xmlChar *s, int nLen)
 
void callbackProcessingInstruction (const xmlChar *target, const xmlChar *data)
 
xmlEntityPtr callbackGetEntity (const xmlChar *name)
 
void pushEntity (const ParserData &, xml::sax::InputSource const &)
 
void popEntity ()
 
Entity & getEntity ()
 
void parse ()
 
void produce (bool bForceFlush=false)
 

Public Attributes

bool m_bIgnoreMissingNSDecl
 
bool m_bDisableThreadedParser
 

Private Member Functions

bool consume (EventList &)
 
void deleteUsedEvents ()
 
void sendPendingCharacters ()
 
void addUnknownElementWithPrefix (const xmlChar **attributes, int i, rtl::Reference< FastAttributeList > const &xAttributes)
 
sal_Int32 GetToken (const xmlChar *pName)
 
sal_Int32 GetTokenWithPrefix (const xmlChar *pPrefix, const xmlChar *pName)
 
OUString const & GetNamespaceURL (std::string_view rPrefix)
 
sal_Int32 GetNamespaceToken (const OUString &rNamespaceURL)
 
sal_Int32 GetTokenWithContextNamespace (sal_Int32 nNamespaceToken, const xmlChar *pName)
 
void DefineNamespace (const OString &rPrefix, const OUString &namespaceURL)
 

Private Attributes

std::vector< ReplacementPair > m_Replacements
 
std::vector< xmlEntityPtr > m_TemporalEntities
 
std::mutex maMutex
 Protecting whole parseStream() execution. More...
 
::rtl::Reference< FastLocatorImpl > mxDocumentLocator
 
NamespaceMap maNamespaceMap
 
ParserData maData
 
Entity * mpTop
 Cached parser configuration for next call of parseStream(). More...
 
std::stack< Entity > maEntities
 std::stack::top() is amazingly slow => cache this. More...
 
std::vector< char > pendingCharacters
 Entity stack for each call of parseStream(). More...
 

Detailed Description

Definition at line 225 of file fastparser.cxx.

Constructor & Destructor Documentation

◆ FastSaxParserImpl()

sax_fastparser::FastSaxParserImpl::FastSaxParserImpl ( )
explicit

Definition at line 662 of file fastparser.cxx.

References mpTop, and mxDocumentLocator.

◆ ~FastSaxParserImpl()

sax_fastparser::FastSaxParserImpl::~FastSaxParserImpl ( )

Definition at line 670 of file fastparser.cxx.

References m_TemporalEntities, and mxDocumentLocator.

Member Function Documentation

◆ addUnknownElementWithPrefix()

void sax_fastparser::FastSaxParserImpl::addUnknownElementWithPrefix ( const xmlChar **  attributes,
int  i,
rtl::Reference< FastAttributeList > const &  xAttributes 
)
private

Definition at line 1300 of file fastparser.cxx.

References i, m_bIgnoreMissingNSDecl, SAL_INFO, and XML_CAST.

Referenced by callbackStartElement().

◆ callbackCharacters()

void sax_fastparser::FastSaxParserImpl::callbackCharacters ( const xmlChar *  s,
int  nLen 
)

Definition at line 1333 of file fastparser.cxx.

References pendingCharacters.

◆ callbackEndElement()

void sax_fastparser::FastSaxParserImpl::callbackEndElement ( )

◆ callbackGetEntity()

xmlEntityPtr sax_fastparser::FastSaxParserImpl::callbackGetEntity ( const xmlChar *  name)

Definition at line 1385 of file fastparser.cxx.

References m_Replacements, m_TemporalEntities, name, OUStringToOString(), and XML_CAST.

◆ callbackProcessingInstruction()

void sax_fastparser::FastSaxParserImpl::callbackProcessingInstruction ( const xmlChar *  target,
const xmlChar *  data 
)

◆ callbackStartElement()

void sax_fastparser::FastSaxParserImpl::callbackStartElement ( const xmlChar *  localName,
const xmlChar *  prefix,
const xmlChar *  URI,
int  numNamespaces,
const xmlChar **  namespaces,
int  numAttributes,
const xmlChar **  attributes 
)

◆ consume()

bool sax_fastparser::FastSaxParserImpl::consume ( EventList rEventList)
private

Definition at line 1004 of file fastparser.cxx.

References getEntity(), and mxDocumentLocator.

Referenced by parseStream().

◆ DefineNamespace()

void sax_fastparser::FastSaxParserImpl::DefineNamespace ( const OString &  rPrefix,
const OUString &  namespaceURL 
)
private

Definition at line 684 of file fastparser.cxx.

References getEntity(), and GetNamespaceToken().

Referenced by callbackStartElement().

◆ deleteUsedEvents()

void sax_fastparser::FastSaxParserImpl::deleteUsedEvents ( )
private

Definition at line 960 of file fastparser.cxx.

References aEventList, and getEntity().

Referenced by parseStream().

◆ getEntity()

Entity & sax_fastparser::FastSaxParserImpl::getEntity ( )
inline

◆ GetNamespaceToken()

sal_Int32 sax_fastparser::FastSaxParserImpl::GetNamespaceToken ( const OUString &  rNamespaceURL)
private

Definition at line 724 of file fastparser.cxx.

References maNamespaceMap.

Referenced by callbackStartElement(), DefineNamespace(), and registerNamespace().

◆ GetNamespaceURL()

OUString const & sax_fastparser::FastSaxParserImpl::GetNamespaceURL ( std::string_view  rPrefix)
private
Exceptions
css::xml::sax::SAXException

Definition at line 733 of file fastparser.cxx.

References Any, getEntity(), and nNamespace.

Referenced by getNamespaceURL().

◆ getNamespaceURL()

OUString const & sax_fastparser::FastSaxParserImpl::getNamespaceURL ( std::u16string_view  rPrefix)
Exceptions
css::lang::IllegalArgumentException
css::uno::RuntimeException

Definition at line 925 of file fastparser.cxx.

References Exception, GetNamespaceURL(), and OUStringToOString().

◆ GetToken()

sal_Int32 sax_fastparser::FastSaxParserImpl::GetToken ( const xmlChar *  pName)
private

◆ GetTokenWithContextNamespace()

sal_Int32 sax_fastparser::FastSaxParserImpl::GetTokenWithContextNamespace ( sal_Int32  nNamespaceToken,
const xmlChar *  pName 
)
private

Definition at line 748 of file fastparser.cxx.

References GetToken(), and pName.

Referenced by callbackStartElement(), and GetTokenWithPrefix().

◆ GetTokenWithPrefix()

sal_Int32 sax_fastparser::FastSaxParserImpl::GetTokenWithPrefix ( const xmlChar *  pPrefix,
const xmlChar *  pName 
)
private
Exceptions
css::xml::sax::SAXException

Definition at line 702 of file fastparser.cxx.

References getEntity(), GetTokenWithContextNamespace(), m_bIgnoreMissingNSDecl, nNamespace, pName, sPrefix, and XML_CAST.

Referenced by callbackStartElement().

◆ parse()

void sax_fastparser::FastSaxParserImpl::parse ( )

Definition at line 1063 of file fastparser.cxx.

References Any, BUFFER_SIZE, getEntity(), mxDocumentLocator, and produce().

Referenced by parseStream().

◆ parseStream()

void sax_fastparser::FastSaxParserImpl::parseStream ( const css::xml::sax::InputSource &  aInputSource)
Exceptions
css::xml::sax::SAXException
css::io::IOException
css::uno::RuntimeException

Definition at line 806 of file fastparser.cxx.

References aEventList, consume(), deleteUsedEvents(), getEntity(), m_bDisableThreadedParser, maData, maMutex, mxDocumentLocator, parse(), and pushEntity().

◆ popEntity()

void sax_fastparser::FastSaxParserImpl::popEntity ( )

Definition at line 1056 of file fastparser.cxx.

References maEntities, and mpTop.

◆ produce()

void sax_fastparser::FastSaxParserImpl::produce ( bool  bForceFlush = false)

◆ pushEntity()

void sax_fastparser::FastSaxParserImpl::pushEntity ( const ParserData &  rEntityData,
xml::sax::InputSource const &  rSource 
)

Definition at line 1038 of file fastparser.cxx.

References Any, maEntities, mpTop, and OUStringToOString().

Referenced by parseStream().

◆ registerNamespace()

void sax_fastparser::FastSaxParserImpl::registerNamespace ( const OUString &  NamespaceURL,
sal_Int32  NamespaceToken 
)
Exceptions
css::lang::IllegalArgumentException
css::uno::RuntimeException

Definition at line 912 of file fastparser.cxx.

References GetNamespaceToken(), and maNamespaceMap.

◆ sendPendingCharacters()

void sax_fastparser::FastSaxParserImpl::sendPendingCharacters ( )
private

◆ setCustomEntityNames()

void sax_fastparser::FastSaxParserImpl::setCustomEntityNames ( const ::css::uno::Sequence<::css::beans::Pair<::rtl::OUString, ::rtl::OUString > > &  replacements)

Definition at line 947 of file fastparser.cxx.

References i, and m_Replacements.

◆ setErrorHandler()

void sax_fastparser::FastSaxParserImpl::setErrorHandler ( const css::uno::Reference< css::xml::sax::XErrorHandler > &  Handler)
Exceptions
css::uno::RuntimeException

Definition at line 937 of file fastparser.cxx.

References maData.

◆ setFastDocumentHandler()

void sax_fastparser::FastSaxParserImpl::setFastDocumentHandler ( const css::uno::Reference< css::xml::sax::XFastDocumentHandler > &  Handler)
Exceptions
css::uno::RuntimeException

Definition at line 901 of file fastparser.cxx.

References maData.

◆ setNamespaceHandler()

void sax_fastparser::FastSaxParserImpl::setNamespaceHandler ( const css::uno::Reference< css::xml::sax::XFastNamespaceHandler > &  Handler)
Exceptions
css::uno::RuntimeException

Definition at line 942 of file fastparser.cxx.

References maData.

◆ setTokenHandler()

void sax_fastparser::FastSaxParserImpl::setTokenHandler ( const css::uno::Reference< css::xml::sax::XFastTokenHandler > &  Handler)
Exceptions
css::uno::RuntimeException

Definition at line 906 of file fastparser.cxx.

References maData.

Member Data Documentation

◆ m_bDisableThreadedParser

bool sax_fastparser::FastSaxParserImpl::m_bDisableThreadedParser

Definition at line 273 of file fastparser.cxx.

Referenced by parseStream().

◆ m_bIgnoreMissingNSDecl

bool sax_fastparser::FastSaxParserImpl::m_bIgnoreMissingNSDecl

◆ m_Replacements

std::vector<ReplacementPair> sax_fastparser::FastSaxParserImpl::m_Replacements
private

Definition at line 232 of file fastparser.cxx.

Referenced by callbackGetEntity(), and setCustomEntityNames().

◆ m_TemporalEntities

std::vector<xmlEntityPtr> sax_fastparser::FastSaxParserImpl::m_TemporalEntities
private

Definition at line 233 of file fastparser.cxx.

Referenced by callbackGetEntity(), and ~FastSaxParserImpl().

◆ maData

ParserData sax_fastparser::FastSaxParserImpl::maData
private

◆ maEntities

std::stack< Entity > sax_fastparser::FastSaxParserImpl::maEntities
private

std::stack::top() is amazingly slow => cache this.

Definition at line 298 of file fastparser.cxx.

Referenced by popEntity(), and pushEntity().

◆ maMutex

std::mutex sax_fastparser::FastSaxParserImpl::maMutex
private

Protecting whole parseStream() execution.

Definition at line 291 of file fastparser.cxx.

Referenced by parseStream().

◆ maNamespaceMap

NamespaceMap sax_fastparser::FastSaxParserImpl::maNamespaceMap
private

Definition at line 293 of file fastparser.cxx.

Referenced by GetNamespaceToken(), and registerNamespace().

◆ mpTop

Entity* sax_fastparser::FastSaxParserImpl::mpTop
private

Cached parser configuration for next call of parseStream().

Definition at line 297 of file fastparser.cxx.

Referenced by getEntity(), popEntity(), and pushEntity().

◆ mxDocumentLocator

::rtl::Reference< FastLocatorImpl > sax_fastparser::FastSaxParserImpl::mxDocumentLocator
private

◆ pendingCharacters

std::vector<char> sax_fastparser::FastSaxParserImpl::pendingCharacters
private

The documentation for this class was generated from the following file: