diff options
author | Noel Grandin <noel.grandin@collabora.co.uk> | 2022-10-14 14:29:51 +0200 |
---|---|---|
committer | Noel Grandin <noel.grandin@collabora.co.uk> | 2022-10-17 10:39:11 +0200 |
commit | 425255567eafffba3a5817fb96050663d1db8e2f (patch) | |
tree | d4f78a9103c34367b2aa29feb31faf4e6871d01e | |
parent | 6125be0aa10113d840a1fdbe33cf3174d5896fcb (diff) |
use more string_view
Change-Id: Ie826234aa9064b08b8f0647738b57c47ac0ed91a
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/141369
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
-rw-r--r-- | chart2/qa/extras/xshape/chart2xshape.cxx | 10 | ||||
-rw-r--r-- | forms/source/component/Button.cxx | 8 | ||||
-rw-r--r-- | lingucomponent/source/lingutil/lingutil.cxx | 8 | ||||
-rw-r--r-- | lotuswordpro/source/filter/lwpfribmark.cxx | 188 | ||||
-rw-r--r-- | lotuswordpro/source/filter/lwpfribmark.hxx | 2 | ||||
-rw-r--r-- | reportdesign/inc/conditionalexpression.hxx | 2 | ||||
-rw-r--r-- | reportdesign/source/core/misc/conditionalexpression.cxx | 16 | ||||
-rw-r--r-- | scripting/source/provider/MasterScriptProvider.cxx | 8 | ||||
-rw-r--r-- | scripting/source/stringresource/stringresource.cxx | 27 | ||||
-rw-r--r-- | sdext/source/minimizer/pppoptimizertoken.cxx | 4 | ||||
-rw-r--r-- | sdext/source/minimizer/pppoptimizertoken.hxx | 2 | ||||
-rw-r--r-- | sdext/source/presenter/PresenterHelpView.cxx | 21 | ||||
-rw-r--r-- | sdext/source/presenter/PresenterProtocolHandler.cxx | 36 | ||||
-rw-r--r-- | uui/source/iahndl-ssl.cxx | 11 | ||||
-rw-r--r-- | uui/source/secmacrowarnings.cxx | 6 | ||||
-rw-r--r-- | xmlscript/source/xmldlg_imexp/imp_share.hxx | 8 | ||||
-rw-r--r-- | xmlscript/source/xmllib_imexp/imp_share.hxx | 8 |
17 files changed, 186 insertions, 179 deletions
diff --git a/chart2/qa/extras/xshape/chart2xshape.cxx b/chart2/qa/extras/xshape/chart2xshape.cxx index bf2e381a75e5..173974d6bce4 100644 --- a/chart2/qa/extras/xshape/chart2xshape.cxx +++ b/chart2/qa/extras/xshape/chart2xshape.cxx @@ -51,22 +51,22 @@ public: CPPUNIT_TEST_SUITE_END(); private: - void compareAgainstReference(const OUString& rDump, std::u16string_view rReferenceFile); + void compareAgainstReference(std::u16string_view rDump, std::u16string_view rReferenceFile); OUString getXShapeDumpString(); xmlDocUniquePtr getXShapeDumpXmlDoc(); }; namespace { -bool checkDumpAgainstFile(const OUString& rDump, std::u16string_view aFilePath, +bool checkDumpAgainstFile(std::u16string_view rDump, std::u16string_view aFilePath, char const* toleranceFile) { OString aOFile = OUStringToOString(aFilePath, RTL_TEXTENCODING_UTF8); - CPPUNIT_ASSERT_MESSAGE("dump is empty", !rDump.isEmpty()); + CPPUNIT_ASSERT_MESSAGE("dump is empty", !rDump.empty()); OString aDump = OUStringToOString(rDump, RTL_TEXTENCODING_UTF8); - return doXMLDiff(aOFile.getStr(), aDump.getStr(), static_cast<int>(rDump.getLength()), + return doXMLDiff(aOFile.getStr(), aDump.getStr(), static_cast<int>(rDump.size()), toleranceFile); } } @@ -86,7 +86,7 @@ xmlDocUniquePtr Chart2XShapeTest::getXShapeDumpXmlDoc() return xmlDocUniquePtr(xmlParseDoc(reinterpret_cast<const xmlChar*>(aXmlDump.getStr()))); } -void Chart2XShapeTest::compareAgainstReference(const OUString& rDump, +void Chart2XShapeTest::compareAgainstReference(std::u16string_view rDump, std::u16string_view rReferenceFile) { checkDumpAgainstFile( diff --git a/forms/source/component/Button.cxx b/forms/source/component/Button.cxx index 52818361c2f2..28cac777ea43 100644 --- a/forms/source/component/Button.cxx +++ b/forms/source/component/Button.cxx @@ -30,6 +30,7 @@ #include <comphelper/basicio.hxx> #include <comphelper/property.hxx> #include <o3tl/any.hxx> +#include <o3tl/string_view.hxx> #include <comphelper/diagnose_ex.hxx> #include <tools/debug.hxx> #include <tools/urlobj.hxx> @@ -652,10 +653,11 @@ void SAL_CALL OButtonControl::propertyChange( const PropertyChangeEvent& _rEvent namespace { - bool isFormControllerURL( const OUString& _rURL ) + bool isFormControllerURL( std::u16string_view _rURL ) { - return ( _rURL.getLength() > RTL_CONSTASCII_LENGTH( ".uno:FormController/" ) ) - && ( _rURL.startsWith( ".uno:FormController/" ) ); + static constexpr std::u16string_view PREFIX = u".uno:FormController/"; + return ( _rURL.size() > PREFIX.size() ) + && ( o3tl::starts_with(_rURL, PREFIX ) ); } } diff --git a/lingucomponent/source/lingutil/lingutil.cxx b/lingucomponent/source/lingutil/lingutil.cxx index f0ab84026174..5e931f894ad2 100644 --- a/lingucomponent/source/lingutil/lingutil.cxx +++ b/lingucomponent/source/lingutil/lingutil.cxx @@ -63,7 +63,7 @@ OString Win_AddLongPathPrefix( const OString &rPathName ) // find old style dictionaries in system directories static void GetOldStyleDicsInDir( OUString const & aSystemDir, OUString const & aFormatName, - OUString const & aSystemSuffix, OUString const & aSystemPrefix, + std::u16string_view aSystemSuffix, std::u16string_view aSystemPrefix, std::set< OUString >& aDicLangInUse, std::vector< SvtLinguConfigDictionaryEntry >& aRes ) { @@ -82,9 +82,9 @@ static void GetOldStyleDicsInDir( sal_Int32 nStartIndex = sPath.lastIndexOf('/') + 1; if (!sPath.match(aSystemPrefix, nStartIndex)) continue; - OUString sChunk = sPath.copy(nStartIndex + aSystemPrefix.getLength(), - sPath.getLength() - aSystemSuffix.getLength() - - nStartIndex - aSystemPrefix.getLength()); + OUString sChunk = sPath.copy(nStartIndex + aSystemPrefix.size(), + sPath.getLength() - aSystemSuffix.size() - + nStartIndex - aSystemPrefix.size()); if (sChunk.isEmpty()) continue; diff --git a/lotuswordpro/source/filter/lwpfribmark.cxx b/lotuswordpro/source/filter/lwpfribmark.cxx index f29d4f4c3aeb..f4e35c0d8477 100644 --- a/lotuswordpro/source/filter/lwpfribmark.cxx +++ b/lotuswordpro/source/filter/lwpfribmark.cxx @@ -375,7 +375,7 @@ void LwpFribField::RegisterTimeField(const LwpFieldMark* pFieldMark) std::u16string_view tag = sFormula.subView(0, index); if (tag == u"Now()" || tag == u"CreateDate" || tag == u"EditDate") - RegisterDateTimeStyle(sFormula.copy(index + 1)); + RegisterDateTimeStyle(sFormula.subView(index + 1)); } } @@ -388,24 +388,24 @@ void LwpFribField::RegisterTotalTimeStyle() m_TimeStyle = pXFStyleManager->AddStyle(std::move(pTimeStyle)).m_pStyle->GetStyleName(); } -void LwpFribField::RegisterDateTimeStyle(const OUString& sFormula) +void LwpFribField::RegisterDateTimeStyle(std::u16string_view sFormula) { std::unique_ptr<XFDateStyle> pDateStyle; std::unique_ptr<XFTimeStyle> pTimeStyle; //DATE - if (sFormula.getLength() < 2) + if (sFormula.size() < 2) return; if (sFormula[1] == 'F') { - if (sFormula == "%FLSystemShortDate") + if (sFormula == u"%FLSystemShortDate") { pDateStyle = LwpTools::GetSystemDateStyle(false); } - else if (sFormula == "%FLSystemLongDate") + else if (sFormula == u"%FLSystemLongDate") { pDateStyle = LwpTools::GetSystemDateStyle(true); } - else if (sFormula == "%FLISODate1" || sFormula == "%FLYYYY/MM/DD") + else if (sFormula == u"%FLISODate1" || sFormula == u"%FLYYYY/MM/DD") { pDateStyle.reset(new XFDateStyle); pDateStyle->AddYear(); @@ -414,7 +414,7 @@ void LwpFribField::RegisterDateTimeStyle(const OUString& sFormula) pDateStyle->AddText("/"); pDateStyle->AddMonthDay(); } - else if (sFormula == "%FLISODate2" || sFormula == "%FLYYYY/MM/DD HH:mm:SS") + else if (sFormula == u"%FLISODate2" || sFormula == u"%FLYYYY/MM/DD HH:mm:SS") { pDateStyle.reset(new XFDateStyle); pDateStyle->AddYear(); @@ -429,7 +429,7 @@ void LwpFribField::RegisterDateTimeStyle(const OUString& sFormula) pDateStyle->AddText(":"); pDateStyle->AddSecond(); } - else if (sFormula == "%FLM/D/YY") + else if (sFormula == u"%FLM/D/YY") { pDateStyle.reset(new XFDateStyle); pDateStyle->AddMonth(false); @@ -438,7 +438,7 @@ void LwpFribField::RegisterDateTimeStyle(const OUString& sFormula) pDateStyle->AddText("/"); pDateStyle->AddYear(false); } - else if (sFormula == "%FLMonth D, YYYY") + else if (sFormula == u"%FLMonth D, YYYY") { pDateStyle.reset(new XFDateStyle); pDateStyle->AddMonth(true, true); @@ -447,7 +447,7 @@ void LwpFribField::RegisterDateTimeStyle(const OUString& sFormula) pDateStyle->AddText(", "); pDateStyle->AddYear(); } - else if (sFormula == "%FLWeekday, Month D, YYYY") + else if (sFormula == u"%FLWeekday, Month D, YYYY") { pDateStyle.reset(new XFDateStyle); pDateStyle->AddWeekDay(); @@ -458,7 +458,7 @@ void LwpFribField::RegisterDateTimeStyle(const OUString& sFormula) pDateStyle->AddText(", "); pDateStyle->AddYear(); } - else if (sFormula == "%FLMn D, YYYY") + else if (sFormula == u"%FLMn D, YYYY") { pDateStyle.reset(new XFDateStyle); pDateStyle->AddMonth(false, true); @@ -467,7 +467,7 @@ void LwpFribField::RegisterDateTimeStyle(const OUString& sFormula) pDateStyle->AddText(", "); pDateStyle->AddYear(); } - else if (sFormula == "%FLWday, Mn D, YYYY") + else if (sFormula == u"%FLWday, Mn D, YYYY") { pDateStyle.reset(new XFDateStyle); pDateStyle->AddWeekDay(false); @@ -478,14 +478,14 @@ void LwpFribField::RegisterDateTimeStyle(const OUString& sFormula) pDateStyle->AddText(", "); pDateStyle->AddYear(); } - else if (sFormula == "%FLMn D") + else if (sFormula == u"%FLMn D") { pDateStyle.reset(new XFDateStyle); pDateStyle->AddMonth(false, true); pDateStyle->AddText(" "); pDateStyle->AddMonthDay(false); } - else if (sFormula == "%FLWeekday, Mn D") + else if (sFormula == u"%FLWeekday, Mn D") { pDateStyle.reset(new XFDateStyle); pDateStyle->AddWeekDay(); @@ -494,7 +494,7 @@ void LwpFribField::RegisterDateTimeStyle(const OUString& sFormula) pDateStyle->AddText(" "); pDateStyle->AddMonthDay(false); } - else if (sFormula == "%FLMn D, YY") + else if (sFormula == u"%FLMn D, YY") { pDateStyle.reset(new XFDateStyle); pDateStyle->AddMonth(false, true); @@ -503,69 +503,69 @@ void LwpFribField::RegisterDateTimeStyle(const OUString& sFormula) pDateStyle->AddText(", "); pDateStyle->AddYear(false); } - else if (sFormula == "%FLM/D") + else if (sFormula == u"%FLM/D") { pDateStyle.reset(new XFDateStyle); pDateStyle->AddMonth(false); pDateStyle->AddText("/"); pDateStyle->AddMonthDay(false); } - else if (sFormula == "%FLM/YY") + else if (sFormula == u"%FLM/YY") { pDateStyle.reset(new XFDateStyle); pDateStyle->AddMonth(false); pDateStyle->AddText("/"); pDateStyle->AddYear(false); } - else if (sFormula == "%FLMn YY") + else if (sFormula == u"%FLMn YY") { pDateStyle.reset(new XFDateStyle); pDateStyle->AddMonth(false, true); pDateStyle->AddText(" "); pDateStyle->AddYear(false); } - else if (sFormula == "%FLWeekday") + else if (sFormula == u"%FLWeekday") { pDateStyle.reset(new XFDateStyle); pDateStyle->AddWeekDay(); } - else if (sFormula == "%FLWday") + else if (sFormula == u"%FLWday") { pDateStyle.reset(new XFDateStyle); pDateStyle->AddWeekDay(false); } - else if (sFormula == "%FLMonth") + else if (sFormula == u"%FLMonth") { pDateStyle.reset(new XFDateStyle); pDateStyle->AddMonth(true, true); } - else if (sFormula == "%FLMn") + else if (sFormula == u"%FLMn") { pDateStyle.reset(new XFDateStyle); pDateStyle->AddMonth(false, true); } - else if (sFormula == "%FLD") + else if (sFormula == u"%FLD") { pDateStyle.reset(new XFDateStyle); pDateStyle->AddMonthDay(false); } - else if (sFormula == "%FLM") + else if (sFormula == u"%FLM") { pDateStyle.reset(new XFDateStyle); pDateStyle->AddMonth(false); } - else if (sFormula == "%FLYYYY") + else if (sFormula == u"%FLYYYY") { pDateStyle.reset(new XFDateStyle); pDateStyle->AddYear(); } - else if (sFormula == "%FLYY") + else if (sFormula == u"%FLYY") { pDateStyle.reset(new XFDateStyle); pDateStyle->AddYear(false); } //chinese version begin - else if (sFormula == "%FLYY/M/D") + else if (sFormula == u"%FLYY/M/D") { pDateStyle.reset(new XFDateStyle); pDateStyle->AddYear(false); @@ -574,7 +574,7 @@ void LwpFribField::RegisterDateTimeStyle(const OUString& sFormula) pDateStyle->AddText("-"); pDateStyle->AddMonthDay(false); } - else if (sFormula == "%FLYYYY Month D") + else if (sFormula == u"%FLYYYY Month D") { pDateStyle.reset(new XFDateStyle); pDateStyle->AddYear(); @@ -583,7 +583,7 @@ void LwpFribField::RegisterDateTimeStyle(const OUString& sFormula) pDateStyle->AddText(" "); pDateStyle->AddMonthDay(false); } - else if (sFormula == "%FLWeekday, YYYY Month D") + else if (sFormula == u"%FLWeekday, YYYY Month D") { pDateStyle.reset(new XFDateStyle); pDateStyle->AddWeekDay(); @@ -594,7 +594,7 @@ void LwpFribField::RegisterDateTimeStyle(const OUString& sFormula) pDateStyle->AddText(" "); pDateStyle->AddMonthDay(false); } - else if (sFormula == "%FLYYYY Mn D") + else if (sFormula == u"%FLYYYY Mn D") { pDateStyle.reset(new XFDateStyle); pDateStyle->AddYear(); @@ -603,7 +603,7 @@ void LwpFribField::RegisterDateTimeStyle(const OUString& sFormula) pDateStyle->AddText(" "); pDateStyle->AddMonthDay(false); } - else if (sFormula == "%FLWday, YYYY Mn D") + else if (sFormula == u"%FLWday, YYYY Mn D") { pDateStyle.reset(new XFDateStyle); pDateStyle->AddWeekDay(false); @@ -615,7 +615,7 @@ void LwpFribField::RegisterDateTimeStyle(const OUString& sFormula) pDateStyle->AddMonthDay(false); } //next 2 are the same with english version - else if (sFormula == "%FLYY Mn D") + else if (sFormula == u"%FLYY Mn D") { pDateStyle.reset(new XFDateStyle); pDateStyle->AddYear(false); @@ -624,21 +624,21 @@ void LwpFribField::RegisterDateTimeStyle(const OUString& sFormula) pDateStyle->AddText(" "); pDateStyle->AddMonthDay(false); } - else if (sFormula == "%FLYY/M") + else if (sFormula == u"%FLYY/M") { pDateStyle.reset(new XFDateStyle); pDateStyle->AddMonth(false); pDateStyle->AddText("-"); pDateStyle->AddMonth(false); } - else if (sFormula == "%FLYY Mn") + else if (sFormula == u"%FLYY Mn") { pDateStyle.reset(new XFDateStyle); pDateStyle->AddMonth(false); pDateStyle->AddText(" "); pDateStyle->AddMonth(false, true); } - else if (sFormula == "%FLeeeeoa" || sFormula == "%FLffffooaa" || sFormula == "%FLEEEEOA") + else if (sFormula == u"%FLeeeeoa" || sFormula == u"%FLffffooaa" || sFormula == u"%FLEEEEOA") { pDateStyle.reset(new XFDateStyle); OUString sText; @@ -652,7 +652,7 @@ void LwpFribField::RegisterDateTimeStyle(const OUString& sFormula) sText = OUString(u'\x65e5'); pDateStyle->AddText(sText); } - else if (sFormula == "%FLoa" || sFormula == "%FLooaa" || sFormula == "%FLOA") + else if (sFormula == u"%FLoa" || sFormula == u"%FLooaa" || sFormula == u"%FLOA") { pDateStyle.reset(new XFDateStyle); OUString sText; @@ -663,7 +663,7 @@ void LwpFribField::RegisterDateTimeStyle(const OUString& sFormula) sText = OUString(u'\x65e5'); pDateStyle->AddText(sText); } - else if (sFormula == "%FLYYYY/M/D" || sFormula == "%FLGGGG/od/ad") + else if (sFormula == u"%FLYYYY/M/D" || sFormula == u"%FLGGGG/od/ad") { pDateStyle.reset(new XFDateStyle); pDateStyle->AddYear(); @@ -672,7 +672,7 @@ void LwpFribField::RegisterDateTimeStyle(const OUString& sFormula) pDateStyle->AddText("-"); pDateStyle->AddMonthDay(false); } - else if (sFormula == "%FLYY.M.D") + else if (sFormula == u"%FLYY.M.D") { pDateStyle.reset(new XFDateStyle); pDateStyle->AddYear(false); @@ -683,7 +683,7 @@ void LwpFribField::RegisterDateTimeStyle(const OUString& sFormula) } //chinese version end //other version begin - else if (sFormula == "%FLWeekday, Month DD, YYYY") + else if (sFormula == u"%FLWeekday, Month DD, YYYY") { pDateStyle.reset(new XFDateStyle); pDateStyle->AddWeekDay(); @@ -694,7 +694,7 @@ void LwpFribField::RegisterDateTimeStyle(const OUString& sFormula) pDateStyle->AddText(", "); pDateStyle->AddYear(); } - else if (sFormula == "%FLYYYY/MM/DD") + else if (sFormula == u"%FLYYYY/MM/DD") { pDateStyle.reset(new XFDateStyle); pDateStyle->AddWeekDay(); @@ -705,7 +705,7 @@ void LwpFribField::RegisterDateTimeStyle(const OUString& sFormula) pDateStyle->AddText(", "); pDateStyle->AddYear(); } - else if (sFormula == "%FLD/M/YY") + else if (sFormula == u"%FLD/M/YY") { pDateStyle.reset(new XFDateStyle); pDateStyle->AddMonthDay(false); @@ -714,7 +714,7 @@ void LwpFribField::RegisterDateTimeStyle(const OUString& sFormula) pDateStyle->AddText("/"); pDateStyle->AddYear(false); } - else if (sFormula == "%FLD Month YYYY") + else if (sFormula == u"%FLD Month YYYY") { pDateStyle.reset(new XFDateStyle); pDateStyle->AddMonthDay(false); @@ -723,7 +723,7 @@ void LwpFribField::RegisterDateTimeStyle(const OUString& sFormula) pDateStyle->AddText(" "); pDateStyle->AddYear(); } - else if (sFormula == "%FLDD Month YYYY") + else if (sFormula == u"%FLDD Month YYYY") { pDateStyle.reset(new XFDateStyle); pDateStyle->AddMonthDay(); @@ -732,7 +732,7 @@ void LwpFribField::RegisterDateTimeStyle(const OUString& sFormula) pDateStyle->AddText(" "); pDateStyle->AddYear(); } - else if (sFormula == "%FLWeekday, D Month YYYY") + else if (sFormula == u"%FLWeekday, D Month YYYY") { pDateStyle.reset(new XFDateStyle); pDateStyle->AddWeekDay(); @@ -743,7 +743,7 @@ void LwpFribField::RegisterDateTimeStyle(const OUString& sFormula) pDateStyle->AddText(" "); pDateStyle->AddYear(); } - else if (sFormula == "%FLWeekday, DD Month YYYY") + else if (sFormula == u"%FLWeekday, DD Month YYYY") { pDateStyle.reset(new XFDateStyle); pDateStyle->AddWeekDay(); @@ -754,7 +754,7 @@ void LwpFribField::RegisterDateTimeStyle(const OUString& sFormula) pDateStyle->AddText(" "); pDateStyle->AddYear(); } - else if (sFormula == "%FLD Mn YYYY") + else if (sFormula == u"%FLD Mn YYYY") { pDateStyle.reset(new XFDateStyle); pDateStyle->AddMonthDay(false); @@ -763,7 +763,7 @@ void LwpFribField::RegisterDateTimeStyle(const OUString& sFormula) pDateStyle->AddText(" "); pDateStyle->AddYear(); } - else if (sFormula == "%FLWday, D Mn YYYY") + else if (sFormula == u"%FLWday, D Mn YYYY") { pDateStyle.reset(new XFDateStyle); pDateStyle->AddWeekDay(false); @@ -774,7 +774,7 @@ void LwpFribField::RegisterDateTimeStyle(const OUString& sFormula) pDateStyle->AddText(" "); pDateStyle->AddYear(); } - else if (sFormula == "%FLWday, DD Mn YYYY") + else if (sFormula == u"%FLWday, DD Mn YYYY") { pDateStyle.reset(new XFDateStyle); pDateStyle->AddWeekDay(false); @@ -785,21 +785,21 @@ void LwpFribField::RegisterDateTimeStyle(const OUString& sFormula) pDateStyle->AddText(" "); pDateStyle->AddYear(); } - else if (sFormula == "%FLD Mn") + else if (sFormula == u"%FLD Mn") { pDateStyle.reset(new XFDateStyle); pDateStyle->AddMonthDay(false); pDateStyle->AddText(" "); pDateStyle->AddMonth(false, true); } - else if (sFormula == "%FLDD Mn") + else if (sFormula == u"%FLDD Mn") { pDateStyle.reset(new XFDateStyle); pDateStyle->AddMonthDay(); pDateStyle->AddText(" "); pDateStyle->AddMonth(false, true); } - else if (sFormula == "%FLWeekday, D Mn") + else if (sFormula == u"%FLWeekday, D Mn") { pDateStyle.reset(new XFDateStyle); pDateStyle->AddWeekDay(); @@ -808,7 +808,7 @@ void LwpFribField::RegisterDateTimeStyle(const OUString& sFormula) pDateStyle->AddText(" "); pDateStyle->AddMonth(false, true); } - else if (sFormula == "%FLWeekday, DD Mn") + else if (sFormula == u"%FLWeekday, DD Mn") { pDateStyle.reset(new XFDateStyle); pDateStyle->AddWeekDay(); @@ -817,7 +817,7 @@ void LwpFribField::RegisterDateTimeStyle(const OUString& sFormula) pDateStyle->AddText(" "); pDateStyle->AddMonth(false, true); } - else if (sFormula == "%FLD Mn YY") + else if (sFormula == u"%FLD Mn YY") { pDateStyle.reset(new XFDateStyle); pDateStyle->AddMonthDay(false); @@ -826,7 +826,7 @@ void LwpFribField::RegisterDateTimeStyle(const OUString& sFormula) pDateStyle->AddText(" "); pDateStyle->AddYear(false); } - else if (sFormula == "%FLDD Mn YY") + else if (sFormula == u"%FLDD Mn YY") { pDateStyle.reset(new XFDateStyle); pDateStyle->AddMonthDay(); @@ -835,21 +835,21 @@ void LwpFribField::RegisterDateTimeStyle(const OUString& sFormula) pDateStyle->AddText(" "); pDateStyle->AddYear(false); } - else if (sFormula == "%FLD/M") + else if (sFormula == u"%FLD/M") { pDateStyle.reset(new XFDateStyle); pDateStyle->AddMonthDay(false); pDateStyle->AddText("/"); pDateStyle->AddMonth(false); } - else if (sFormula == "%FLDD/MM") + else if (sFormula == u"%FLDD/MM") { pDateStyle.reset(new XFDateStyle); pDateStyle->AddMonthDay(); pDateStyle->AddText("/"); pDateStyle->AddMonth(); } - else if (sFormula == "%FLDD/MM/YY") + else if (sFormula == u"%FLDD/MM/YY") { pDateStyle.reset(new XFDateStyle); pDateStyle->AddMonthDay(); @@ -858,7 +858,7 @@ void LwpFribField::RegisterDateTimeStyle(const OUString& sFormula) pDateStyle->AddText("/"); pDateStyle->AddYear(false); } - else if (sFormula == "%FLMM/YY") + else if (sFormula == u"%FLMM/YY") { pDateStyle.reset(new XFDateStyle); pDateStyle->AddMonth(); @@ -867,11 +867,11 @@ void LwpFribField::RegisterDateTimeStyle(const OUString& sFormula) } //other version end //TIME - else if (sFormula == "%FLSystemTime") + else if (sFormula == u"%FLSystemTime") { pTimeStyle = LwpTools::GetSystemTimeStyle(); } - else if (sFormula == "%FLISOTime1" || sFormula == "%FLH:mm:SS") + else if (sFormula == u"%FLISOTime1" || sFormula == u"%FLH:mm:SS") { pTimeStyle.reset(new XFTimeStyle); pTimeStyle->AddHour(); @@ -880,7 +880,7 @@ void LwpFribField::RegisterDateTimeStyle(const OUString& sFormula) pTimeStyle->AddText(":"); pTimeStyle->AddSecond(); } - else if (sFormula == "%FLH:mm ampm") + else if (sFormula == u"%FLH:mm ampm") { pTimeStyle.reset(new XFTimeStyle); pTimeStyle->AddHour(false); @@ -889,14 +889,14 @@ void LwpFribField::RegisterDateTimeStyle(const OUString& sFormula) pTimeStyle->AddText(" "); pTimeStyle->SetAmPm(true); } - else if (sFormula == "%FLH:mm") + else if (sFormula == u"%FLH:mm") { pTimeStyle.reset(new XFTimeStyle); pTimeStyle->AddHour(false); pTimeStyle->AddText(":"); pTimeStyle->AddMinute(); } - else if (sFormula == "%FLH:mm:SS ampm") + else if (sFormula == u"%FLH:mm:SS ampm") { pTimeStyle.reset(new XFTimeStyle); pTimeStyle->AddHour(false); @@ -907,7 +907,7 @@ void LwpFribField::RegisterDateTimeStyle(const OUString& sFormula) pTimeStyle->AddText(" "); pTimeStyle->SetAmPm(true); } - else if (sFormula == "%FLH:mm:SS") + else if (sFormula == u"%FLH:mm:SS") { pTimeStyle.reset(new XFTimeStyle); pTimeStyle->AddHour(false); @@ -916,36 +916,36 @@ void LwpFribField::RegisterDateTimeStyle(const OUString& sFormula) pTimeStyle->AddText(":"); pTimeStyle->AddSecond(); } - else if (sFormula == "%FLH ampm") + else if (sFormula == u"%FLH ampm") { pTimeStyle.reset(new XFTimeStyle); pTimeStyle->AddHour(false); pTimeStyle->AddText(" "); pTimeStyle->SetAmPm(true); } - else if (sFormula == "%FLH") + else if (sFormula == u"%FLH") { pTimeStyle.reset(new XFTimeStyle); pTimeStyle->AddHour(false); } - else if (sFormula == "%FLmm") + else if (sFormula == u"%FLmm") { pTimeStyle.reset(new XFTimeStyle); pTimeStyle->AddMinute(); } - else if (sFormula == "%FLSS") + else if (sFormula == u"%FLSS") { pTimeStyle.reset(new XFTimeStyle); pTimeStyle->AddSecond(); } - else if (sFormula == "%FLampm") + else if (sFormula == u"%FLampm") { pTimeStyle.reset(new XFTimeStyle); pTimeStyle->SetAmPm(true); } //chinese version begin - else if (sFormula == "%FLjF" || sFormula == "%FLJFF" || sFormula == "%FLjjF" - || sFormula == "%FLJJFF ") + else if (sFormula == u"%FLjF" || sFormula == u"%FLJFF" || sFormula == u"%FLjjF" + || sFormula == u"%FLJJFF ") { pTimeStyle.reset(new XFTimeStyle); pTimeStyle->AddHour(false); @@ -956,7 +956,7 @@ void LwpFribField::RegisterDateTimeStyle(const OUString& sFormula) sText = OUString(u'\x5206'); pTimeStyle->AddText(sText); } - else if (sFormula == "%FLjjjF" || sFormula == "%FLJJJFF") + else if (sFormula == u"%FLjjjF" || sFormula == u"%FLJJJFF") { pTimeStyle.reset(new XFTimeStyle); pTimeStyle->SetAmPm(true); @@ -970,7 +970,7 @@ void LwpFribField::RegisterDateTimeStyle(const OUString& sFormula) } //chinese version end //other version begin - else if (sFormula == "%FLHH:mm ampm") + else if (sFormula == u"%FLHH:mm ampm") { pTimeStyle.reset(new XFTimeStyle); pTimeStyle->AddHour(); @@ -979,14 +979,14 @@ void LwpFribField::RegisterDateTimeStyle(const OUString& sFormula) pTimeStyle->AddText(" "); pTimeStyle->SetAmPm(true); } - else if (sFormula == "%FLHH ampm") + else if (sFormula == u"%FLHH ampm") { pTimeStyle.reset(new XFTimeStyle); pTimeStyle->AddHour(); pTimeStyle->AddText(" "); pTimeStyle->SetAmPm(true); } - else if (sFormula == "%FLHH:mm:SS ampm") + else if (sFormula == u"%FLHH:mm:SS ampm") { pTimeStyle.reset(new XFTimeStyle); pTimeStyle->AddHour(); @@ -997,14 +997,14 @@ void LwpFribField::RegisterDateTimeStyle(const OUString& sFormula) pTimeStyle->AddText(" "); pTimeStyle->SetAmPm(true); } - else if (sFormula == "%FLHH:mm") + else if (sFormula == u"%FLHH:mm") { pTimeStyle.reset(new XFTimeStyle); pTimeStyle->AddHour(); pTimeStyle->AddText(":"); pTimeStyle->AddMinute(); } - else if (sFormula == "%FLHH:mm:SS") + else if (sFormula == u"%FLHH:mm:SS") { pTimeStyle.reset(new XFTimeStyle); pTimeStyle->AddHour(); @@ -1017,11 +1017,11 @@ void LwpFribField::RegisterDateTimeStyle(const OUString& sFormula) } else if (sFormula[1] == 'D') { - if (sFormula == "%Da") + if (sFormula == u"%Da") { pDateStyle = LwpTools::GetSystemDateStyle(false); } - else if (sFormula == "%DB" || sFormula == "%Db") + else if (sFormula == u"%DB" || sFormula == u"%Db") { pDateStyle.reset(new XFDateStyle); pDateStyle->AddMonth(true, true); @@ -1030,7 +1030,7 @@ void LwpFribField::RegisterDateTimeStyle(const OUString& sFormula) pDateStyle->AddText(", "); pDateStyle->AddYear(); } - else if (sFormula == "%Dc" || sFormula == "%DC") + else if (sFormula == u"%Dc" || sFormula == u"%DC") { pDateStyle.reset(new XFDateStyle); pDateStyle->AddMonthDay(false); @@ -1039,7 +1039,7 @@ void LwpFribField::RegisterDateTimeStyle(const OUString& sFormula) pDateStyle->AddText(" "); pDateStyle->AddYear(); } - else if (sFormula == "%Dd" || sFormula == "%DD") + else if (sFormula == u"%Dd" || sFormula == u"%DD") { pDateStyle.reset(new XFDateStyle); pDateStyle->AddWeekDay(); @@ -1050,14 +1050,14 @@ void LwpFribField::RegisterDateTimeStyle(const OUString& sFormula) pDateStyle->AddText(", "); pDateStyle->AddYear(); } - else if (sFormula == "%DE" || sFormula == "%De") + else if (sFormula == u"%DE" || sFormula == u"%De") { pDateStyle.reset(new XFDateStyle); pDateStyle->AddMonth(true, true); pDateStyle->AddText(" "); pDateStyle->AddMonthDay(false); } - else if (sFormula == "%Df" || sFormula == "%DF") + else if (sFormula == u"%Df" || sFormula == u"%DF") { pDateStyle.reset(new XFDateStyle); pDateStyle->AddWeekDay(); @@ -1066,14 +1066,14 @@ void LwpFribField::RegisterDateTimeStyle(const OUString& sFormula) pDateStyle->AddText(" "); pDateStyle->AddMonthDay(false); } - else if (sFormula == "%Dg") + else if (sFormula == u"%Dg") { pDateStyle.reset(new XFDateStyle); pDateStyle->AddMonth(false); pDateStyle->AddText("/"); pDateStyle->AddMonthDay(false); } - else if (sFormula == "%Dh") + else if (sFormula == u"%Dh") { pDateStyle.reset(new XFDateStyle); pDateStyle->AddMonth(false); @@ -1082,14 +1082,14 @@ void LwpFribField::RegisterDateTimeStyle(const OUString& sFormula) pDateStyle->AddText("/"); pDateStyle->AddYear(); } - else if (sFormula == "%Di" || sFormula == "%DI") + else if (sFormula == u"%Di" || sFormula == u"%DI") { pDateStyle.reset(new XFDateStyle); pDateStyle->AddMonthDay(false); pDateStyle->AddText("."); pDateStyle->AddMonth(true, true); } - else if (sFormula == "%Dj" || sFormula == "%DJ") + else if (sFormula == u"%Dj" || sFormula == u"%DJ") { pDateStyle.reset(new XFDateStyle); pDateStyle->AddMonthDay(false); @@ -1098,7 +1098,7 @@ void LwpFribField::RegisterDateTimeStyle(const OUString& sFormula) pDateStyle->AddText(" "); pDateStyle->AddYear(); } - else if (sFormula == "%Dk" || sFormula == "%DK") + else if (sFormula == u"%Dk" || sFormula == u"%DK") { pDateStyle.reset(new XFDateStyle); pDateStyle->AddYear(); @@ -1107,14 +1107,14 @@ void LwpFribField::RegisterDateTimeStyle(const OUString& sFormula) pDateStyle->AddText(" "); pDateStyle->AddMonthDay(false); } - else if (sFormula == "%DL" || sFormula == "%Dl") + else if (sFormula == u"%DL" || sFormula == u"%Dl") { pDateStyle.reset(new XFDateStyle); pDateStyle->AddMonth(true, true); pDateStyle->AddText(","); pDateStyle->AddYear(); } - else if (sFormula == "%Dm") + else if (sFormula == u"%Dm") { pDateStyle.reset(new XFDateStyle); pDateStyle->AddMonthDay(); @@ -1126,14 +1126,15 @@ void LwpFribField::RegisterDateTimeStyle(const OUString& sFormula) } else if (sFormula[1] == 'T') { - if (sFormula == "%T1") + if (sFormula == u"%T1") { pTimeStyle.reset(new XFTimeStyle); pTimeStyle->AddHour(); pTimeStyle->AddText(":"); pTimeStyle->AddMinute(); } - else if (sFormula == "%T2" || sFormula == "%T6" || sFormula == "%T4" || sFormula == "%T8") + else if (sFormula == u"%T2" || sFormula == u"%T6" || sFormula == u"%T4" + || sFormula == u"%T8") { pTimeStyle.reset(new XFTimeStyle); pTimeStyle->AddHour(false); @@ -1142,7 +1143,8 @@ void LwpFribField::RegisterDateTimeStyle(const OUString& sFormula) pTimeStyle->AddText(":"); pTimeStyle->SetAmPm(true); } - else if (sFormula == "%T3" || sFormula == "%T7" || sFormula == "%T5" || sFormula == "%T9") + else if (sFormula == u"%T3" || sFormula == u"%T7" || sFormula == u"%T5" + || sFormula == u"%T9") { pTimeStyle.reset(new XFTimeStyle); pTimeStyle->AddHour(); diff --git a/lotuswordpro/source/filter/lwpfribmark.hxx b/lotuswordpro/source/filter/lwpfribmark.hxx index 0f47b204a02f..451f8b802f76 100644 --- a/lotuswordpro/source/filter/lwpfribmark.hxx +++ b/lotuswordpro/source/filter/lwpfribmark.hxx @@ -127,7 +127,7 @@ private: sal_uInt8 m_nDocPowerType; void RegisterTimeField(const LwpFieldMark* pFieldMark); - void RegisterDateTimeStyle(const OUString& sFormula); + void RegisterDateTimeStyle(std::u16string_view sFormula); void RegisterTotalTimeStyle(); void CheckFieldType(LwpFieldMark* pFieldMark); void ConvertDocFieldStart(XFContentContainer* pXFPara,LwpFieldMark* pFieldMark); diff --git a/reportdesign/inc/conditionalexpression.hxx b/reportdesign/inc/conditionalexpression.hxx index 1f42a9badaac..4bac298a2138 100644 --- a/reportdesign/inc/conditionalexpression.hxx +++ b/reportdesign/inc/conditionalexpression.hxx @@ -57,7 +57,7 @@ namespace rptui <TRUE/> if and only if the expression string could be successfully matched to the pattern. */ - bool matchExpression( const OUString& _rExpression, const std::u16string_view _rFieldDataSource, OUString& _out_rLHS, OUString& _out_rRHS ) const; + bool matchExpression( std::u16string_view _rExpression, const std::u16string_view _rFieldDataSource, OUString& _out_rLHS, OUString& _out_rRHS ) const; }; diff --git a/reportdesign/source/core/misc/conditionalexpression.cxx b/reportdesign/source/core/misc/conditionalexpression.cxx index 0a0eda11f3fd..a395a371f445 100644 --- a/reportdesign/source/core/misc/conditionalexpression.cxx +++ b/reportdesign/source/core/misc/conditionalexpression.cxx @@ -64,7 +64,7 @@ namespace rptui } - bool ConditionalExpression::matchExpression( const OUString& _rExpression, const std::u16string_view _rFieldDataSource, OUString& _out_rLHS, OUString& _out_rRHS ) const + bool ConditionalExpression::matchExpression( std::u16string_view _rExpression, const std::u16string_view _rFieldDataSource, OUString& _out_rLHS, OUString& _out_rRHS ) const { // if we had regular expression, the matching would be pretty easy ... // just replace $1 and $2 in the pattern with (.*), and then get them with \1 resp. \2. @@ -90,9 +90,9 @@ namespace rptui // up to the occurrence of the LHS (which must exist, see above), the two expressions // must be identical - if ( _rExpression.getLength() < nLHSIndex ) + if ( sal_Int32(_rExpression.size()) < nLHSIndex ) return false; - const std::u16string_view sExprPart1( _rExpression.subView( 0, nLHSIndex ) ); + const std::u16string_view sExprPart1( _rExpression.substr( 0, nLHSIndex ) ); const std::u16string_view sMatchExprPart1( sMatchExpression.subView( 0, nLHSIndex ) ); if ( sExprPart1 != sMatchExprPart1 ) // the left-most expression parts do not match @@ -103,10 +103,10 @@ namespace rptui bool bHaveRHS( nRHSIndex != -1 ); sal_Int32 nRightMostIndex( bHaveRHS ? nRHSIndex : nLHSIndex ); const std::u16string_view sMatchExprPart3( sMatchExpression.subView( nRightMostIndex + 2 ) ); - if ( o3tl::make_unsigned(_rExpression.getLength()) < sMatchExprPart3.size() ) + if ( _rExpression.size() < sMatchExprPart3.size() ) // the expression is not even long enough to hold the right-most part of the match expression return false; - const std::u16string_view sExprPart3( _rExpression.subView( _rExpression.getLength() - sMatchExprPart3.size() ) ); + const std::u16string_view sExprPart3( _rExpression.substr( _rExpression.size() - sMatchExprPart3.size() ) ); if ( sExprPart3 != sMatchExprPart3 ) // the right-most expression parts do not match return false; @@ -114,7 +114,7 @@ namespace rptui // if we don't have an RHS, we're done if ( !bHaveRHS ) { - _out_rLHS = _rExpression.copy( sExprPart1.size(), _rExpression.getLength() - sExprPart1.size() - sExprPart3.size() ); + _out_rLHS = _rExpression.substr( sExprPart1.size(), _rExpression.size() - sExprPart1.size() - sExprPart3.size() ); return true; } @@ -125,9 +125,9 @@ namespace rptui sMatchExpression.getLength() - nMatchExprPart2Start - sMatchExprPart3.size() - 2 ); // strip the expression by its left-most and right-most part - const std::u16string_view sExpression( _rExpression.subView( + const std::u16string_view sExpression( _rExpression.substr( sExprPart1.size(), - _rExpression.getLength() - sExprPart1.size() - sExprPart3.size() + _rExpression.size() - sExprPart1.size() - sExprPart3.size() ) ); size_t nPart2Index = sExpression.find( sMatchExprPart2 ); diff --git a/scripting/source/provider/MasterScriptProvider.cxx b/scripting/source/provider/MasterScriptProvider.cxx index 190382cee69b..66fc58db78bd 100644 --- a/scripting/source/provider/MasterScriptProvider.cxx +++ b/scripting/source/provider/MasterScriptProvider.cxx @@ -51,11 +51,11 @@ using namespace ::sf_misc; namespace func_provider { -static bool endsWith( const OUString& target, const OUString& item ) +static bool endsWith( std::u16string_view target, std::u16string_view item ) { - sal_Int32 index = target.indexOf( item ); - return index != -1 && - index == ( target.getLength() - item.getLength() ); + size_t index = target.find( item ); + return index != std::u16string_view::npos && + index == ( target.size() - item.size() ); } /* should be available in some central location. */ diff --git a/scripting/source/stringresource/stringresource.cxx b/scripting/source/stringresource/stringresource.cxx index 06b52b0377c7..669da8b2cbba 100644 --- a/scripting/source/stringresource/stringresource.cxx +++ b/scripting/source/stringresource/stringresource.cxx @@ -33,6 +33,7 @@ #include <com/sun/star/ucb/SimpleFileAccess.hpp> #include <osl/diagnose.h> +#include <o3tl/string_view.hxx> #include <rtl/tencinfo.h> #include <rtl/ustrbuf.hxx> #include <tools/urlobj.hxx> @@ -1437,17 +1438,17 @@ void StringResourcePersistenceImpl::importBinary( const Sequence< ::sal_Int8 >& // Private helper methods -static bool checkNamingSceme( const OUString& aName, const OUString& aNameBase, +static bool checkNamingSceme( std::u16string_view aName, std::u16string_view aNameBase, Locale& aLocale ) { bool bSuccess = false; - sal_Int32 nNameLen = aName.getLength(); - sal_Int32 nNameBaseLen = aNameBase.getLength(); + size_t nNameLen = aName.size(); + size_t nNameBaseLen = aNameBase.size(); // Name has to start with NameBase followed // by a '_' and at least one more character - if( aName.startsWith( aNameBase ) && nNameBaseLen < nNameLen-1 && + if( o3tl::starts_with(aName, aNameBase) && nNameBaseLen < nNameLen-1 && aName[nNameBaseLen] == '_' ) { bSuccess = true; @@ -1457,23 +1458,23 @@ static bool checkNamingSceme( const OUString& aName, const OUString& aNameBase, * violate the naming scheme in use. */ sal_Int32 iStart = nNameBaseLen + 1; - sal_Int32 iNext_ = aName.indexOf( '_', iStart ); - if( iNext_ != -1 && iNext_ < nNameLen-1 ) + size_t iNext_ = aName.find( '_', iStart ); + if( iNext_ != std::u16string_view::npos && iNext_ < nNameLen-1 ) { - aLocale.Language = aName.copy( iStart, iNext_ - iStart ); + aLocale.Language = aName.substr( iStart, iNext_ - iStart ); iStart = iNext_ + 1; - iNext_ = aName.indexOf( '_', iStart ); - if( iNext_ != -1 && iNext_ < nNameLen-1 ) + iNext_ = aName.find( '_', iStart ); + if( iNext_ != std::u16string_view::npos && iNext_ < nNameLen-1 ) { - aLocale.Country = aName.copy( iStart, iNext_ - iStart ); - aLocale.Variant = aName.copy( iNext_ + 1 ); + aLocale.Country = aName.substr( iStart, iNext_ - iStart ); + aLocale.Variant = aName.substr( iNext_ + 1 ); } else - aLocale.Country = aName.copy( iStart ); + aLocale.Country = aName.substr( iStart ); } else - aLocale.Language = aName.copy( iStart ); + aLocale.Language = aName.substr( iStart ); } return bSuccess; } diff --git a/sdext/source/minimizer/pppoptimizertoken.cxx b/sdext/source/minimizer/pppoptimizertoken.cxx index 1e020bc027a2..c21880edd8f3 100644 --- a/sdext/source/minimizer/pppoptimizertoken.cxx +++ b/sdext/source/minimizer/pppoptimizertoken.cxx @@ -163,7 +163,7 @@ const TokenTable pTokenTableArray[] = { "NotFound", TK_NotFound } }; -PPPOptimizerTokenEnum TKGet( const OUString& rToken ) +PPPOptimizerTokenEnum TKGet( std::u16string_view rToken ) { if ( !pHashMap ) { // init hash map @@ -179,7 +179,7 @@ PPPOptimizerTokenEnum TKGet( const OUString& rToken ) } } PPPOptimizerTokenEnum eRetValue = TK_NotFound; - int i, nLen = rToken.getLength(); + size_t i, nLen = rToken.size(); std::unique_ptr<char[]> pBuf(new char[ nLen + 1 ]); for ( i = 0; i < nLen; i++ ) pBuf[ i ] = static_cast<char>(rToken[ i ]); diff --git a/sdext/source/minimizer/pppoptimizertoken.hxx b/sdext/source/minimizer/pppoptimizertoken.hxx index d0ae65ed74ab..3f946fcc0b08 100644 --- a/sdext/source/minimizer/pppoptimizertoken.hxx +++ b/sdext/source/minimizer/pppoptimizertoken.hxx @@ -140,7 +140,7 @@ enum PPPOptimizerTokenEnum TK_NotFound }; -PPPOptimizerTokenEnum TKGet(const OUString&); +PPPOptimizerTokenEnum TKGet(std::u16string_view); OUString TKGet(const PPPOptimizerTokenEnum); #endif diff --git a/sdext/source/presenter/PresenterHelpView.cxx b/sdext/source/presenter/PresenterHelpView.cxx index cbce18d17d22..bdfa1ab37fb9 100644 --- a/sdext/source/presenter/PresenterHelpView.cxx +++ b/sdext/source/presenter/PresenterHelpView.cxx @@ -88,7 +88,7 @@ namespace { const OUString msText; std::shared_ptr<vector<LineDescriptor> > mpLineDescriptors; - static void SplitText (const OUString& rsText, vector<OUString>& rTextParts); + static void SplitText (std::u16string_view rsText, vector<OUString>& rTextParts); void FormatText ( const vector<OUString>& rTextParts, const css::uno::Reference<css::rendering::XCanvasFont>& rxFont, @@ -601,21 +601,22 @@ void LineDescriptorList::Update ( } void LineDescriptorList::SplitText ( - const OUString& rsText, + std::u16string_view rsText, vector<OUString>& rTextParts) { const char cQuote ('\''); const char cSeparator (','); - sal_Int32 nIndex (0); - sal_Int32 nStart (0); - sal_Int32 nLength (rsText.getLength()); + size_t nIndex (0); + size_t nStart (0); + size_t nLength (rsText.size()); bool bIsQuoted (false); while (nIndex < nLength) { - const sal_Int32 nQuoteIndex (rsText.indexOf(cQuote, nIndex)); - const sal_Int32 nSeparatorIndex (rsText.indexOf(cSeparator, nIndex)); - if (nQuoteIndex>=0 && (nSeparatorIndex==-1 || nQuoteIndex<nSeparatorIndex)) + const size_t nQuoteIndex (rsText.find(cQuote, nIndex)); + const size_t nSeparatorIndex (rsText.find(cSeparator, nIndex)); + if (nQuoteIndex != std::u16string_view::npos && + (nSeparatorIndex == std::u16string_view::npos || nQuoteIndex<nSeparatorIndex)) { bIsQuoted = !bIsQuoted; nIndex = nQuoteIndex+1; @@ -629,13 +630,13 @@ void LineDescriptorList::SplitText ( } else if ( ! bIsQuoted) { - rTextParts.push_back(rsText.copy(nStart, nNextIndex-nStart)); + rTextParts.push_back(OUString(rsText.substr(nStart, nNextIndex-nStart))); nStart = nNextIndex + 1; } nIndex = nNextIndex+1; } if (nStart < nLength) - rTextParts.push_back(rsText.copy(nStart, nLength-nStart)); + rTextParts.push_back(OUString(rsText.substr(nStart, nLength-nStart))); } void LineDescriptorList::FormatText ( diff --git a/sdext/source/presenter/PresenterProtocolHandler.cxx b/sdext/source/presenter/PresenterProtocolHandler.cxx index e3cdb67f9fea..a32a73b6180e 100644 --- a/sdext/source/presenter/PresenterProtocolHandler.cxx +++ b/sdext/source/presenter/PresenterProtocolHandler.cxx @@ -197,7 +197,7 @@ public: void SAL_CALL disposing() override; static Command* CreateCommand ( - const OUString& rsURLPath, + std::u16string_view rsURLPath, const ::rtl::Reference<PresenterController>& rpPresenterController); // XDispatch @@ -363,41 +363,41 @@ PresenterProtocolHandler::Dispatch::Dispatch ( } Command* PresenterProtocolHandler::Dispatch::CreateCommand ( - const OUString& rsURLPath, + std::u16string_view rsURLPath, const ::rtl::Reference<PresenterController>& rpPresenterController) { - if (rsURLPath.getLength() <= 5) + if (rsURLPath.size() <= 5) return nullptr; - if (rsURLPath == "CloseNotes") + if (rsURLPath == u"CloseNotes") return new SetNotesViewCommand(false, rpPresenterController); - if (rsURLPath == "CloseSlideSorter") + if (rsURLPath == u"CloseSlideSorter") return new SetSlideSorterCommand(false, rpPresenterController); - if (rsURLPath == "CloseHelp") + if (rsURLPath == u"CloseHelp") return new SetHelpViewCommand(false, rpPresenterController); - if (rsURLPath == "GrowNotesFont") + if (rsURLPath == u"GrowNotesFont") return new NotesFontSizeCommand(rpPresenterController, +1); - if (rsURLPath == "NextEffect") + if (rsURLPath == u"NextEffect") return new GotoNextEffectCommand(rpPresenterController); - if (rsURLPath == "NextSlide") + if (rsURLPath == u"NextSlide") return new GotoNextSlideCommand(rpPresenterController); - if (rsURLPath == "PrevSlide") + if (rsURLPath == u"PrevSlide") return new GotoPreviousSlideCommand(rpPresenterController); - if (rsURLPath == "SwitchMonitor") + if (rsURLPath == u"SwitchMonitor") return new SwitchMonitorCommand(rpPresenterController); - if (rsURLPath == "PauseResumeTimer") + if (rsURLPath == u"PauseResumeTimer") return new PauseResumeCommand(rpPresenterController); - if (rsURLPath == "RestartTimer") + if (rsURLPath == u"RestartTimer") return new RestartTimerCommand(rpPresenterController); - if (rsURLPath == "ShowNotes") + if (rsURLPath == u"ShowNotes") return new SetNotesViewCommand(true, rpPresenterController); - if (rsURLPath == "ShowSlideSorter") + if (rsURLPath == u"ShowSlideSorter") return new SetSlideSorterCommand(true, rpPresenterController); - if (rsURLPath == "ShowHelp") + if (rsURLPath == u"ShowHelp") return new SetHelpViewCommand(true, rpPresenterController); - if (rsURLPath == "ShrinkNotesFont") + if (rsURLPath == u"ShrinkNotesFont") return new NotesFontSizeCommand(rpPresenterController, -1); - if (rsURLPath == "ExitPresenter") + if (rsURLPath == u"ExitPresenter") return new ExitPresenterCommand(rpPresenterController); return nullptr; diff --git a/uui/source/iahndl-ssl.cxx b/uui/source/iahndl-ssl.cxx index fce82e8de6c6..24737d4a0353 100644 --- a/uui/source/iahndl-ssl.cxx +++ b/uui/source/iahndl-ssl.cxx @@ -31,6 +31,7 @@ #include <comphelper/lok.hxx> #include <comphelper/sequence.hxx> #include <com/sun/star/uno/Sequence.hxx> +#include <o3tl/string_view.hxx> #include <svl/numformat.hxx> #include <svl/zforlist.hxx> #include <unotools/resmgr.hxx> @@ -80,21 +81,21 @@ getContentPart( std::u16string_view _rRawString ) bool isDomainMatch( - const OUString& hostName, const uno::Sequence< OUString >& certHostNames) + std::u16string_view hostName, const uno::Sequence< OUString >& certHostNames) { for ( const OUString& element : certHostNames){ if (element.isEmpty()) continue; - if (hostName.equalsIgnoreAsciiCase( element )) + if (o3tl::equalsIgnoreAsciiCase( hostName, element )) return true; if (element.startsWith("*") && - hostName.getLength() >= element.getLength() ) + sal_Int32(hostName.size()) >= element.getLength() ) { OUString cmpStr = element.copy( 1 ); - if ( hostName.matchIgnoreAsciiCase( - cmpStr, hostName.getLength() - cmpStr.getLength()) ) + if ( o3tl::matchIgnoreAsciiCase(hostName, + cmpStr, hostName.size() - cmpStr.getLength()) ) return true; } } diff --git a/uui/source/secmacrowarnings.cxx b/uui/source/secmacrowarnings.cxx index 164890efca69..31281c2f5236 100644 --- a/uui/source/secmacrowarnings.cxx +++ b/uui/source/secmacrowarnings.cxx @@ -38,14 +38,14 @@ using namespace ::com::sun::star; namespace { - std::u16string_view GetContentPart( std::u16string_view _rRawString, const OUString& _rPartId ) + std::u16string_view GetContentPart( std::u16string_view _rRawString, std::u16string_view _rPartId ) { std::u16string_view s; size_t nContStart = _rRawString.find( _rPartId ); if( nContStart != std::u16string_view::npos ) { - nContStart = nContStart + _rPartId.getLength(); + nContStart = nContStart + _rPartId.size(); ++nContStart; // now its start of content, directly after Id size_t nContEnd = _rRawString.find( ',', nContStart ); @@ -195,7 +195,7 @@ void MacroWarning::SetCertificate( const css::uno::Reference< css::security::XCe mxCert = _rxCert; if( mxCert.is() ) { - OUString s( GetContentPart( mxCert->getSubjectName(), "CN" ) ); + OUString s( GetContentPart( mxCert->getSubjectName(), u"CN" ) ); mxSignsFI->set_label(s); mxViewSignsBtn->set_sensitive(true); } diff --git a/xmlscript/source/xmldlg_imexp/imp_share.hxx b/xmlscript/source/xmldlg_imexp/imp_share.hxx index ef418446998a..c05460ddf274 100644 --- a/xmlscript/source/xmldlg_imexp/imp_share.hxx +++ b/xmlscript/source/xmldlg_imexp/imp_share.hxx @@ -44,13 +44,13 @@ namespace xmlscript { -inline sal_Int32 toInt32( OUString const & rStr ) +inline sal_Int32 toInt32( std::u16string_view rStr ) { sal_Int32 nVal; - if (rStr.getLength() > 2 && rStr[ 0 ] == '0' && rStr[ 1 ] == 'x') - nVal = o3tl::toUInt32(rStr.subView( 2 ), 16); + if (rStr.size() > 2 && rStr[ 0 ] == '0' && rStr[ 1 ] == 'x') + nVal = o3tl::toUInt32(rStr.substr( 2 ), 16); else - nVal = rStr.toInt32(); + nVal = o3tl::toInt32(rStr); return nVal; } diff --git a/xmlscript/source/xmllib_imexp/imp_share.hxx b/xmlscript/source/xmllib_imexp/imp_share.hxx index 5798c13b92b6..f88474907922 100644 --- a/xmlscript/source/xmllib_imexp/imp_share.hxx +++ b/xmlscript/source/xmllib_imexp/imp_share.hxx @@ -32,16 +32,16 @@ namespace xmlscript { -inline sal_Int32 toInt32( OUString const & rStr ) +inline sal_Int32 toInt32( std::u16string_view rStr ) { sal_Int32 nVal; - if (rStr.getLength() > 2 && rStr[ 0 ] == '0' && rStr[ 1 ] == 'x') + if (rStr.size() > 2 && rStr[ 0 ] == '0' && rStr[ 1 ] == 'x') { - nVal = o3tl::toUInt32(rStr.subView( 2 ), 16); + nVal = o3tl::toUInt32(rStr.substr( 2 ), 16); } else { - nVal = rStr.toInt32(); + nVal = o3tl::toInt32(rStr); } return nVal; } |