diff options
author | Mohammed Abdul Azeem <azeemmysore@gmail.com> | 2017-06-28 21:45:39 +0530 |
---|---|---|
committer | Mohammed Abdul Azeem <azeemmysore@gmail.com> | 2017-06-29 06:03:38 +0200 |
commit | d6da9e495d7ca32de6cda1a94cb4c8cd26b240cc (patch) | |
tree | c630017cf61a93395e534e80bccb483e7baccb84 /xmloff/source | |
parent | 803a17533f25d9174c6a19aa913a6713980c193d (diff) |
Using range-for instead of iterator loop:
It's much easier to write and looks cleaner. And
this doesn't affect performance, I think.
Change-Id: Ia946b068979b9cef04ac2479c9179a70b6775dea
Reviewed-on: https://gerrit.libreoffice.org/39370
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Mohammed Abdul Azeem <azeemmysore@gmail.com>
Diffstat (limited to 'xmloff/source')
-rw-r--r-- | xmloff/source/core/xmlictxt.cxx | 14 |
1 files changed, 5 insertions, 9 deletions
diff --git a/xmloff/source/core/xmlictxt.cxx b/xmloff/source/core/xmlictxt.cxx index d863a1e91ea6..920e2981f02e 100644 --- a/xmloff/source/core/xmlictxt.cxx +++ b/xmloff/source/core/xmlictxt.cxx @@ -93,22 +93,18 @@ void SAL_CALL SvXMLImportContext::startUnknownElement(const OUString & rPrefix, if ( Attribs.is() ) { - sax_fastparser::FastAttributeList *pAttribList; - assert( dynamic_cast< sax_fastparser::FastAttributeList *>( Attribs.get() ) != nullptr ); - pAttribList = static_cast< sax_fastparser::FastAttributeList *>( Attribs.get() ); + sax_fastparser::FastAttributeList *pAttribList = + static_cast< sax_fastparser::FastAttributeList *>( Attribs.get() ); - const std::vector< sal_Int32 >& rAttrTokenList = pAttribList->getFastAttributeTokens(); - for ( size_t i = 0; i < rAttrTokenList.size(); i++ ) + for( auto &it : *pAttribList ) { - const OUString& rAttrValue = OUString(pAttribList->getFastAttributeValue(i), - pAttribList->AttributeValueLength(i), RTL_TEXTENCODING_UTF8); - sal_Int32 nToken = rAttrTokenList[ i ]; + sal_Int32 nToken = it.getToken(); const OUString& rAttrNamespacePrefix = SvXMLImport::getNamespacePrefixFromToken( nToken ); OUString sAttrName = SvXMLImport::getNameFromToken( nToken ); if ( !rAttrNamespacePrefix.isEmpty() ) sAttrName = rAttrNamespacePrefix + ":" + sAttrName; - mrImport.maAttrList->AddAttribute( sAttrName, "CDATA", rAttrValue ); + mrImport.maAttrList->AddAttribute( sAttrName, "CDATA", it.toString() ); } uno::Sequence< xml::Attribute > unknownAttribs = Attribs->getUnknownAttributes(); |