summaryrefslogtreecommitdiff
path: root/xmloff
diff options
context:
space:
mode:
authorNoel Grandin <noel.grandin@collabora.co.uk>2020-04-28 12:29:17 +0200
committerNoel Grandin <noel.grandin@collabora.co.uk>2020-04-28 13:25:27 +0200
commit1705fbe9daac56ee9bea8d8fd7c7f57e2bec49b5 (patch)
treeaaf39244173a4cf20df6568140ebdbe5ec055656 /xmloff
parentdfa8e18e8e6c7ad87e423393f8293a20188de1fd (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 'xmloff')
-rw-r--r--xmloff/source/core/DocumentSettingsContext.cxx12
-rw-r--r--xmloff/source/core/xmlictxt.cxx5
-rw-r--r--xmloff/source/core/xmlimp.cxx8
-rw-r--r--xmloff/source/draw/animationimport.cxx8
-rw-r--r--xmloff/source/draw/animimp.cxx8
-rw-r--r--xmloff/source/draw/ximpbody.cxx4
-rw-r--r--xmloff/source/draw/ximpnote.cxx4
-rw-r--r--xmloff/source/draw/ximppage.cxx8
-rw-r--r--xmloff/source/draw/ximpshow.cxx8
-rw-r--r--xmloff/source/draw/ximpstyl.cxx4
-rw-r--r--xmloff/source/meta/xmlversion.cxx8
-rw-r--r--xmloff/source/script/XMLEventsImportContext.cxx4
-rw-r--r--xmloff/source/text/XMLSectionSourceDDEImportContext.cxx5
-rw-r--r--xmloff/source/text/txtparai.cxx4
14 files changed, 26 insertions, 64 deletions
diff --git a/xmloff/source/core/DocumentSettingsContext.cxx b/xmloff/source/core/DocumentSettingsContext.cxx
index d0e6937f767d..0a114ab0d87d 100644
--- a/xmloff/source/core/DocumentSettingsContext.cxx
+++ b/xmloff/source/core/DocumentSettingsContext.cxx
@@ -217,9 +217,7 @@ static SvXMLImportContext *CreateSettingsContext(SvXMLImport& rImport, sal_Int32
SvXMLImportContext *pContext = nullptr;
rProp.Name.clear();
- sax_fastparser::FastAttributeList *pAttribList =
- sax_fastparser::FastAttributeList::castToFastAttributeList( xAttrList );
- for (auto &aIter : *pAttribList)
+ for (auto &aIter : sax_fastparser::castToFastAttributeList( xAttrList ))
{
if (aIter.getToken() == XML_ELEMENT(CONFIG, XML_NAME))
rProp.Name = aIter.toString();
@@ -255,9 +253,7 @@ css::uno::Reference< css::xml::sax::XFastContextHandler > XMLDocumentSettingsCo
SvXMLImportContext *pContext = nullptr;
OUString sName;
- sax_fastparser::FastAttributeList *pAttribList =
- sax_fastparser::FastAttributeList::castToFastAttributeList( xAttrList );
- for (auto &aIter : *pAttribList)
+ for (auto &aIter : sax_fastparser::castToFastAttributeList( xAttrList ))
{
if (aIter.getToken() == XML_ELEMENT(CONFIG, XML_NAME))
sName = aIter.toString();
@@ -400,9 +396,7 @@ XMLConfigItemContext::XMLConfigItemContext(SvXMLImport& rImport,
mrItemName(rTempItemName),
mpBaseContext(pTempBaseContext)
{
- sax_fastparser::FastAttributeList *pAttribList =
- sax_fastparser::FastAttributeList::castToFastAttributeList( xAttrList );
- for (auto &aIter : *pAttribList)
+ for (auto &aIter : sax_fastparser::castToFastAttributeList( xAttrList ))
{
if (aIter.getToken() == XML_ELEMENT(CONFIG, XML_TYPE))
msType = aIter.toString();
diff --git a/xmloff/source/core/xmlictxt.cxx b/xmloff/source/core/xmlictxt.cxx
index c80158d02c96..e24ee7bcc041 100644
--- a/xmloff/source/core/xmlictxt.cxx
+++ b/xmloff/source/core/xmlictxt.cxx
@@ -88,10 +88,7 @@ void SAL_CALL SvXMLImportContext::startUnknownElement(const OUString & /*rNamesp
if ( Attribs.is() )
{
- sax_fastparser::FastAttributeList *pAttribList =
- sax_fastparser::FastAttributeList::castToFastAttributeList( Attribs );
-
- for( auto &it : *pAttribList )
+ for( auto &it : sax_fastparser::castToFastAttributeList( Attribs ) )
{
sal_Int32 nToken = it.getToken();
const OUString& rAttrNamespacePrefix = SvXMLImport::getNamespacePrefixFromToken(nToken, &GetImport().GetNamespaceMap());
diff --git a/xmloff/source/core/xmlimp.cxx b/xmloff/source/core/xmlimp.cxx
index 8cee683d86e5..cc515c645a23 100644
--- a/xmloff/source/core/xmlimp.cxx
+++ b/xmloff/source/core/xmlimp.cxx
@@ -838,10 +838,10 @@ void SAL_CALL SvXMLImport::startFastElement (sal_Int32 Element,
{
if ( Attribs.is() )
{
- sax_fastparser::FastAttributeList *pAttribList =
- sax_fastparser::FastAttributeList::castToFastAttributeList( Attribs );
- auto aIter( pAttribList->find( XML_ELEMENT( OFFICE, XML_VERSION ) ) );
- if( aIter != pAttribList->end() )
+ sax_fastparser::FastAttributeList& rAttribList =
+ sax_fastparser::castToFastAttributeList( Attribs );
+ auto aIter( rAttribList.find( XML_ELEMENT( OFFICE, XML_VERSION ) ) );
+ if( aIter != rAttribList.end() )
{
mpImpl->aODFVersion = aIter.toString();
diff --git a/xmloff/source/draw/animationimport.cxx b/xmloff/source/draw/animationimport.cxx
index 5ef266dce6af..cfbfee630261 100644
--- a/xmloff/source/draw/animationimport.cxx
+++ b/xmloff/source/draw/animationimport.cxx
@@ -472,9 +472,7 @@ AnimationNodeContext::AnimationNodeContext(
pServiceName = "com.sun.star.animations.Command"; break;
case XML_PAR:
{
- sax_fastparser::FastAttributeList *pAttribList =
- sax_fastparser::FastAttributeList::castToFastAttributeList( xAttrList );
- for (auto &aIter : *pAttribList)
+ for (auto &aIter : sax_fastparser::castToFastAttributeList( xAttrList ))
{
if( (aIter.getToken() & TOKEN_MASK) == XML_PRESET_ID)
{
@@ -561,9 +559,7 @@ void AnimationNodeContext::init_node( const css::uno::Reference< css::xml::sax:
OUString sXmlId;
sal_Int16 nEnum;
- sax_fastparser::FastAttributeList *pAttribList =
- sax_fastparser::FastAttributeList::castToFastAttributeList( xAttrList );
- for (auto &aIter : *pAttribList)
+ for (auto &aIter : sax_fastparser::castToFastAttributeList( xAttrList ))
{
OUString rValue = aIter.toString();
switch( aIter.getToken() )
diff --git a/xmloff/source/draw/animimp.cxx b/xmloff/source/draw/animimp.cxx
index 3e7a2eeed8c4..3ec2abca723f 100644
--- a/xmloff/source/draw/animimp.cxx
+++ b/xmloff/source/draw/animimp.cxx
@@ -395,9 +395,7 @@ XMLAnimationsSoundContext::XMLAnimationsSoundContext( SvXMLImport& rImport, sal_
if( !pParent || nElement != XML_ELEMENT(PRESENTATION, XML_SOUND) )
return;
- 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() )
@@ -452,9 +450,7 @@ XMLAnimationsEffectContext::XMLAnimationsEffectContext( SvXMLImport& rImport,
return;
}
- 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() )
diff --git a/xmloff/source/draw/ximpbody.cxx b/xmloff/source/draw/ximpbody.cxx
index 7f73a203124f..3f9e740221ed 100644
--- a/xmloff/source/draw/ximpbody.cxx
+++ b/xmloff/source/draw/ximpbody.cxx
@@ -48,9 +48,7 @@ SdXMLDrawPageContext::SdXMLDrawPageContext( SdXMLImport& rImport,
bool bHaveXmlId( false );
OUString sXmlId, sStyleName, sContextName, sMasterPageName, sHREF;
- 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())
diff --git a/xmloff/source/draw/ximpnote.cxx b/xmloff/source/draw/ximpnote.cxx
index 8c2aba66fdd5..5f06a6132f31 100644
--- a/xmloff/source/draw/ximpnote.cxx
+++ b/xmloff/source/draw/ximpnote.cxx
@@ -30,9 +30,7 @@ SdXMLNotesContext::SdXMLNotesContext( SdXMLImport& rImport,
{
OUString sStyleName, sPageMasterName;
- 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())
diff --git a/xmloff/source/draw/ximppage.cxx b/xmloff/source/draw/ximppage.cxx
index 0d86c861964e..23a89e943f2d 100644
--- a/xmloff/source/draw/ximppage.cxx
+++ b/xmloff/source/draw/ximppage.cxx
@@ -92,9 +92,7 @@ DrawAnnotationContext::DrawAnnotationContext( SvXMLImport& rImport, const Refere
RealPoint2D aPosition;
RealSize2D aSize;
- sax_fastparser::FastAttributeList *pAttribList =
- sax_fastparser::FastAttributeList::castToFastAttributeList( xAttrList );
- for (auto &aIter : *pAttribList)
+ for (auto &aIter : sax_fastparser::castToFastAttributeList( xAttrList ))
{
OUString sValue = aIter.toString();
@@ -247,9 +245,7 @@ SdXMLGenericPageContext::SdXMLGenericPageContext(
, mxShapes( rShapes )
, mxAnnotationAccess( rShapes, UNO_QUERY )
{
- sax_fastparser::FastAttributeList *pAttribList =
- sax_fastparser::FastAttributeList::castToFastAttributeList( xAttrList );
- for (auto &aIter : *pAttribList)
+ for (auto &aIter : sax_fastparser::castToFastAttributeList( xAttrList ))
{
if( aIter.getToken() == XML_ELEMENT(DRAW, XML_NAV_ORDER) )
{
diff --git a/xmloff/source/draw/ximpshow.cxx b/xmloff/source/draw/ximpshow.cxx
index 26c98a8a7b4c..29da608f20fc 100644
--- a/xmloff/source/draw/ximpshow.cxx
+++ b/xmloff/source/draw/ximpshow.cxx
@@ -89,9 +89,7 @@ SdXMLShowsContext::SdXMLShowsContext( SdXMLImport& rImport, const Reference< XFa
bIsMouseVisible = false;
// read attributes
- sax_fastparser::FastAttributeList *pAttribList =
- sax_fastparser::FastAttributeList::castToFastAttributeList( xAttrList );
- for (auto &aIter : *pAttribList)
+ for (auto &aIter : sax_fastparser::castToFastAttributeList( xAttrList ))
{
OUString sValue = aIter.toString();
@@ -206,9 +204,7 @@ css::uno::Reference< css::xml::sax::XFastContextHandler > SdXMLShowsContext::cre
OUString aPages;
// read attributes
- sax_fastparser::FastAttributeList *pAttribList =
- sax_fastparser::FastAttributeList::castToFastAttributeList( xAttrList );
- for (auto &aIter : *pAttribList)
+ for (auto &aIter : sax_fastparser::castToFastAttributeList( xAttrList ))
{
OUString sValue = aIter.toString();
diff --git a/xmloff/source/draw/ximpstyl.cxx b/xmloff/source/draw/ximpstyl.cxx
index 4666e897e816..e43639752d70 100644
--- a/xmloff/source/draw/ximpstyl.cxx
+++ b/xmloff/source/draw/ximpstyl.cxx
@@ -725,9 +725,7 @@ SdXMLMasterPageContext::SdXMLMasterPageContext(
const bool bHandoutMaster = (nElement & TOKEN_MASK) == XML_HANDOUT_MASTER;
OUString sStyleName, sPageMasterName;
- sax_fastparser::FastAttributeList *pAttribList =
- sax_fastparser::FastAttributeList::castToFastAttributeList( xAttrList );
- for (auto &aIter : *pAttribList)
+ for (auto &aIter : sax_fastparser::castToFastAttributeList( xAttrList ))
{
const OUString sValue = aIter.toString();
switch(aIter.getToken())
diff --git a/xmloff/source/meta/xmlversion.cxx b/xmloff/source/meta/xmlversion.cxx
index b1c7f001da4f..df81f7d836c1 100644
--- a/xmloff/source/meta/xmlversion.cxx
+++ b/xmloff/source/meta/xmlversion.cxx
@@ -151,12 +151,12 @@ XMLVersionContext::XMLVersionContext( XMLVersionListImport& rImport,
const Reference< XFastAttributeList > & xAttrList )
: SvXMLImportContext( rImport )
{
- sax_fastparser::FastAttributeList *pAttribList =
- sax_fastparser::FastAttributeList::castToFastAttributeList( xAttrList );
- if ( pAttribList->getFastAttributeTokens().empty() )
+ sax_fastparser::FastAttributeList& rAttribList =
+ sax_fastparser::castToFastAttributeList( xAttrList );
+ if ( rAttribList.getFastAttributeTokens().empty() )
return;
util::RevisionTag aInfo;
- for (auto &aIter : *pAttribList)
+ for (auto &aIter : rAttribList)
{
switch( aIter.getToken() )
{
diff --git a/xmloff/source/script/XMLEventsImportContext.cxx b/xmloff/source/script/XMLEventsImportContext.cxx
index cb7679cc3b63..5960b5215e91 100644
--- a/xmloff/source/script/XMLEventsImportContext.cxx
+++ b/xmloff/source/script/XMLEventsImportContext.cxx
@@ -165,9 +165,7 @@ css::uno::Reference< css::xml::sax::XFastContextHandler > XMLEventsImportContext
// a) search for script:language and script:event-name attribute
OUString sLanguage;
OUString sEventName;
- sax_fastparser::FastAttributeList *pAttribList =
- sax_fastparser::FastAttributeList::castToFastAttributeList( xAttrList );
- for (auto &aIter : *pAttribList)
+ for (auto &aIter : sax_fastparser::castToFastAttributeList( xAttrList ))
{
OUString sValue = aIter.toString();
diff --git a/xmloff/source/text/XMLSectionSourceDDEImportContext.cxx b/xmloff/source/text/XMLSectionSourceDDEImportContext.cxx
index 34a5dedc4ac0..88348476cf2a 100644
--- a/xmloff/source/text/XMLSectionSourceDDEImportContext.cxx
+++ b/xmloff/source/text/XMLSectionSourceDDEImportContext.cxx
@@ -61,10 +61,7 @@ void XMLSectionSourceDDEImportContext::startFastElement(sal_Int32 /*nElement*/,
OUString sItem;
bool bAutomaticUpdate = false;
- sax_fastparser::FastAttributeList *pAttribList =
- sax_fastparser::FastAttributeList::castToFastAttributeList( xAttrList );
-
- for (auto &aIter : *pAttribList)
+ for (auto &aIter : sax_fastparser::castToFastAttributeList( xAttrList ))
{
switch (aIter.getToken())
{
diff --git a/xmloff/source/text/txtparai.cxx b/xmloff/source/text/txtparai.cxx
index 2de0e5d66a1b..5e05107684cc 100644
--- a/xmloff/source/text/txtparai.cxx
+++ b/xmloff/source/text/txtparai.cxx
@@ -155,9 +155,7 @@ XMLCharContext::XMLCharContext(
{
if( bCount )
{
- sax_fastparser::FastAttributeList *pAttribList =
- sax_fastparser::FastAttributeList::castToFastAttributeList( xAttrList );
- for (auto &aIter : *pAttribList)
+ for (auto &aIter : sax_fastparser::castToFastAttributeList( xAttrList ))
{
if( aIter.getToken() == XML_ELEMENT(TEXT, XML_C) )
{