diff options
author | Noel <noel.grandin@collabora.co.uk> | 2020-12-21 09:39:48 +0200 |
---|---|---|
committer | Noel Grandin <noel.grandin@collabora.co.uk> | 2020-12-21 11:34:17 +0100 |
commit | 917338c6a81fa5c793d7e4c14f2f031219e64b84 (patch) | |
tree | 7a14dbc0570d2f76084fe11af62c8bb2d1c5dfb1 /xmloff | |
parent | 39ef79abd0b598cc010261aa6d1eaeabd8a52e95 (diff) |
use std::u16string_view in SvXMLTokenEnumerator
Change-Id: I1194441063047637adc20c8e37bb717fdb787714
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/108073
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'xmloff')
-rw-r--r-- | xmloff/inc/txtflde.hxx | 2 | ||||
-rw-r--r-- | xmloff/source/core/xmluconv.cxx | 20 | ||||
-rw-r--r-- | xmloff/source/draw/ximppage.cxx | 4 | ||||
-rw-r--r-- | xmloff/source/draw/ximpshap.cxx | 2 | ||||
-rw-r--r-- | xmloff/source/draw/ximpshow.cxx | 5 | ||||
-rw-r--r-- | xmloff/source/forms/controlpropertyhdl.cxx | 6 | ||||
-rw-r--r-- | xmloff/source/style/XMLBackgroundImageContext.cxx | 4 | ||||
-rw-r--r-- | xmloff/source/style/XMLBitmapRepeatOffsetPropertyHandler.cxx | 2 | ||||
-rw-r--r-- | xmloff/source/style/XMLClipPropertyHandler.cxx | 4 | ||||
-rw-r--r-- | xmloff/source/style/backhdl.cxx | 4 | ||||
-rw-r--r-- | xmloff/source/style/bordrhdl.cxx | 6 | ||||
-rw-r--r-- | xmloff/source/style/escphdl.cxx | 4 | ||||
-rw-r--r-- | xmloff/source/style/shadwhdl.cxx | 4 | ||||
-rw-r--r-- | xmloff/source/text/XMLRedlineExport.cxx | 8 | ||||
-rw-r--r-- | xmloff/source/text/XMLRedlineExport.hxx | 2 | ||||
-rw-r--r-- | xmloff/source/text/txtflde.cxx | 6 | ||||
-rw-r--r-- | xmloff/source/text/txtprhdl.cxx | 6 | ||||
-rw-r--r-- | xmloff/source/transform/StyleOASISTContext.cxx | 2 | ||||
-rw-r--r-- | xmloff/source/transform/StyleOOoTContext.cxx | 2 |
19 files changed, 47 insertions, 46 deletions
diff --git a/xmloff/inc/txtflde.hxx b/xmloff/inc/txtflde.hxx index bf8545b77b60..81efbde29629 100644 --- a/xmloff/inc/txtflde.hxx +++ b/xmloff/inc/txtflde.hxx @@ -298,7 +298,7 @@ private: /// export a string as a sequence of paragraphs void ProcessParagraphSequence( /// string containing the paragraphs - const OUString& sParagraphSequence); + std::u16string_view sParagraphSequence); /// export a numbering format (numeric, roman, alphabetic, etc.) void ProcessNumberingType( diff --git a/xmloff/source/core/xmluconv.cxx b/xmloff/source/core/xmluconv.cxx index 8c137e131427..1517c7b8df86 100644 --- a/xmloff/source/core/xmluconv.cxx +++ b/xmloff/source/core/xmluconv.cxx @@ -473,32 +473,32 @@ bool SvXMLUnitConverter::convertDateTime( double& fDateTime, } -SvXMLTokenEnumerator::SvXMLTokenEnumerator( const OUString& rString, sal_Unicode cSeparator /* = ' ' */ ) +SvXMLTokenEnumerator::SvXMLTokenEnumerator( std::u16string_view rString, sal_Unicode cSeparator /* = ' ' */ ) : maTokenString( rString ), mnNextTokenPos(0), mcSeparator( cSeparator ) { } -bool SvXMLTokenEnumerator::getNextToken( OUString& rToken ) +bool SvXMLTokenEnumerator::getNextToken( std::u16string_view& rToken ) { - if( -1 == mnNextTokenPos ) + if( std::u16string_view::npos == mnNextTokenPos ) return false; - int nTokenEndPos = maTokenString.indexOf( mcSeparator, mnNextTokenPos ); - if( nTokenEndPos != -1 ) + size_t nTokenEndPos = maTokenString.find( mcSeparator, mnNextTokenPos ); + if( nTokenEndPos != std::u16string_view::npos ) { - rToken = maTokenString.copy( mnNextTokenPos, + rToken = maTokenString.substr( mnNextTokenPos, nTokenEndPos - mnNextTokenPos ); mnNextTokenPos = nTokenEndPos + 1; // if the mnNextTokenPos is at the end of the string, we have // to deliver an empty token - if( mnNextTokenPos > maTokenString.getLength() ) - mnNextTokenPos = -1; + if( mnNextTokenPos > maTokenString.size() ) + mnNextTokenPos = std::u16string_view::npos; } else { - rToken = maTokenString.copy( mnNextTokenPos ); - mnNextTokenPos = -1; + rToken = maTokenString.substr( mnNextTokenPos ); + mnNextTokenPos = std::u16string_view::npos; } return true; diff --git a/xmloff/source/draw/ximppage.cxx b/xmloff/source/draw/ximppage.cxx index 2ddd5140545f..be6732d5fe96 100644 --- a/xmloff/source/draw/ximppage.cxx +++ b/xmloff/source/draw/ximppage.cxx @@ -568,13 +568,13 @@ void SdXMLGenericPageContext::SetNavigationOrder() ::comphelper::UnoInterfaceToUniqueIdentifierMapper& rIdMapper = GetSdImport().getInterfaceToIdentifierMapper(); SvXMLTokenEnumerator aEnumerator( msNavOrder ); - OUString sId; + std::u16string_view sId; for( nIndex = 0; nIndex < nCount; ++nIndex ) { if( !aEnumerator.getNextToken(sId) ) break; - aShapes[nIndex].set( rIdMapper.getReference( sId ), UNO_QUERY ); + aShapes[nIndex].set( rIdMapper.getReference( OUString(sId) ), UNO_QUERY ); } for( nIndex = 0; nIndex < nCount; ++nIndex ) diff --git a/xmloff/source/draw/ximpshap.cxx b/xmloff/source/draw/ximpshap.cxx index cb28c4735415..b7be9280177c 100644 --- a/xmloff/source/draw/ximpshap.cxx +++ b/xmloff/source/draw/ximpshap.cxx @@ -1751,7 +1751,7 @@ bool SdXMLConnectorShapeContext::processAttribute( const sax_fastparser::FastAtt { OUString sValue = aIter.toString(); SvXMLTokenEnumerator aTokenEnum( sValue ); - OUString aToken; + std::u16string_view aToken; if( aTokenEnum.getNextToken( aToken ) ) { GetImport().GetMM100UnitConverter().convertMeasureToCore( diff --git a/xmloff/source/draw/ximpshow.cxx b/xmloff/source/draw/ximpshow.cxx index 4fba11fd380a..a59b68ab0fd1 100644 --- a/xmloff/source/draw/ximpshow.cxx +++ b/xmloff/source/draw/ximpshow.cxx @@ -208,10 +208,11 @@ css::uno::Reference< css::xml::sax::XFastContextHandler > SdXMLShowsContext::cre if( xShow.is() ) { SvXMLTokenEnumerator aPageNames( aPages, ',' ); - OUString sPageName; + std::u16string_view sPageNameView; - while( aPageNames.getNextToken( sPageName ) ) + while( aPageNames.getNextToken( sPageNameView ) ) { + OUString sPageName(sPageNameView); if( !mxPages->hasByName( sPageName ) ) continue; diff --git a/xmloff/source/forms/controlpropertyhdl.cxx b/xmloff/source/forms/controlpropertyhdl.cxx index feced0594b5c..cb3badee22b7 100644 --- a/xmloff/source/forms/controlpropertyhdl.cxx +++ b/xmloff/source/forms/controlpropertyhdl.cxx @@ -149,7 +149,7 @@ namespace xmloff bool bBelow = false; bool bHasPos = false, bHasType = false; - OUString sToken; + std::u16string_view sToken; SvXMLTokenEnumerator aTokenEnum(_rStrImpValue); while (aTokenEnum.getNextToken(sToken)) { @@ -197,13 +197,13 @@ namespace xmloff bool OControlBorderHandler::importXML( const OUString& _rStrImpValue, Any& _rValue, const SvXMLUnitConverter& ) const { - OUString sToken; + std::u16string_view sToken; SvXMLTokenEnumerator aTokens(_rStrImpValue); sal_uInt16 nStyle = 1; while ( aTokens.getNextToken(sToken) // have a new token - && (!sToken.isEmpty()) // really have a new token + && (!sToken.empty()) // really have a new token ) { // try interpreting the token as border style diff --git a/xmloff/source/style/XMLBackgroundImageContext.cxx b/xmloff/source/style/XMLBackgroundImageContext.cxx index a32bdde772f1..cd500672c6fc 100644 --- a/xmloff/source/style/XMLBackgroundImageContext.cxx +++ b/xmloff/source/style/XMLBackgroundImageContext.cxx @@ -161,7 +161,7 @@ void XMLBackgroundImageContext::ProcessAttrs( GraphicLocation eNewPos = GraphicLocation_NONE, eTmp; OUString sValue = aIter.toString(); SvXMLTokenEnumerator aTokenEnum( sValue ); - OUString aToken; + std::u16string_view aToken; bool bHori = false, bVert = false; bool bOK = true; while( bOK && aTokenEnum.getNextToken( aToken ) ) @@ -171,7 +171,7 @@ void XMLBackgroundImageContext::ProcessAttrs( { bOK = false; } - else if( -1 != aToken.indexOf( '%' ) ) + else if( std::u16string_view::npos != aToken.find( '%' ) ) { sal_Int32 nPrc = 50; if (::sax::Converter::convertPercent( nPrc, aToken )) diff --git a/xmloff/source/style/XMLBitmapRepeatOffsetPropertyHandler.cxx b/xmloff/source/style/XMLBitmapRepeatOffsetPropertyHandler.cxx index 9b8ad7c63f80..29e743dfa3f0 100644 --- a/xmloff/source/style/XMLBitmapRepeatOffsetPropertyHandler.cxx +++ b/xmloff/source/style/XMLBitmapRepeatOffsetPropertyHandler.cxx @@ -50,7 +50,7 @@ bool XMLBitmapRepeatOffsetPropertyHandler::importXML( const SvXMLUnitConverter& ) const { SvXMLTokenEnumerator aTokenEnum( rStrImpValue ); - OUString aToken; + std::u16string_view aToken; if( aTokenEnum.getNextToken( aToken ) ) { sal_Int32 nValue; diff --git a/xmloff/source/style/XMLClipPropertyHandler.cxx b/xmloff/source/style/XMLClipPropertyHandler.cxx index f577c70bbc79..4bfa563d2ade 100644 --- a/xmloff/source/style/XMLClipPropertyHandler.cxx +++ b/xmloff/source/style/XMLClipPropertyHandler.cxx @@ -73,7 +73,7 @@ bool XMLClipPropertyHandler::importXML( const OUString& rStrImpValue, uno::Any& SvXMLTokenEnumerator aTokenEnum( sTmp, bHasComma ? ',' : ' ' ); sal_uInt16 nPos = 0; - OUString aToken; + std::u16string_view aToken; while( aTokenEnum.getNextToken( aToken ) ) { sal_Int32 nVal = 0; @@ -84,7 +84,7 @@ bool XMLClipPropertyHandler::importXML( const OUString& rStrImpValue, uno::Any& // fdo#80009 such nonsense could be written via WW8 import fdo#77454 if (abs(nVal) > 400000) { - SAL_INFO("xmloff.style", "ignoring excessive clip " << aToken); + SAL_INFO("xmloff.style", "ignoring excessive clip " << OUString(aToken)); nVal = 0; } diff --git a/xmloff/source/style/backhdl.cxx b/xmloff/source/style/backhdl.cxx index 63c74306104a..4df7a2f6e527 100644 --- a/xmloff/source/style/backhdl.cxx +++ b/xmloff/source/style/backhdl.cxx @@ -57,7 +57,7 @@ bool XMLBackGraphicPositionPropHdl::importXML( const OUString& rStrImpValue, uno style::GraphicLocation ePos = style::GraphicLocation_NONE, eTmp; style::GraphicLocation nTmpGraphicLocation; SvXMLTokenEnumerator aTokenEnum( rStrImpValue ); - OUString aToken; + std::u16string_view aToken; bool bHori = false, bVert = false; while( bRet && aTokenEnum.getNextToken( aToken ) ) @@ -66,7 +66,7 @@ bool XMLBackGraphicPositionPropHdl::importXML( const OUString& rStrImpValue, uno { bRet = false; } - else if( -1 != aToken.indexOf( '%' ) ) + else if( std::u16string_view::npos != aToken.find( '%' ) ) { sal_Int32 nPrc = 50; if (::sax::Converter::convertPercent( nPrc, aToken )) diff --git a/xmloff/source/style/bordrhdl.cxx b/xmloff/source/style/bordrhdl.cxx index df587d44ce7b..4b3a7b666cd2 100644 --- a/xmloff/source/style/bordrhdl.cxx +++ b/xmloff/source/style/bordrhdl.cxx @@ -98,7 +98,7 @@ bool XMLBorderWidthHdl::importXML( const OUString& rStrImpValue, uno::Any& rValu sal_Int32 nInWidth, nDistance, nOutWidth; - OUString aToken; + std::u16string_view aToken; if( !aTokenEnum.getNextToken( aToken ) ) return false; @@ -177,7 +177,7 @@ XMLBorderHdl::~XMLBorderHdl() bool XMLBorderHdl::importXML( const OUString& rStrImpValue, uno::Any& rValue, const SvXMLUnitConverter& rUnitConverter ) const { - OUString aToken; + std::u16string_view aToken; SvXMLTokenEnumerator aTokens( rStrImpValue ); bool bHasStyle = false; @@ -190,7 +190,7 @@ bool XMLBorderHdl::importXML( const OUString& rStrImpValue, uno::Any& rValue, co sal_Int32 nColor = 0; sal_Int32 nTemp; - while( aTokens.getNextToken( aToken ) && !aToken.isEmpty() ) + while( aTokens.getNextToken( aToken ) && !aToken.empty() ) { if( !bHasWidth && SvXMLUnitConverter::convertEnum( nNamedWidth, aToken, diff --git a/xmloff/source/style/escphdl.cxx b/xmloff/source/style/escphdl.cxx index 5be03b9000ac..8148fb69a011 100644 --- a/xmloff/source/style/escphdl.cxx +++ b/xmloff/source/style/escphdl.cxx @@ -43,7 +43,7 @@ bool XMLEscapementPropHdl::importXML( const OUString& rStrImpValue, uno::Any& rV SvXMLTokenEnumerator aTokens( rStrImpValue ); - OUString aToken; + std::u16string_view aToken; if( ! aTokens.getNextToken( aToken ) ) return false; @@ -108,7 +108,7 @@ bool XMLEscapementHeightPropHdl::importXML( const OUString& rStrImpValue, uno::A SvXMLTokenEnumerator aTokens( rStrImpValue ); - OUString aToken; + std::u16string_view aToken; if( ! aTokens.getNextToken( aToken ) ) return false; diff --git a/xmloff/source/style/shadwhdl.cxx b/xmloff/source/style/shadwhdl.cxx index 2b02a40cb1c8..b0c9e49a5c14 100644 --- a/xmloff/source/style/shadwhdl.cxx +++ b/xmloff/source/style/shadwhdl.cxx @@ -50,7 +50,7 @@ bool XMLShadowPropHdl::importXML( const OUString& rStrImpValue, uno::Any& rValue bool bOffsetFound = false; SvXMLTokenEnumerator aTokenEnum( rStrImpValue ); Color aColor( 128,128, 128 ); - OUString aToken; + std::u16string_view aToken; while( aTokenEnum.getNextToken( aToken ) ) { @@ -60,7 +60,7 @@ bool XMLShadowPropHdl::importXML( const OUString& rStrImpValue, uno::Any& rValue bRet = true; break; } - else if( !bColorFound && aToken.startsWith("#") ) + else if( !bColorFound && aToken.substr(0,1) == u"#" ) { bRet = ::sax::Converter::convertColor( aColor, aToken ); if( !bRet ) diff --git a/xmloff/source/text/XMLRedlineExport.cxx b/xmloff/source/text/XMLRedlineExport.cxx index 966a0614a3f9..e309b1d86731 100644 --- a/xmloff/source/text/XMLRedlineExport.cxx +++ b/xmloff/source/text/XMLRedlineExport.cxx @@ -605,20 +605,20 @@ void XMLRedlineExport::ExportStartOrEndRedline( } } -void XMLRedlineExport::WriteComment(const OUString& rComment) +void XMLRedlineExport::WriteComment(std::u16string_view rComment) { - if (rComment.isEmpty()) + if (rComment.empty()) return; // iterate over all string-pieces separated by return (0x0a) and // put each inside a paragraph element. SvXMLTokenEnumerator aEnumerator(rComment, char(0x0a)); - OUString aSubString; + std::u16string_view aSubString; while (aEnumerator.getNextToken(aSubString)) { SvXMLElementExport aParagraph( rExport, XML_NAMESPACE_TEXT, XML_P, true, false); - rExport.Characters(aSubString); + rExport.Characters(OUString(aSubString)); } } diff --git a/xmloff/source/text/XMLRedlineExport.hxx b/xmloff/source/text/XMLRedlineExport.hxx index f67d124e8a17..5ab7230d7fde 100644 --- a/xmloff/source/text/XMLRedlineExport.hxx +++ b/xmloff/source/text/XMLRedlineExport.hxx @@ -158,7 +158,7 @@ private: const css::uno::Reference<css::beans::XPropertySet> & rPropSet); /// write a comment string as sequence of <text:p> elements - void WriteComment(const OUString& rComment); + void WriteComment(std::u16string_view rComment); }; #endif diff --git a/xmloff/source/text/txtflde.cxx b/xmloff/source/text/txtflde.cxx index 13d221672bff..47dfb71a0bd9 100644 --- a/xmloff/source/text/txtflde.cxx +++ b/xmloff/source/text/txtflde.cxx @@ -2535,17 +2535,17 @@ void XMLTextFieldExport::ProcessString( /// export a string as a sequence of paragraphs void XMLTextFieldExport::ProcessParagraphSequence( - const OUString& sParagraphSequence) + std::u16string_view sParagraphSequence) { // iterate over all string-pieces separated by return (0x0a) and // put each inside a paragraph element. SvXMLTokenEnumerator aEnumerator(sParagraphSequence, char(0x0a)); - OUString aSubString; + std::u16string_view aSubString; while (aEnumerator.getNextToken(aSubString)) { SvXMLElementExport aParagraph( GetExport(), XML_NAMESPACE_TEXT, XML_P, true, false); - GetExport().Characters(aSubString); + GetExport().Characters(OUString(aSubString)); } } diff --git a/xmloff/source/text/txtprhdl.cxx b/xmloff/source/text/txtprhdl.cxx index 0cca1a9489ee..addb880a1b3b 100644 --- a/xmloff/source/text/txtprhdl.cxx +++ b/xmloff/source/text/txtprhdl.cxx @@ -542,7 +542,7 @@ bool XMLFrameProtectPropHdl_Impl::importXML( { bRet = false; SvXMLTokenEnumerator aTokenEnum( rStrImpValue ); - OUString aToken; + std::u16string_view aToken; while( aTokenEnum.getNextToken( aToken ) ) { bRet = true; @@ -768,7 +768,7 @@ bool XMLGrfMirrorPropHdl_Impl::importXML( { bRet = false; SvXMLTokenEnumerator aTokenEnum( rStrImpValue ); - OUString aToken; + std::u16string_view aToken; while( aTokenEnum.getNextToken( aToken ) ) { bRet = true; @@ -860,7 +860,7 @@ bool XMLTextEmphasizePropHdl_Impl::importXML( sal_uInt16 nVal = FontEmphasis::NONE; bool bBelow = false; bool bHasPos = false, bHasType = false; - OUString aToken; + std::u16string_view aToken; SvXMLTokenEnumerator aTokenEnum( rStrImpValue ); while( aTokenEnum.getNextToken( aToken ) ) diff --git a/xmloff/source/transform/StyleOASISTContext.cxx b/xmloff/source/transform/StyleOASISTContext.cxx index d8afd425d767..4e708db44962 100644 --- a/xmloff/source/transform/StyleOASISTContext.cxx +++ b/xmloff/source/transform/StyleOASISTContext.cxx @@ -471,7 +471,7 @@ void XMLPropertiesTContext_Impl::StartElement( // Adapts attribute values (#i49139#) OUStringBuffer aNewAttrValue; SvXMLTokenEnumerator aTokenEnum( rAttrValue ); - OUString aToken; + std::u16string_view aToken; while( aTokenEnum.getNextToken( aToken ) ) { if ( !aNewAttrValue.isEmpty() ) diff --git a/xmloff/source/transform/StyleOOoTContext.cxx b/xmloff/source/transform/StyleOOoTContext.cxx index 735d365068ca..fd6d082822cd 100644 --- a/xmloff/source/transform/StyleOOoTContext.cxx +++ b/xmloff/source/transform/StyleOOoTContext.cxx @@ -877,7 +877,7 @@ void XMLPropertiesOOoTContext_Impl::StartElement( case XML_ATACTION_STYLE_MIRROR_OOO: // adapts style:mirror values { SvXMLTokenEnumerator aTokenEnum( sAttrValue ); - OUString aToken; + std::u16string_view aToken; while( aTokenEnum.getNextToken( aToken ) ) { if ( !aStyleMirrorAttrValue.isEmpty() ) |