diff options
author | Noel Grandin <noel.grandin@collabora.co.uk> | 2020-04-28 12:29:17 +0200 |
---|---|---|
committer | Noel Grandin <noel.grandin@collabora.co.uk> | 2020-04-28 13:25:27 +0200 |
commit | 1705fbe9daac56ee9bea8d8fd7c7f57e2bec49b5 (patch) | |
tree | aaf39244173a4cf20df6568140ebdbe5ec055656 /starmath/source | |
parent | dfa8e18e8e6c7ad87e423393f8293a20188de1fd (diff) |
move the castToFastAttributeList function
to the slightly higher namespace, to make it easy and more readable to
use directly in a for-loop-range expression.
And make it return a reference rather than a pointer, since it is never
allowed to be nullptr.
Change-Id: I15d0b32493ef65cfc601b247c272b318f1eadfd8
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/93049
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'starmath/source')
-rw-r--r-- | starmath/source/mathmlimport.cxx | 40 |
1 files changed, 13 insertions, 27 deletions
diff --git a/starmath/source/mathmlimport.cxx b/starmath/source/mathmlimport.cxx index ae0f4300d158..a4ef90a47504 100644 --- a/starmath/source/mathmlimport.cxx +++ b/starmath/source/mathmlimport.cxx @@ -599,9 +599,7 @@ void SmXMLContext_Helper::RetrieveAttrs(const uno::Reference< xml::sax::XFastAttributeList > & xAttrList ) { bool bMvFound = false; - sax_fastparser::FastAttributeList *pAttribList = - sax_fastparser::FastAttributeList::castToFastAttributeList( xAttrList ); - for (auto &aIter : *pAttribList) + for (auto &aIter : sax_fastparser::castToFastAttributeList( xAttrList )) { OUString sValue = aIter.toString(); // sometimes they have namespace, sometimes not? @@ -767,9 +765,7 @@ public: void SmXMLTokenAttrHelper::RetrieveAttrs(const uno::Reference<xml::sax::XFastAttributeList>& xAttrList) { - sax_fastparser::FastAttributeList *pAttribList = - sax_fastparser::FastAttributeList::castToFastAttributeList( xAttrList ); - for (auto &aIter : *pAttribList) + for (auto &aIter : sax_fastparser::castToFastAttributeList( xAttrList )) { OUString sValue = aIter.toString(); switch(aIter.getToken()) @@ -1077,9 +1073,7 @@ public: void SmXMLFencedContext_Impl::startFastElement(sal_Int32 /*nElement*/, const uno::Reference< xml::sax::XFastAttributeList > & xAttrList ) { - sax_fastparser::FastAttributeList *pAttribList = - sax_fastparser::FastAttributeList::castToFastAttributeList( xAttrList ); - for (auto &aIter : *pAttribList) + for (auto &aIter : sax_fastparser::castToFastAttributeList( xAttrList )) { OUString sValue = aIter.toString(); switch(aIter.getToken()) @@ -1227,9 +1221,7 @@ public: void SmXMLAnnotationContext_Impl::startFastElement(sal_Int32 /*nElement*/, const uno::Reference< xml::sax::XFastAttributeList > & xAttrList ) { - sax_fastparser::FastAttributeList *pAttribList = - sax_fastparser::FastAttributeList::castToFastAttributeList( xAttrList ); - for (auto &aIter : *pAttribList) + for (auto &aIter : sax_fastparser::castToFastAttributeList( xAttrList )) { OUString sValue = aIter.toString(); // sometimes they have namespace, sometimes not? @@ -1443,9 +1435,7 @@ void SmXMLOperatorContext_Impl::startFastElement(sal_Int32 /*nElement*/, const u { maTokenAttrHelper.RetrieveAttrs(xAttrList); - sax_fastparser::FastAttributeList *pAttribList = - sax_fastparser::FastAttributeList::castToFastAttributeList( xAttrList ); - for (auto &aIter : *pAttribList) + for (auto &aIter : sax_fastparser::castToFastAttributeList( xAttrList )) { OUString sValue = aIter.toString(); switch(aIter.getToken()) @@ -1510,9 +1500,7 @@ void SmXMLSpaceContext_Impl::startFastElement(sal_Int32 /*nElement*/, MathMLAttributeLengthValue aLV; sal_Int32 nWide = 0, nNarrow = 0; - sax_fastparser::FastAttributeList *pAttribList = - sax_fastparser::FastAttributeList::castToFastAttributeList( xAttrList ); - for (auto &aIter : *pAttribList) + for (auto &aIter : sax_fastparser::castToFastAttributeList( xAttrList )) { OUString sValue = aIter.toString(); switch (aIter.getToken()) @@ -1671,9 +1659,9 @@ public: void SmXMLUnderContext_Impl::startFastElement(sal_Int32 /*nElement*/, const uno::Reference< xml::sax::XFastAttributeList > & xAttrList ) { - sax_fastparser::FastAttributeList *pAttribList = - sax_fastparser::FastAttributeList::castToFastAttributeList( xAttrList ); - nAttrCount = pAttribList->getFastAttributeTokens().size(); + sax_fastparser::FastAttributeList& rAttribList = + sax_fastparser::castToFastAttributeList( xAttrList ); + nAttrCount = rAttribList.getFastAttributeTokens().size(); } void SmXMLUnderContext_Impl::HandleAccent() @@ -1735,9 +1723,9 @@ public: void SmXMLOverContext_Impl::startFastElement(sal_Int32 /*nElement*/, const uno::Reference< xml::sax::XFastAttributeList > & xAttrList ) { - sax_fastparser::FastAttributeList *pAttribList = - sax_fastparser::FastAttributeList::castToFastAttributeList( xAttrList ); - nAttrCount = pAttribList->getFastAttributeTokens().size(); + sax_fastparser::FastAttributeList& rAttribList = + sax_fastparser::castToFastAttributeList( xAttrList ); + nAttrCount = rAttribList.getFastAttributeTokens().size(); } @@ -2559,9 +2547,7 @@ void SmXMLMultiScriptsContext_Impl::endFastElement(sal_Int32 ) void SmXMLActionContext_Impl::startFastElement(sal_Int32 /*nElement*/, const uno::Reference<xml::sax::XFastAttributeList> & xAttrList) { - sax_fastparser::FastAttributeList *pAttribList = - sax_fastparser::FastAttributeList::castToFastAttributeList( xAttrList ); - for (auto &aIter : *pAttribList) + for (auto &aIter : sax_fastparser::castToFastAttributeList( xAttrList )) { OUString sValue = aIter.toString(); switch(aIter.getToken()) |