diff options
author | Michael Meeks <michael.meeks@collabora.com> | 2013-11-26 16:26:12 +0000 |
---|---|---|
committer | Michael Meeks <michael.meeks@collabora.com> | 2013-11-26 17:33:44 +0000 |
commit | d7280af9740819971f46a855108334b84778b47d (patch) | |
tree | 12f13fe1c9afcaa2b2e4ab3a7d22a70bda710c23 /include/sax | |
parent | fastparser: don't waste cycles churning reference counts. (diff) | |
download | core-d7280af9740819971f46a855108334b84778b47d.tar.gz core-d7280af9740819971f46a855108334b84778b47d.zip |
fastparser: Avoid copying all tokens into a sequence.
Diffstat (limited to 'include/sax')
-rw-r--r-- | include/sax/fastattribs.hxx | 14 |
1 files changed, 13 insertions, 1 deletions
diff --git a/include/sax/fastattribs.hxx b/include/sax/fastattribs.hxx index 42b285c9e847..f1f64dd4b9ed 100644 --- a/include/sax/fastattribs.hxx +++ b/include/sax/fastattribs.hxx @@ -49,6 +49,14 @@ struct UnknownAttribute typedef std::vector< UnknownAttribute > UnknownAttributeList; +/// A native C++ interface to tokenisation +class SAX_DLLPUBLIC FastTokenHandlerBase +{ + public: + virtual ~FastTokenHandlerBase() {} + virtual sal_Int32 getTokenDirect( const char *pToken, sal_Int32 nLength ) const = 0; +}; + /// avoid constantly allocating and freeing sequences. class SAX_DLLPUBLIC FastTokenLookup { @@ -58,13 +66,15 @@ public: FastTokenLookup(); sal_Int32 getTokenFromChars( const ::css::uno::Reference< ::css::xml::sax::XFastTokenHandler > &mxTokenHandler, + FastTokenHandlerBase *pTokenHandler, const char *pStr, size_t nLength = 0 ); }; class SAX_DLLPUBLIC FastAttributeList : public ::cppu::WeakImplHelper1< ::com::sun::star::xml::sax::XFastAttributeList > { public: - FastAttributeList( const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XFastTokenHandler >& xTokenHandler ); + FastAttributeList( const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XFastTokenHandler >& xTokenHandler, + FastTokenHandlerBase *pOptHandlerBase = NULL ); virtual ~FastAttributeList(); void clear(); @@ -100,6 +110,8 @@ private: std::vector< sal_Int32 > maAttributeTokens; UnknownAttributeList maUnknownAttributes; ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XFastTokenHandler > mxTokenHandler; + FastTokenHandlerBase *mpTokenHandler; + FastTokenLookup maTokenLookup; }; |