summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--include/sax/fastattribs.hxx17
-rw-r--r--sc/source/filter/xml/xmlbodyi.cxx7
-rw-r--r--sc/source/filter/xml/xmlcelli.cxx7
-rw-r--r--sc/source/filter/xml/xmlexternaltabi.cxx6
-rw-r--r--sc/source/filter/xml/xmlrowi.cxx7
-rw-r--r--sc/source/filter/xml/xmltabi.cxx7
-rw-r--r--xmloff/source/core/xmlictxt.cxx14
7 files changed, 31 insertions, 34 deletions
diff --git a/include/sax/fastattribs.hxx b/include/sax/fastattribs.hxx
index 958899015372..70ddc4c8bb85 100644
--- a/include/sax/fastattribs.hxx
+++ b/include/sax/fastattribs.hxx
@@ -123,22 +123,27 @@ public:
return mnIdx != rhs.mnIdx;
}
- sal_Int32 getToken()
+ const FastAttributeIter& operator*() const
+ {
+ return *this;
+ }
+
+ sal_Int32 getToken() const
{
assert(mnIdx < mrList.maAttributeTokens.size());
return mrList.maAttributeTokens[mnIdx];
}
- bool isEmpty()
+ bool isEmpty() const
{
assert(mnIdx < mrList.maAttributeTokens.size());
return mrList.AttributeValueLength(mnIdx) < 1;
}
- sal_Int32 toInt32()
+ sal_Int32 toInt32() const
{
assert(mnIdx < mrList.maAttributeTokens.size());
return rtl_str_toInt32(mrList.getFastAttributeValue(mnIdx), 10);
}
- OUString toString()
+ OUString toString() const
{
assert(mnIdx < mrList.maAttributeTokens.size());
return OUString(mrList.getFastAttributeValue(mnIdx),
@@ -146,12 +151,12 @@ public:
RTL_TEXTENCODING_UTF8);
}
- const char* toCString()
+ const char* toCString() const
{
assert(mnIdx < mrList.maAttributeTokens.size());
return mrList.getFastAttributeValue(mnIdx);
}
- bool isString(const char *str)
+ bool isString(const char *str) const
{
assert(mnIdx < mrList.maAttributeTokens.size());
return !strcmp(str, mrList.getFastAttributeValue(mnIdx));
diff --git a/sc/source/filter/xml/xmlbodyi.cxx b/sc/source/filter/xml/xmlbodyi.cxx
index 2a21d52899f9..4aec839b76e7 100644
--- a/sc/source/filter/xml/xmlbodyi.cxx
+++ b/sc/source/filter/xml/xmlbodyi.cxx
@@ -92,11 +92,10 @@ ScXMLBodyContext::ScXMLBodyContext( ScXMLImport& rImport,
if( !xAttrList.is() )
return;
- sax_fastparser::FastAttributeList *pAttribList;
- assert( dynamic_cast< sax_fastparser::FastAttributeList *>( xAttrList.get() ) != nullptr );
- pAttribList = static_cast< sax_fastparser::FastAttributeList *>( xAttrList.get() );
+ sax_fastparser::FastAttributeList *pAttribList =
+ static_cast< sax_fastparser::FastAttributeList *>( xAttrList.get() );
- for ( auto it = pAttribList->begin(); it != pAttribList->end(); ++it)
+ for( auto &it : *pAttribList )
{
sal_Int32 nToken = it.getToken();
if( NAMESPACE_TOKEN( XML_NAMESPACE_TABLE ) == ( nToken & NMSP_MASK ) )
diff --git a/sc/source/filter/xml/xmlcelli.cxx b/sc/source/filter/xml/xmlcelli.cxx
index 0de5664fcba2..d7e9f3107b75 100644
--- a/sc/source/filter/xml/xmlcelli.cxx
+++ b/sc/source/filter/xml/xmlcelli.cxx
@@ -159,11 +159,10 @@ ScXMLTableRowCellContext::ScXMLTableRowCellContext( ScXMLImport& rImport,
std::unique_ptr<OUString> xCurrencySymbol;
if( xAttrList.is() )
{
- sax_fastparser::FastAttributeList *pAttribList;
- assert( dynamic_cast< sax_fastparser::FastAttributeList *>( xAttrList.get() ) != nullptr );
- pAttribList = static_cast< sax_fastparser::FastAttributeList *>( xAttrList.get() );
+ sax_fastparser::FastAttributeList *pAttribList =
+ static_cast< sax_fastparser::FastAttributeList *>( xAttrList.get() );
- for ( auto it = pAttribList->begin(); it != pAttribList->end(); ++it)
+ for( auto &it : *pAttribList )
{
switch ( it.getToken() )
{
diff --git a/sc/source/filter/xml/xmlexternaltabi.cxx b/sc/source/filter/xml/xmlexternaltabi.cxx
index e8c0ef5db247..e6edaa66461b 100644
--- a/sc/source/filter/xml/xmlexternaltabi.cxx
+++ b/sc/source/filter/xml/xmlexternaltabi.cxx
@@ -54,7 +54,7 @@ ScXMLExternalRefTabSourceContext::ScXMLExternalRefTabSourceContext(
{
sax_fastparser::FastAttributeList *pAttribList = static_cast< sax_fastparser::FastAttributeList *>( xAttrList.get() );
- for ( auto it = pAttribList->begin(); it != pAttribList->end(); ++it)
+ for( auto &it : *pAttribList )
{
sal_Int32 nAttrToken = it.getToken();
if ( nAttrToken == XML_ELEMENT( XLINK, XML_HREF ) )
@@ -169,7 +169,7 @@ ScXMLExternalRefRowContext::ScXMLExternalRefRowContext(
{
sax_fastparser::FastAttributeList *pAttribList = static_cast< sax_fastparser::FastAttributeList *>( xAttrList.get() );
- for ( auto it = pAttribList->begin(); it != pAttribList->end(); ++it)
+ for( auto &it : *pAttribList )
{
switch ( rAttrTokenMap.Get( it.getToken() ) )
{
@@ -248,7 +248,7 @@ ScXMLExternalRefCellContext::ScXMLExternalRefCellContext(
{
sax_fastparser::FastAttributeList *pAttribList = static_cast< sax_fastparser::FastAttributeList *>( xAttrList.get() );
- for ( auto it = pAttribList->begin(); it != pAttribList->end(); ++it)
+ for( auto &it : *pAttribList )
{
switch ( rTokenMap.Get( it.getToken() ) )
{
diff --git a/sc/source/filter/xml/xmlrowi.cxx b/sc/source/filter/xml/xmlrowi.cxx
index d2ce385edaf9..ab5fdf5eefa2 100644
--- a/sc/source/filter/xml/xmlrowi.cxx
+++ b/sc/source/filter/xml/xmlrowi.cxx
@@ -53,11 +53,10 @@ ScXMLTableRowContext::ScXMLTableRowContext( ScXMLImport& rImport,
OUString sCellStyleName;
if ( xAttrList.is() )
{
- sax_fastparser::FastAttributeList *pAttribList;
- assert( dynamic_cast< sax_fastparser::FastAttributeList *>( xAttrList.get() ) != nullptr );
- pAttribList = static_cast< sax_fastparser::FastAttributeList *>( xAttrList.get() );
+ sax_fastparser::FastAttributeList *pAttribList =
+ static_cast< sax_fastparser::FastAttributeList *>( xAttrList.get() );
- for ( auto it = pAttribList->begin(); it != pAttribList->end(); ++it)
+ for( auto &it : *pAttribList )
{
switch( it.getToken() )
{
diff --git a/sc/source/filter/xml/xmltabi.cxx b/sc/source/filter/xml/xmltabi.cxx
index 6958a6a6c4c9..0567a1a4521c 100644
--- a/sc/source/filter/xml/xmltabi.cxx
+++ b/sc/source/filter/xml/xmltabi.cxx
@@ -146,11 +146,10 @@ ScXMLTableContext::ScXMLTableContext( ScXMLImport& rImport,
if ( xAttrList.is() )
{
- sax_fastparser::FastAttributeList *pAttribList;
- assert( dynamic_cast< sax_fastparser::FastAttributeList *>( xAttrList.get() ) != nullptr );
- pAttribList = static_cast< sax_fastparser::FastAttributeList *>( xAttrList.get() );
+ sax_fastparser::FastAttributeList *pAttribList =
+ static_cast< sax_fastparser::FastAttributeList *>( xAttrList.get() );
- for ( auto it = pAttribList->begin(); it != pAttribList->end(); ++it)
+ for( auto &it : *pAttribList )
{
switch( it.getToken() )
{
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();