summaryrefslogtreecommitdiff
path: root/xmloff/source
diff options
context:
space:
mode:
authorNoel <noelgrandin@gmail.com>2020-12-17 13:33:39 +0200
committerNoel Grandin <noel.grandin@collabora.co.uk>2020-12-17 14:05:21 +0100
commit95283f63fd1095121c30f7fc23259f03a5382955 (patch)
tree120fe3ecfafd9604f94b11a9c08768647910b950 /xmloff/source
parenta8e882b5aa7436395e9e3da0316f45690260166b (diff)
use more string_view in SvXMLUnitConverter
Change-Id: Id40a071e1abf0bf2e13217e8745fdf266010c1c0 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/107872 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'xmloff/source')
-rw-r--r--xmloff/source/chart/SchXMLTools.cxx2
-rw-r--r--xmloff/source/chart/SchXMLTools.hxx2
-rw-r--r--xmloff/source/core/xmluconv.cxx16
-rw-r--r--xmloff/source/text/XMLAnchorTypePropHdl.hxx2
-rw-r--r--xmloff/source/text/XMLSectionExport.cxx2
-rw-r--r--xmloff/source/text/XMLSectionExport.hxx2
-rw-r--r--xmloff/source/text/txtflde.cxx6
-rw-r--r--xmloff/source/text/txtprhdl.cxx2
8 files changed, 18 insertions, 16 deletions
diff --git a/xmloff/source/chart/SchXMLTools.cxx b/xmloff/source/chart/SchXMLTools.cxx
index 4c2a94c2292b..f6c8e681a265 100644
--- a/xmloff/source/chart/SchXMLTools.cxx
+++ b/xmloff/source/chart/SchXMLTools.cxx
@@ -145,7 +145,7 @@ const SvXMLEnumMapEntry<SchXMLChartTypeEnum> aXMLChartClassMap[] =
{ XML_TOKEN_INVALID, XML_CHART_CLASS_UNKNOWN }
};
-SchXMLChartTypeEnum GetChartTypeEnum( const OUString& rClassName )
+SchXMLChartTypeEnum GetChartTypeEnum( std::u16string_view rClassName )
{
SchXMLChartTypeEnum nEnumVal = XML_CHART_CLASS_UNKNOWN;
SvXMLUnitConverter::convertEnum( nEnumVal, rClassName, aXMLChartClassMap );
diff --git a/xmloff/source/chart/SchXMLTools.hxx b/xmloff/source/chart/SchXMLTools.hxx
index f734faebaded..e2fc6cc9c308 100644
--- a/xmloff/source/chart/SchXMLTools.hxx
+++ b/xmloff/source/chart/SchXMLTools.hxx
@@ -67,7 +67,7 @@ namespace SchXMLTools
XML_CHART_CLASS_UNKNOWN
};
- SchXMLChartTypeEnum GetChartTypeEnum( const OUString& rClassName );
+ SchXMLChartTypeEnum GetChartTypeEnum( std::u16string_view rClassName );
OUString GetChartTypeByClassName(
const OUString & rClassName, bool bUseOldNames );
diff --git a/xmloff/source/core/xmluconv.cxx b/xmloff/source/core/xmluconv.cxx
index 6b5a6b65634e..e31dbfa231ca 100644
--- a/xmloff/source/core/xmluconv.cxx
+++ b/xmloff/source/core/xmluconv.cxx
@@ -210,12 +210,15 @@ OUString SvXMLUnitConverter::convertMeasureToXML( sal_Int32 nMeasure ) const
not found in the map, this method will return false
*/
bool SvXMLUnitConverter::convertEnumImpl( sal_uInt16& rEnum,
- const OUString& rValue,
+ std::u16string_view rValue,
const SvXMLEnumStringMapEntry<sal_uInt16> *pMap )
{
while( pMap->GetName() )
{
- if( rValue.equalsAsciiL( pMap->GetName(), pMap->GetNameLength() ) )
+ auto nameLength = pMap->GetNameLength();
+ if( static_cast<sal_Int32>(rValue.size()) == nameLength &&
+ rtl_ustr_asciil_reverseEquals_WithLength(
+ rValue.data(), pMap->GetName(), nameLength ) )
{
rEnum = pMap->GetValue();
return true;
@@ -230,7 +233,7 @@ bool SvXMLUnitConverter::convertEnumImpl( sal_uInt16& rEnum,
not found in the map, this method will return false */
bool SvXMLUnitConverter::convertEnumImpl(
sal_uInt16& rEnum,
- const OUString& rValue,
+ std::u16string_view rValue,
const SvXMLEnumMapEntry<sal_uInt16> *pMap )
{
while( pMap->GetToken() != XML_TOKEN_INVALID )
@@ -546,7 +549,7 @@ static bool lcl_getPositions(std::string_view _sValue,OUString& _rContentX,OUStr
}
/** convert string to ::basegfx::B3DVector */
-bool SvXMLUnitConverter::convertB3DVector( ::basegfx::B3DVector& rVector, const OUString& rValue )
+bool SvXMLUnitConverter::convertB3DVector( ::basegfx::B3DVector& rVector, std::u16string_view rValue )
{
OUString aContentX,aContentY,aContentZ;
if ( !lcl_getPositions(rValue,aContentX,aContentY,aContentZ) )
@@ -911,10 +914,9 @@ OUString SvXMLUnitConverter::encodeStyleName(
}
/** convert string (hex) to number (sal_uInt32) */
-bool SvXMLUnitConverter::convertHex( sal_uInt32& nVal,
- const OUString& rValue )
+bool SvXMLUnitConverter::convertHex( sal_uInt32& nVal, std::u16string_view rValue )
{
- if( rValue.getLength() != 8 )
+ if( rValue.size() != 8 )
return false;
nVal = 0;
diff --git a/xmloff/source/text/XMLAnchorTypePropHdl.hxx b/xmloff/source/text/XMLAnchorTypePropHdl.hxx
index 7f6c8ddfe27c..9cd0a06f0d7e 100644
--- a/xmloff/source/text/XMLAnchorTypePropHdl.hxx
+++ b/xmloff/source/text/XMLAnchorTypePropHdl.hxx
@@ -37,7 +37,7 @@ public:
OUString& rStrExpValue,
const css::uno::Any& rValue,
const SvXMLUnitConverter& rUnitConverter ) const override;
- static bool convert( const OUString& rStrImpValue,
+ static bool convert( std::u16string_view rStrImpValue,
css::text::TextContentAnchorType& rType );
};
diff --git a/xmloff/source/text/XMLSectionExport.cxx b/xmloff/source/text/XMLSectionExport.cxx
index b8b0a5432ddf..6ee77829170f 100644
--- a/xmloff/source/text/XMLSectionExport.cxx
+++ b/xmloff/source/text/XMLSectionExport.cxx
@@ -329,7 +329,7 @@ SvXMLEnumStringMapEntry<SectionTypeEnum> const aIndexTypeMap[] =
};
enum SectionTypeEnum XMLSectionExport::MapSectionType(
- const OUString& rServiceName)
+ std::u16string_view rServiceName)
{
enum SectionTypeEnum eType = TEXT_SECTION_TYPE_UNKNOWN;
diff --git a/xmloff/source/text/XMLSectionExport.hxx b/xmloff/source/text/XMLSectionExport.hxx
index 72c6247bcd2c..06243cc24122 100644
--- a/xmloff/source/text/XMLSectionExport.hxx
+++ b/xmloff/source/text/XMLSectionExport.hxx
@@ -195,7 +195,7 @@ private:
css::uno::Reference < css::text::XDocumentIndex > & rIndex);
/// map service name to section type
- static enum SectionTypeEnum MapSectionType(const OUString& rSectionName);
+ static enum SectionTypeEnum MapSectionType(std::u16string_view rSectionName);
/**
* Export the index element start (for all index types).
diff --git a/xmloff/source/text/txtflde.cxx b/xmloff/source/text/txtflde.cxx
index dc767767f3a6..13d221672bff 100644
--- a/xmloff/source/text/txtflde.cxx
+++ b/xmloff/source/text/txtflde.cxx
@@ -435,7 +435,7 @@ enum FieldIdEnum XMLTextFieldExport::GetFieldID(
}
enum FieldIdEnum XMLTextFieldExport::MapFieldName(
- const OUString& sFieldName, // field (master) name
+ std::u16string_view sFieldName, // field (master) name
const Reference<XPropertySet> & xPropSet) // for subtype
{
// we'll proceed in 2 steps:
@@ -447,9 +447,9 @@ enum FieldIdEnum XMLTextFieldExport::MapFieldName(
// a) find prelim. FIELD_ID via aFieldServiceMapping
// check for non-empty service name
- DBG_ASSERT(!sFieldName.isEmpty(), "no valid service name!");
+ DBG_ASSERT(!sFieldName.empty(), "no valid service name!");
enum FieldIdEnum nToken = FIELD_ID_UNKNOWN;
- if (!sFieldName.isEmpty())
+ if (!sFieldName.empty())
{
// map name to prelim. ID
bool bRet = SvXMLUnitConverter::convertEnum(
diff --git a/xmloff/source/text/txtprhdl.cxx b/xmloff/source/text/txtprhdl.cxx
index 77dbcb1bdd27..e68a8316a503 100644
--- a/xmloff/source/text/txtprhdl.cxx
+++ b/xmloff/source/text/txtprhdl.cxx
@@ -631,7 +631,7 @@ XMLAnchorTypePropHdl::~XMLAnchorTypePropHdl()
{
}
-bool XMLAnchorTypePropHdl::convert( const OUString& rStrImpValue,
+bool XMLAnchorTypePropHdl::convert( std::u16string_view rStrImpValue,
TextContentAnchorType& rType )
{
TextContentAnchorType nAnchor;