xmloff/source/xforms/SchemaContext.cxx            |    4 --
 xmloff/source/xforms/SchemaContext.hxx            |    4 --
 xmloff/source/xforms/SchemaRestrictionContext.cxx |    8 +---
 xmloff/source/xforms/SchemaRestrictionContext.hxx |    4 --
 xmloff/source/xforms/SchemaSimpleTypeContext.cxx  |    8 +---
 xmloff/source/xforms/SchemaSimpleTypeContext.hxx  |    4 --
 xmloff/source/xforms/TokenContext.cxx             |    2 -
 xmloff/source/xforms/TokenContext.hxx             |    4 --
 xmloff/source/xforms/XFormsBindContext.cxx        |   23 ++++++------
 xmloff/source/xforms/XFormsBindContext.hxx        |    3 -
 xmloff/source/xforms/XFormsInstanceContext.cxx    |   12 ++----
 xmloff/source/xforms/XFormsInstanceContext.hxx    |    4 --
 xmloff/source/xforms/XFormsModelContext.cxx       |   10 ++---
 xmloff/source/xforms/XFormsModelContext.hxx       |    4 --
 xmloff/source/xforms/XFormsSubmissionContext.cxx  |   39 ++++++++++------------
 xmloff/source/xforms/XFormsSubmissionContext.hxx  |    3 -
 xmloff/source/xforms/xformsapi.cxx                |    2 -
 xmloff/source/xforms/xformsapi.hxx                |   16 ++++++---
 18 files changed, 68 insertions(+), 86 deletions(-)

New commits:
commit 11382ccf2ff58ba470dfa604654685730e0411f8
Author:     Noel <noelgran...@gmail.com>
AuthorDate: Tue Dec 15 15:35:03 2020 +0200
Commit:     Noel Grandin <noel.gran...@collabora.co.uk>
CommitDate: Thu Dec 17 08:00:23 2020 +0100

    use views to parse
    
    Change-Id: I9c0b89c9463065323b1a86aee21163c97b75bb25
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/107761
    Tested-by: Jenkins
    Reviewed-by: Noel Grandin <noel.gran...@collabora.co.uk>

diff --git a/xmloff/source/xforms/SchemaContext.cxx 
b/xmloff/source/xforms/SchemaContext.cxx
index 65341217c623..573805a25164 100644
--- a/xmloff/source/xforms/SchemaContext.cxx
+++ b/xmloff/source/xforms/SchemaContext.cxx
@@ -44,9 +44,7 @@ SchemaContext::SchemaContext(
 {
 }
 
-void SchemaContext::HandleAttribute(
-    sal_Int32,
-    const OUString& )
+void SchemaContext::HandleAttribute(const 
sax_fastparser::FastAttributeList::FastAttributeIter & )
 {
 }
 
diff --git a/xmloff/source/xforms/SchemaContext.hxx 
b/xmloff/source/xforms/SchemaContext.hxx
index bc780d2c4ded..e23ac37ebbbb 100644
--- a/xmloff/source/xforms/SchemaContext.hxx
+++ b/xmloff/source/xforms/SchemaContext.hxx
@@ -44,9 +44,7 @@ public:
     // implement TokenContext methods:
 
 protected:
-    virtual void HandleAttribute(
-        sal_Int32 nAttributeToken,
-        const OUString& rValue ) override;
+    virtual void HandleAttribute(const 
sax_fastparser::FastAttributeList::FastAttributeIter & aIter ) override;
 
     virtual SvXMLImportContext* HandleChild(
         sal_Int32 nElementToken,
diff --git a/xmloff/source/xforms/SchemaRestrictionContext.cxx 
b/xmloff/source/xforms/SchemaRestrictionContext.cxx
index 6d496e737ee3..ccbdbe695132 100644
--- a/xmloff/source/xforms/SchemaRestrictionContext.cxx
+++ b/xmloff/source/xforms/SchemaRestrictionContext.cxx
@@ -90,14 +90,12 @@ void SchemaRestrictionContext::CreateDataType()
     SAL_WARN_IF( !mxDataType.is(), "xmloff", "can't create type" );
 }
 
-void SchemaRestrictionContext::HandleAttribute(
-    sal_Int32 nAttributeToken,
-    const OUString& rValue )
+void SchemaRestrictionContext::HandleAttribute(const 
sax_fastparser::FastAttributeList::FastAttributeIter & aIter )
 {
-    switch (nAttributeToken & TOKEN_MASK)
+    switch (aIter.getToken() & TOKEN_MASK)
     {
         case XML_BASE:
-            msBaseName = rValue;
+            msBaseName = aIter.toString();
             break;
     }
 }
diff --git a/xmloff/source/xforms/SchemaRestrictionContext.hxx 
b/xmloff/source/xforms/SchemaRestrictionContext.hxx
index b928d78b9105..fdf7873b2a27 100644
--- a/xmloff/source/xforms/SchemaRestrictionContext.hxx
+++ b/xmloff/source/xforms/SchemaRestrictionContext.hxx
@@ -51,9 +51,7 @@ private:
 
     // implement TokenContext methods:
 
-    virtual void HandleAttribute(
-        sal_Int32 nAttributeToken,
-        const OUString& rValue ) override;
+    virtual void HandleAttribute(const 
sax_fastparser::FastAttributeList::FastAttributeIter & aIter ) override;
 
     virtual SvXMLImportContext* HandleChild(
         sal_Int32 nElementToken,
diff --git a/xmloff/source/xforms/SchemaSimpleTypeContext.cxx 
b/xmloff/source/xforms/SchemaSimpleTypeContext.cxx
index 755f8950f47d..cd245193094f 100644
--- a/xmloff/source/xforms/SchemaSimpleTypeContext.cxx
+++ b/xmloff/source/xforms/SchemaSimpleTypeContext.cxx
@@ -44,14 +44,12 @@ SchemaSimpleTypeContext::SchemaSimpleTypeContext(
 {
 }
 
-void SchemaSimpleTypeContext::HandleAttribute(
-    sal_Int32 nAttributeToken,
-    const OUString& rValue )
+void SchemaSimpleTypeContext::HandleAttribute(const 
sax_fastparser::FastAttributeList::FastAttributeIter & aIter )
 {
-    switch (nAttributeToken & TOKEN_MASK)
+    switch (aIter.getToken() & TOKEN_MASK)
     {
         case XML_NAME:
-            msTypeName = rValue;
+            msTypeName = aIter.toString();
             break;
     }
 }
diff --git a/xmloff/source/xforms/SchemaSimpleTypeContext.hxx 
b/xmloff/source/xforms/SchemaSimpleTypeContext.hxx
index cec535343e5f..a64af99a6a7d 100644
--- a/xmloff/source/xforms/SchemaSimpleTypeContext.hxx
+++ b/xmloff/source/xforms/SchemaSimpleTypeContext.hxx
@@ -45,9 +45,7 @@ public:
     // implement TokenContext methods:
 
 protected:
-    virtual void HandleAttribute(
-        sal_Int32 nAttributeToken,
-        const OUString& rValue ) override;
+    virtual void HandleAttribute(const 
sax_fastparser::FastAttributeList::FastAttributeIter & aIter ) override;
 
     virtual SvXMLImportContext* HandleChild(
         sal_Int32 nElementToken,
diff --git a/xmloff/source/xforms/TokenContext.cxx 
b/xmloff/source/xforms/TokenContext.cxx
index 738b8e60641a..928ea8788931 100644
--- a/xmloff/source/xforms/TokenContext.cxx
+++ b/xmloff/source/xforms/TokenContext.cxx
@@ -45,7 +45,7 @@ void TokenContext::startFastElement(
     // - other: warning
 
     for( auto& aIter : sax_fastparser::castToFastAttributeList(xAttrList) )
-        HandleAttribute( aIter.getToken(), aIter.toString() );
+        HandleAttribute( aIter );
 }
 
 css::uno::Reference< css::xml::sax::XFastContextHandler > 
TokenContext::createFastChildContext(
diff --git a/xmloff/source/xforms/TokenContext.hxx 
b/xmloff/source/xforms/TokenContext.hxx
index b2410f9bfab1..57865916ed5a 100644
--- a/xmloff/source/xforms/TokenContext.hxx
+++ b/xmloff/source/xforms/TokenContext.hxx
@@ -64,9 +64,7 @@ public:
 
 protected:
     /** will be called for each attribute */
-    virtual void HandleAttribute(
-        sal_Int32 nAttributeToken,
-        const OUString& rValue ) = 0;
+    virtual void HandleAttribute(const 
sax_fastparser::FastAttributeList::FastAttributeIter & aIter ) = 0;
 
     /** will be called for each child element */
     virtual SvXMLImportContext* HandleChild(
diff --git a/xmloff/source/xforms/XFormsBindContext.cxx 
b/xmloff/source/xforms/XFormsBindContext.cxx
index 3015f31901dc..45a03d4fb455 100644
--- a/xmloff/source/xforms/XFormsBindContext.cxx
+++ b/xmloff/source/xforms/XFormsBindContext.cxx
@@ -59,37 +59,36 @@ XFormsBindContext::XFormsBindContext(
     mxModel->getBindings()->insert( makeAny( mxBinding ) );
 }
 
-void XFormsBindContext::HandleAttribute( sal_Int32 nAttributeToken,
-                                         const OUString& rValue )
+void XFormsBindContext::HandleAttribute( const 
sax_fastparser::FastAttributeList::FastAttributeIter & aIter )
 {
-    switch( nAttributeToken & TOKEN_MASK )
+    switch( aIter.getToken() & TOKEN_MASK )
     {
     case XML_NODESET:
-        xforms_setValue( mxBinding, "BindingExpression", rValue );
+        xforms_setValue( mxBinding, "BindingExpression", aIter.toString() );
         break;
     case XML_ID:
-        xforms_setValue( mxBinding, "BindingID", rValue );
+        xforms_setValue( mxBinding, "BindingID", aIter.toString() );
         break;
     case XML_READONLY:
-        xforms_setValue( mxBinding, "ReadonlyExpression", rValue );
+        xforms_setValue( mxBinding, "ReadonlyExpression", aIter.toString() );
         break;
     case XML_RELEVANT:
-        xforms_setValue( mxBinding, "RelevantExpression", rValue );
+        xforms_setValue( mxBinding, "RelevantExpression", aIter.toString() );
         break;
     case XML_REQUIRED:
-        xforms_setValue( mxBinding, "RequiredExpression", rValue );
+        xforms_setValue( mxBinding, "RequiredExpression", aIter.toString() );
         break;
     case XML_CONSTRAINT:
-        xforms_setValue( mxBinding, "ConstraintExpression", rValue );
+        xforms_setValue( mxBinding, "ConstraintExpression", aIter.toString() );
         break;
     case XML_CALCULATE:
-        xforms_setValue( mxBinding, "CalculateExpression", rValue );
+        xforms_setValue( mxBinding, "CalculateExpression", aIter.toString() );
         break;
     case XML_TYPE:
         xforms_setValue( mxBinding, "Type",
-                      makeAny( xforms_getTypeName( 
mxModel->getDataTypeRepository(),
+                         xforms_getTypeName( mxModel->getDataTypeRepository(),
                                        GetImport().GetNamespaceMap(),
-                                       rValue ) ) );
+                                       aIter.toString() ) );
         break;
     default:
         assert( false && "should not happen" );
diff --git a/xmloff/source/xforms/XFormsBindContext.hxx 
b/xmloff/source/xforms/XFormsBindContext.hxx
index 9498851ef072..dbdcd1e6d996 100644
--- a/xmloff/source/xforms/XFormsBindContext.hxx
+++ b/xmloff/source/xforms/XFormsBindContext.hxx
@@ -49,8 +49,7 @@ public:
         const css::uno::Reference< css::xml::sax::XFastAttributeList >& 
xAttrList ) override;
 
 protected:
-    virtual void HandleAttribute( sal_Int32 nAttributeToken,
-                                  const OUString& rValue ) override;
+    virtual void HandleAttribute( const 
sax_fastparser::FastAttributeList::FastAttributeIter & aIter ) override;
 
     virtual SvXMLImportContext* HandleChild(
         sal_Int32 nElementToken,
diff --git a/xmloff/source/xforms/XFormsInstanceContext.cxx 
b/xmloff/source/xforms/XFormsInstanceContext.cxx
index 20af1580c588..66a5f1b149ba 100644
--- a/xmloff/source/xforms/XFormsInstanceContext.cxx
+++ b/xmloff/source/xforms/XFormsInstanceContext.cxx
@@ -134,20 +134,18 @@ void XFormsInstanceContext::endUnknownElement(const 
OUString & /*Namespace*/, co
     mxModel->getInstances()->insert( makeAny( aSequence ) );
 }
 
-void XFormsInstanceContext::HandleAttribute(
-    sal_Int32 nAttributeToken,
-    const OUString& rValue )
+void XFormsInstanceContext::HandleAttribute(const 
sax_fastparser::FastAttributeList::FastAttributeIter & aIter )
 {
-    switch( nAttributeToken & TOKEN_MASK )
+    switch( aIter.getToken() & TOKEN_MASK )
     {
     case XML_SRC:
-        msURL = rValue;
+        msURL = aIter.toString();
         break;
     case XML_ID:
-        msId = rValue;
+        msId = aIter.toString();
         break;
     default:
-        XMLOFF_WARN_UNKNOWN_ATTR("xmloff", nAttributeToken, rValue);
+        XMLOFF_WARN_UNKNOWN("xmloff", aIter);
         assert( false && "this should not happen" );
         break;
     }
diff --git a/xmloff/source/xforms/XFormsInstanceContext.hxx 
b/xmloff/source/xforms/XFormsInstanceContext.hxx
index 68e37be65294..4727c0f4b042 100644
--- a/xmloff/source/xforms/XFormsInstanceContext.hxx
+++ b/xmloff/source/xforms/XFormsInstanceContext.hxx
@@ -60,9 +60,7 @@ public:
     virtual void SAL_CALL endUnknownElement(const OUString & Namespace, const 
OUString & Name) override;
 
 protected:
-    virtual void HandleAttribute(
-        sal_Int32 nAttributeToken,
-        const OUString& rValue ) override;
+    virtual void HandleAttribute(const 
sax_fastparser::FastAttributeList::FastAttributeIter & aIter ) override;
 
     virtual SvXMLImportContext* HandleChild(
         sal_Int32 nElementToken,
diff --git a/xmloff/source/xforms/XFormsModelContext.cxx 
b/xmloff/source/xforms/XFormsModelContext.cxx
index 5a2b4905f55e..e5720d459d85 100644
--- a/xmloff/source/xforms/XFormsModelContext.cxx
+++ b/xmloff/source/xforms/XFormsModelContext.cxx
@@ -50,20 +50,18 @@ XFormsModelContext::XFormsModelContext( SvXMLImport& 
rImport ) :
 {
 }
 
-void XFormsModelContext::HandleAttribute(
-    sal_Int32 nAttributeToken,
-    const OUString& rValue )
+void XFormsModelContext::HandleAttribute(const 
sax_fastparser::FastAttributeList::FastAttributeIter & aIter )
 {
-    switch( nAttributeToken & TOKEN_MASK)
+    switch( aIter.getToken() & TOKEN_MASK)
     {
     case XML_ID:
-        mxModel->setPropertyValue( "ID", makeAny( rValue ) );
+        mxModel->setPropertyValue( "ID", makeAny( aIter.toString() ) );
         break;
     case XML_SCHEMA:
         GetImport().SetError( XMLERROR_XFORMS_NO_SCHEMA_SUPPORT );
         break;
     default:
-        XMLOFF_WARN_UNKNOWN_ATTR("xmloff", nAttributeToken, rValue);
+        XMLOFF_WARN_UNKNOWN("xmloff", aIter);
         assert( false && "this should not happen" );
         break;
     }
diff --git a/xmloff/source/xforms/XFormsModelContext.hxx 
b/xmloff/source/xforms/XFormsModelContext.hxx
index e2f0e1ee5712..bcf7cd9bdc3c 100644
--- a/xmloff/source/xforms/XFormsModelContext.hxx
+++ b/xmloff/source/xforms/XFormsModelContext.hxx
@@ -45,9 +45,7 @@ public:
     virtual void SAL_CALL endFastElement(sal_Int32 nElement) override;
 
 protected:
-    virtual void HandleAttribute(
-        sal_Int32 nAttributeToken,
-        const OUString& rValue ) override;
+    virtual void HandleAttribute(const 
sax_fastparser::FastAttributeList::FastAttributeIter & aIter ) override;
 
     virtual SvXMLImportContext* HandleChild(
         sal_Int32 nElementToken,
diff --git a/xmloff/source/xforms/XFormsSubmissionContext.cxx 
b/xmloff/source/xforms/XFormsSubmissionContext.cxx
index ec9463437894..9588ee36ee92 100644
--- a/xmloff/source/xforms/XFormsSubmissionContext.cxx
+++ b/xmloff/source/xforms/XFormsSubmissionContext.cxx
@@ -56,7 +56,7 @@ XFormsSubmissionContext::XFormsSubmissionContext(
 
 namespace {
 
-Any toBool( std::u16string_view rValue )
+Any toBool( std::string_view rValue )
 {
     Any aValue;
     bool bValue(false);
@@ -69,59 +69,58 @@ Any toBool( std::u16string_view rValue )
 
 } // namespace
 
-void XFormsSubmissionContext::HandleAttribute( sal_Int32 nAttributeToken,
-                                               const OUString& rValue )
+void XFormsSubmissionContext::HandleAttribute( const 
sax_fastparser::FastAttributeList::FastAttributeIter & aIter )
 {
-    switch( nAttributeToken & TOKEN_MASK )
+    switch( aIter.getToken() & TOKEN_MASK )
     {
     case XML_ID:
-        xforms_setValue( mxSubmission, "ID", rValue );
+        xforms_setValue( mxSubmission, "ID", aIter.toString() );
         break;
     case XML_BIND:
-        xforms_setValue( mxSubmission, "Bind", rValue );
+        xforms_setValue( mxSubmission, "Bind", aIter.toString() );
         break;
     case XML_REF:
-        xforms_setValue( mxSubmission, "Ref", rValue );
+        xforms_setValue( mxSubmission, "Ref", aIter.toString() );
         break;
     case XML_ACTION:
-        xforms_setValue( mxSubmission, "Action", rValue );
+        xforms_setValue( mxSubmission, "Action", aIter.toString() );
         break;
     case XML_METHOD:
-        xforms_setValue( mxSubmission, "Method", rValue );
+        xforms_setValue( mxSubmission, "Method", aIter.toString() );
         break;
     case XML_VERSION:
-        xforms_setValue( mxSubmission, "Version", rValue );
+        xforms_setValue( mxSubmission, "Version", aIter.toString() );
         break;
     case XML_INDENT:
-        xforms_setValue( mxSubmission, "Indent", toBool( rValue ) );
+        xforms_setValue( mxSubmission, "Indent", toBool( aIter.toView() ) );
         break;
     case XML_MEDIATYPE:
-        xforms_setValue( mxSubmission, "MediaType", rValue );
+        xforms_setValue( mxSubmission, "MediaType", aIter.toString() );
         break;
     case XML_ENCODING:
-        xforms_setValue( mxSubmission, "Encoding", rValue );
+        xforms_setValue( mxSubmission, "Encoding", aIter.toString() );
         break;
     case XML_OMIT_XML_DECLARATION:
         xforms_setValue( mxSubmission, "OmitXmlDeclaration",
-                      toBool( rValue ) );
+                      toBool( aIter.toView() ) );
         break;
     case XML_STANDALONE:
-        xforms_setValue( mxSubmission, "Standalone", toBool( rValue ) );
+        xforms_setValue( mxSubmission, "Standalone", toBool( aIter.toView() ) 
);
         break;
     case XML_CDATA_SECTION_ELEMENTS:
-        xforms_setValue( mxSubmission, "CDataSectionElement", rValue );
+        xforms_setValue( mxSubmission, "CDataSectionElement", aIter.toString() 
);
         break;
     case XML_REPLACE:
-        xforms_setValue( mxSubmission, "Replace", rValue );
+        xforms_setValue( mxSubmission, "Replace", aIter.toString() );
         break;
     case XML_SEPARATOR:
-        xforms_setValue( mxSubmission, "Separator", rValue );
+        xforms_setValue( mxSubmission, "Separator", aIter.toString() );
         break;
     case XML_INCLUDENAMESPACEPREFIXES:
-        xforms_setValue( mxSubmission, "IncludeNamespacePrefixes", rValue );
+        xforms_setValue( mxSubmission, "IncludeNamespacePrefixes", 
aIter.toString() );
         break;
     default:
-        XMLOFF_WARN_UNKNOWN_ATTR("xmloff", nAttributeToken, rValue);
+        XMLOFF_WARN_UNKNOWN("xmloff", aIter);
         assert( false && "unknown attribute" );
         break;
     }
diff --git a/xmloff/source/xforms/XFormsSubmissionContext.hxx 
b/xmloff/source/xforms/XFormsSubmissionContext.hxx
index 8234e935b87f..3d943ca29476 100644
--- a/xmloff/source/xforms/XFormsSubmissionContext.hxx
+++ b/xmloff/source/xforms/XFormsSubmissionContext.hxx
@@ -44,8 +44,7 @@ public:
     // implement TokenContext methods:
 
 protected:
-    virtual void HandleAttribute( sal_Int32 nAttributeToken,
-                                  const OUString& rValue ) override;
+    virtual void HandleAttribute( const 
sax_fastparser::FastAttributeList::FastAttributeIter & aIter ) override;
 
     virtual SvXMLImportContext* HandleChild(
         sal_Int32 nElementToken,
diff --git a/xmloff/source/xforms/xformsapi.cxx 
b/xmloff/source/xforms/xformsapi.cxx
index 3fbccbec4f75..556ade35edef 100644
--- a/xmloff/source/xforms/xformsapi.cxx
+++ b/xmloff/source/xforms/xformsapi.cxx
@@ -164,7 +164,7 @@ Reference<XPropertySet> xforms_findXFormsSubmission(
     return lcl_findXFormsBindingOrSubmission( xDocument, rBindingID, false );
 }
 
-void xforms_setValue( Reference<XPropertySet> const & xPropertySet,
+void xforms_setValueAny( Reference<XPropertySet> const & xPropertySet,
                    const OUString& rName,
                    const Any& rAny )
 {
diff --git a/xmloff/source/xforms/xformsapi.hxx 
b/xmloff/source/xforms/xformsapi.hxx
index 442937641041..4f9e4073aef6 100644
--- a/xmloff/source/xforms/xformsapi.hxx
+++ b/xmloff/source/xforms/xformsapi.hxx
@@ -44,18 +44,26 @@ css::uno::Reference<css::beans::XPropertySet> 
xforms_findXFormsBinding( css::uno
 
 css::uno::Reference<css::beans::XPropertySet> xforms_findXFormsSubmission( 
css::uno::Reference<css::frame::XModel> const &, const OUString& );
 
-void xforms_setValue(
+void xforms_setValueAny(
     css::uno::Reference<css::beans::XPropertySet> const & xPropSet,
     const OUString& rName,
     const css::uno::Any& rAny );
 
 template<typename T>
-void xforms_setValue(
+inline void xforms_setValue(
     css::uno::Reference<css::beans::XPropertySet>& xPropSet,
     const OUString& rName,
-    T& aValue )
+    const T& aValue )
 {
-    xforms_setValue( xPropSet, rName, css::uno::makeAny( aValue ) );
+    xforms_setValueAny( xPropSet, rName, css::uno::makeAny( aValue ) );
+}
+template<>
+inline void xforms_setValue(
+    css::uno::Reference<css::beans::XPropertySet>& xPropSet,
+    const OUString& rName,
+    const css::uno::Any& aValue )
+{
+    xforms_setValueAny( xPropSet, rName, aValue );
 }
 
 sal_uInt16 xforms_getTypeClass(
_______________________________________________
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits

Reply via email to