summaryrefslogtreecommitdiff
path: root/xmloff
diff options
context:
space:
mode:
authorNoel <noel.grandin@collabora.co.uk>2020-12-18 08:57:20 +0200
committerNoel Grandin <noel.grandin@collabora.co.uk>2020-12-18 09:29:49 +0100
commit8e6ec5ebcc523a189238a90fd9237872d67085f9 (patch)
treebd1dba3f8c3a352f81d860cc6d811c1a323a49f1 /xmloff
parent976ceae533becc3978e7c3741eadc69af4484437 (diff)
use more string_view in IsXMLToken
Change-Id: Ib84e2e7db4b4e6e2486dd024d60057d9d42ff4b0 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/107932 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'xmloff')
-rw-r--r--xmloff/inc/XMLNumberStylesImport.hxx2
-rw-r--r--xmloff/source/chart/SchXMLTools.cxx2
-rw-r--r--xmloff/source/chart/SchXMLTools.hxx2
-rw-r--r--xmloff/source/chart/XMLSymbolTypePropertyHdl.cxx2
-rw-r--r--xmloff/source/core/xmltoken.cxx9
-rw-r--r--xmloff/source/core/xmluconv.cxx2
-rw-r--r--xmloff/source/draw/XMLNumberStyles.cxx2
-rw-r--r--xmloff/source/style/PageMasterPropHdl.cxx2
-rw-r--r--xmloff/source/style/xmlstyle.cxx2
-rw-r--r--xmloff/source/transform/FrameOASISTContext.cxx2
-rw-r--r--xmloff/source/transform/FrameOASISTContext.hxx2
-rw-r--r--xmloff/source/transform/StyleOASISTContext.cxx4
12 files changed, 18 insertions, 15 deletions
diff --git a/xmloff/inc/XMLNumberStylesImport.hxx b/xmloff/inc/XMLNumberStylesImport.hxx
index 88bbdf27892b..092c2410f9cd 100644
--- a/xmloff/inc/XMLNumberStylesImport.hxx
+++ b/xmloff/inc/XMLNumberStylesImport.hxx
@@ -41,7 +41,7 @@ class SdXMLNumberFormatImportContext final : public SvXMLNumFormatContext
bool compareStyle( const SdXMLFixedDataStyle* pStyle, sal_Int16& nIndex ) const;
- void add( OUString const & rNumberStyle, bool bLong, bool bTextual, bool bDecimal02, OUString const & rText );
+ void add( std::u16string_view rNumberStyle, bool bLong, bool bTextual, bool bDecimal02, OUString const & rText );
public:
diff --git a/xmloff/source/chart/SchXMLTools.cxx b/xmloff/source/chart/SchXMLTools.cxx
index f6c8e681a265..4f9a161b3273 100644
--- a/xmloff/source/chart/SchXMLTools.cxx
+++ b/xmloff/source/chart/SchXMLTools.cxx
@@ -195,7 +195,7 @@ OUString GetNewChartTypeName( const OUString & rOldChartTypeName )
}
OUString GetChartTypeByClassName(
- const OUString & rClassName, bool bUseOldNames )
+ std::u16string_view rClassName, bool bUseOldNames )
{
OUStringBuffer aResultBuffer;
bool bInternalType = false;
diff --git a/xmloff/source/chart/SchXMLTools.hxx b/xmloff/source/chart/SchXMLTools.hxx
index e2fc6cc9c308..6097707b7f78 100644
--- a/xmloff/source/chart/SchXMLTools.hxx
+++ b/xmloff/source/chart/SchXMLTools.hxx
@@ -70,7 +70,7 @@ namespace SchXMLTools
SchXMLChartTypeEnum GetChartTypeEnum( std::u16string_view rClassName );
OUString GetChartTypeByClassName(
- const OUString & rClassName, bool bUseOldNames );
+ std::u16string_view rClassName, bool bUseOldNames );
::xmloff::token::XMLTokenEnum getTokenByChartType(
const OUString & rChartTypeService, bool bUseOldNames );
diff --git a/xmloff/source/chart/XMLSymbolTypePropertyHdl.cxx b/xmloff/source/chart/XMLSymbolTypePropertyHdl.cxx
index 1eb374a41f1a..dd24c134052d 100644
--- a/xmloff/source/chart/XMLSymbolTypePropertyHdl.cxx
+++ b/xmloff/source/chart/XMLSymbolTypePropertyHdl.cxx
@@ -84,7 +84,7 @@ bool lcl_convertEnum(
bool lcl_convertEnum(
sal_Int32 & rEnum,
- const OUString & rValue,
+ std::u16string_view rValue,
const SvXMLSignedEnumMapEntry *pMap )
{
while( pMap->eToken != XML_TOKEN_INVALID )
diff --git a/xmloff/source/core/xmltoken.cxx b/xmloff/source/core/xmltoken.cxx
index efcd2d421e1a..cd3a85f469d5 100644
--- a/xmloff/source/core/xmltoken.cxx
+++ b/xmloff/source/core/xmltoken.cxx
@@ -3459,14 +3459,16 @@ namespace xmloff::token {
// does rString represent eToken?
bool IsXMLToken(
- const OUString& rString,
+ std::u16string_view rString,
enum XMLTokenEnum eToken )
{
assert(XML_TOKEN_INVALID < eToken);
assert(eToken < XML_TOKEN_END);
const XMLTokenEntry* pToken = &aTokenList[static_cast<sal_uInt16>(eToken)];
- return rString.equalsAsciiL( pToken->pChar, pToken->nLength );
+ return static_cast<sal_Int32>(rString.size()) == pToken->nLength &&
+ rtl_ustr_asciil_reverseEquals_WithLength(
+ rString.data(), pToken->pChar, pToken->nLength );
}
bool IsXMLToken(
@@ -3480,6 +3482,7 @@ namespace xmloff::token {
return aIter.isString( pToken->pChar );
}
+ // does aStr represent eToken?
bool IsXMLToken(
std::string_view aStr,
enum XMLTokenEnum eToken )
@@ -3488,7 +3491,7 @@ namespace xmloff::token {
assert(eToken < XML_TOKEN_END);
const XMLTokenEntry* pToken = &aTokenList[static_cast<sal_uInt16>(eToken)];
- return aStr == pToken->pChar;
+ return aStr == std::string_view(pToken->pChar, pToken->nLength);
}
}
diff --git a/xmloff/source/core/xmluconv.cxx b/xmloff/source/core/xmluconv.cxx
index b1143fd38cc1..48c94ed3a3fb 100644
--- a/xmloff/source/core/xmluconv.cxx
+++ b/xmloff/source/core/xmluconv.cxx
@@ -666,7 +666,7 @@ void SvXMLUnitConverter::convertPosition3D( OUStringBuffer &rBuffer,
bool SvXMLUnitConverter::convertNumFormat(
sal_Int16& rType,
const OUString& rNumFmt,
- const OUString& rNumLetterSync,
+ std::u16string_view rNumLetterSync,
bool bNumberNone ) const
{
bool bRet = true;
diff --git a/xmloff/source/draw/XMLNumberStyles.cxx b/xmloff/source/draw/XMLNumberStyles.cxx
index 3d4407d8a5df..33bafa2b4435 100644
--- a/xmloff/source/draw/XMLNumberStyles.cxx
+++ b/xmloff/source/draw/XMLNumberStyles.cxx
@@ -600,7 +600,7 @@ SdXMLNumberFormatImportContext::~SdXMLNumberFormatImportContext()
{
}
-void SdXMLNumberFormatImportContext::add( OUString const & rNumberStyle, bool bLong, bool bTextual, bool bDecimal02, OUString const & rText )
+void SdXMLNumberFormatImportContext::add( std::u16string_view rNumberStyle, bool bLong, bool bTextual, bool bDecimal02, OUString const & rText )
{
if (mnIndex == 16)
return;
diff --git a/xmloff/source/style/PageMasterPropHdl.cxx b/xmloff/source/style/PageMasterPropHdl.cxx
index ba75c03f20e1..e1a67e6a322e 100644
--- a/xmloff/source/style/PageMasterPropHdl.cxx
+++ b/xmloff/source/style/PageMasterPropHdl.cxx
@@ -117,7 +117,7 @@ bool XMLPMPropHdl_NumFormat::importXML(
{
sal_Int16 nSync = sal_Int16();
sal_Int16 nNumType = NumberingType::NUMBER_NONE;
- rUnitConverter.convertNumFormat( nNumType, rStrImpValue, OUString(), true );
+ rUnitConverter.convertNumFormat( nNumType, rStrImpValue, u"", true );
if( !(rValue >>= nSync) )
nSync = NumberingType::NUMBER_NONE;
diff --git a/xmloff/source/style/xmlstyle.cxx b/xmloff/source/style/xmlstyle.cxx
index 264a57282a8e..ced74c90aab5 100644
--- a/xmloff/source/style/xmlstyle.cxx
+++ b/xmloff/source/style/xmlstyle.cxx
@@ -449,7 +449,7 @@ bool SvXMLStylesContext::InsertStyleFamily( XmlStyleFamily ) const
return true;
}
-XmlStyleFamily SvXMLStylesContext::GetFamily( const OUString& rValue )
+XmlStyleFamily SvXMLStylesContext::GetFamily( std::u16string_view rValue )
{
XmlStyleFamily nFamily = XmlStyleFamily::DATA_STYLE;
if( IsXMLToken( rValue, XML_PARAGRAPH ) )
diff --git a/xmloff/source/transform/FrameOASISTContext.cxx b/xmloff/source/transform/FrameOASISTContext.cxx
index 7bb1f2793a9b..e2c2295c8cef 100644
--- a/xmloff/source/transform/FrameOASISTContext.cxx
+++ b/xmloff/source/transform/FrameOASISTContext.cxx
@@ -33,7 +33,7 @@ using namespace ::com::sun::star::xml::sax;
using namespace ::xmloff::token;
bool XMLFrameOASISTransformerContext::IsLinkedEmbeddedObject(
- const OUString& rLocalName,
+ std::u16string_view rLocalName,
const Reference< XAttributeList >& rAttrList )
{
if( !(IsXMLToken( rLocalName, XML_OBJECT ) ||
diff --git a/xmloff/source/transform/FrameOASISTContext.hxx b/xmloff/source/transform/FrameOASISTContext.hxx
index bdd17957b728..90402edddbe0 100644
--- a/xmloff/source/transform/FrameOASISTContext.hxx
+++ b/xmloff/source/transform/FrameOASISTContext.hxx
@@ -31,7 +31,7 @@ class XMLFrameOASISTransformerContext : public XMLTransformerContext
bool m_bIgnoreElement;
bool IsLinkedEmbeddedObject(
- const OUString& rLocalName,
+ std::u16string_view rLocalName,
const css::uno::Reference< css::xml::sax::XAttributeList >& rAttrList );
public:
diff --git a/xmloff/source/transform/StyleOASISTContext.cxx b/xmloff/source/transform/StyleOASISTContext.cxx
index 2f1b48f24a61..d8afd425d767 100644
--- a/xmloff/source/transform/StyleOASISTContext.cxx
+++ b/xmloff/source/transform/StyleOASISTContext.cxx
@@ -83,7 +83,7 @@ public:
virtual void Export() override;
- static XMLPropType GetPropType( const OUString& rLocalName );
+ static XMLPropType GetPropType( std::u16string_view rLocalName );
static OUString const & MergeUnderline( XMLTokenEnum eUnderline,
bool bBold, bool bDouble );
@@ -598,7 +598,7 @@ void XMLPropertiesTContext_Impl::Export()
GetTransformer().GetDocHandler()->endElement( GetExportQName() );
}
-XMLPropType XMLPropertiesTContext_Impl::GetPropType( const OUString& rLocalName )
+XMLPropType XMLPropertiesTContext_Impl::GetPropType( std::u16string_view rLocalName )
{
XMLPropType eProp = XML_PROP_TYPE_END;
if( IsXMLToken( rLocalName, XML_GRAPHIC_PROPERTIES ) )