diff options
author | Stephan Bergmann <sbergman@redhat.com> | 2020-12-11 17:44:34 +0100 |
---|---|---|
committer | Stephan Bergmann <sbergman@redhat.com> | 2020-12-11 21:25:10 +0100 |
commit | 35e471bb4d1388cf5afcdcee214cf5111edf44e3 (patch) | |
tree | bb78f4f13f131f0cb206a9707cc3cfc495a3876a | |
parent | 0c06e77c122f10a1842bc908bd6e25b1110ddbd2 (diff) |
Adapt the remaining OUString functions to std string_view
...for LIBO_INTERNAL_ONLY. These had been missed by
1b43cceaea2084a0489db68cd0113508f34b6643 "Make many OUString functions take
std::u16string_view parameters" because they did not match the multi-overload
pattern that was addressed there, but they nevertheless benefit from being
changed just as well (witness e.g. the various resulting changes from copy() to
subView()).
This showed a conversion from OStringChar to std::string_view to be missing
(while the corresponding conversion form OUStringChar to std::u16string_view was
already present).
The improvement to loplugin:stringadd became necessary to fix
> [CPT] compilerplugins/clang/test/stringadd.cxx
> error: 'error' diagnostics expected but not seen:
> File ~/lo/core/compilerplugins/clang/test/stringadd.cxx Line 43 (directive at ~/lo/core/compilerplugins/clang/test/stringadd.cxx:42): simplify by merging with the preceding assignment [loplugin:stringadd]
> File ~/lo/core/compilerplugins/clang/test/stringadd.cxx Line 61 (directive at ~/lo/core/compilerplugins/clang/test/stringadd.cxx:60): simplify by merging with the preceding assignment [loplugin:stringadd]
> 2 errors generated.
Change-Id: Ie40de0616a66e60e289c1af0ca60aed6f9ecc279
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/107602
Tested-by: Jenkins
Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
361 files changed, 1315 insertions, 846 deletions
diff --git a/avmedia/source/gstreamer/gstframegrabber.cxx b/avmedia/source/gstreamer/gstframegrabber.cxx index 7da1917a019b..c1341d8d6ad4 100644 --- a/avmedia/source/gstreamer/gstframegrabber.cxx +++ b/avmedia/source/gstreamer/gstframegrabber.cxx @@ -48,7 +48,7 @@ void FrameGrabber::disposePipeline() } } -FrameGrabber::FrameGrabber( const OUString &rURL ) : +FrameGrabber::FrameGrabber( std::u16string_view rURL ) : FrameGrabber_BASE() { gchar *pPipelineStr; @@ -87,7 +87,7 @@ FrameGrabber::~FrameGrabber() disposePipeline(); } -FrameGrabber* FrameGrabber::create( const OUString &rURL ) +FrameGrabber* FrameGrabber::create( std::u16string_view rURL ) { return new FrameGrabber( rURL ); } diff --git a/avmedia/source/gstreamer/gstframegrabber.hxx b/avmedia/source/gstreamer/gstframegrabber.hxx index 03c4af65f1a9..b99401526506 100644 --- a/avmedia/source/gstreamer/gstframegrabber.hxx +++ b/avmedia/source/gstreamer/gstframegrabber.hxx @@ -19,6 +19,10 @@ #pragma once +#include <sal/config.h> + +#include <string_view> + #include "gstplayer.hxx" #include <com/sun/star/media/XFrameGrabber.hpp> #include <cppuhelper/implbase.hxx> @@ -39,7 +43,7 @@ public: const FrameGrabber& operator=(const FrameGrabber&) =delete; // static create method instead of public Ctor - static FrameGrabber* create( const OUString &rURL ); + static FrameGrabber* create( std::u16string_view rURL ); virtual ~FrameGrabber() override; @@ -52,7 +56,7 @@ public: virtual css::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames( ) override; private: - explicit FrameGrabber( const OUString &aURL ); + explicit FrameGrabber( std::u16string_view aURL ); }; } // avmedia::gst diff --git a/avmedia/source/gstreamer/gstplayer.cxx b/avmedia/source/gstreamer/gstplayer.cxx index 932e1dd1c6e1..4efbc6497b09 100644 --- a/avmedia/source/gstreamer/gstplayer.cxx +++ b/avmedia/source/gstreamer/gstplayer.cxx @@ -527,7 +527,7 @@ GstBusSyncReply Player::processSyncMessage( GstMessage *message ) return GST_BUS_PASS; } -void Player::preparePlaybin( const OUString& rURL, GstElement *pSink ) +void Player::preparePlaybin( std::u16string_view rURL, GstElement *pSink ) { if (mpPlaybin != nullptr) { diff --git a/avmedia/source/gstreamer/gstplayer.hxx b/avmedia/source/gstreamer/gstplayer.hxx index 4a239ca1d2a6..a82dac3f2b39 100644 --- a/avmedia/source/gstreamer/gstplayer.hxx +++ b/avmedia/source/gstreamer/gstplayer.hxx @@ -19,6 +19,10 @@ #pragma once +#include <sal/config.h> + +#include <string_view> + #include <osl/conditn.hxx> #include "gstcommon.hxx" @@ -42,7 +46,7 @@ public: explicit Player(); virtual ~Player() override; - void preparePlaybin( const OUString& rURL, GstElement *pSink ); + void preparePlaybin( std::u16string_view rURL, GstElement *pSink ); bool create( const OUString& rURL ); void processMessage( GstMessage *message ); GstBusSyncReply processSyncMessage( GstMessage *message ); diff --git a/basctl/source/basicide/baside2.hxx b/basctl/source/basicide/baside2.hxx index 0f304adb83b0..dfe78c588ebe 100644 --- a/basctl/source/basicide/baside2.hxx +++ b/basctl/source/basicide/baside2.hxx @@ -35,6 +35,7 @@ #include <rtl/ustrbuf.hxx> #include <set> +#include <string_view> #include <vcl/textdata.hxx> #include <basic/codecompletecache.hxx> @@ -58,7 +59,7 @@ class ModulWindowLayout; // tools Strings limited to 64K). // defined in baside2b.cxx OUString getTextEngineText (ExtTextEngine&); -void setTextEngineText (ExtTextEngine&, OUString const&); +void setTextEngineText (ExtTextEngine&, std::u16string_view); class EditorWindow final : public vcl::Window, public SfxListener { diff --git a/basctl/source/basicide/baside2b.cxx b/basctl/source/basicide/baside2b.cxx index 0fe305fc990f..e3ac323e11ff 100644 --- a/basctl/source/basicide/baside2b.cxx +++ b/basctl/source/basicide/baside2b.cxx @@ -121,7 +121,7 @@ OUString getTextEngineText (ExtTextEngine& rEngine) return aText; } -void setTextEngineText (ExtTextEngine& rEngine, OUString const& aStr) +void setTextEngineText (ExtTextEngine& rEngine, std::u16string_view aStr) { rEngine.SetText(OUString()); OString aUTF8Str = OUStringToOString( aStr, RTL_TEXTENCODING_UTF8 ); diff --git a/basic/source/classes/image.cxx b/basic/source/classes/image.cxx index 0fd760a1c21b..0641c1337569 100644 --- a/basic/source/classes/image.cxx +++ b/basic/source/classes/image.cxx @@ -28,6 +28,7 @@ #include <image.hxx> #include <codegen.hxx> #include <memory> +#include <string_view> SbiImage::SbiImage() : bError(false) @@ -459,7 +460,7 @@ bool SbiImage::Save( SvStream& r, sal_uInt32 nVer ) for( size_t i = 0; i < mvStringOffsets.size(); i++ ) { sal_uInt16 nOff = static_cast<sal_uInt16>(mvStringOffsets[ i ]); - OString aStr(OUStringToOString(OUString(pStrings.get() + nOff), eCharSet)); + OString aStr(OUStringToOString(std::u16string_view(pStrings.get() + nOff), eCharSet)); memcpy( pByteStrings.get() + nOff, aStr.getStr(), (aStr.getLength() + 1) * sizeof( char ) ); } r.WriteUInt32( nStringSize ); diff --git a/basic/source/inc/iosys.hxx b/basic/source/inc/iosys.hxx index 9f60c4f29c50..7fb75a2e113c 100644 --- a/basic/source/inc/iosys.hxx +++ b/basic/source/inc/iosys.hxx @@ -20,6 +20,8 @@ #pragma once #include <memory> +#include <string_view> + #include <tools/stream.hxx> #include <o3tl/typed_flags_set.hxx> @@ -58,7 +60,7 @@ class SbiStream public: SbiStream(); ~SbiStream(); - ErrCode const & Open( const OString&, StreamMode, SbiStreamFlags, short ); + ErrCode const & Open( std::string_view, StreamMode, SbiStreamFlags, short ); ErrCode const & Close(); ErrCode Read(OString&, sal_uInt16 = 0, bool bForceReadingPerByte=false); ErrCode const & Read( char& ); @@ -96,7 +98,7 @@ public: void SetChannel( short n ) { nChan = n; } short GetChannel() const { return nChan;} void ResetChannel() { nChan = 0; } - void Open( short, const OString&, StreamMode, SbiStreamFlags, short ); + void Open( short, std::string_view, StreamMode, SbiStreamFlags, short ); void Close(); void Read(OString&); char Read(); diff --git a/basic/source/runtime/iosys.cxx b/basic/source/runtime/iosys.cxx index d525d1a13801..6fc681f48492 100644 --- a/basic/source/runtime/iosys.cxx +++ b/basic/source/runtime/iosys.cxx @@ -421,7 +421,7 @@ void UCBStream::SetSize( sal_uInt64 ) ErrCode const & SbiStream::Open -( const OString& rName, StreamMode nStrmMode, SbiStreamFlags nFlags, short nL ) +( std::string_view rName, StreamMode nStrmMode, SbiStreamFlags nFlags, short nL ) { nMode = nFlags; nLen = nL; @@ -631,7 +631,7 @@ ErrCode SbiIoSystem::GetError() return n; } -void SbiIoSystem::Open(short nCh, const OString& rName, StreamMode nMode, SbiStreamFlags nFlags, short nLen) +void SbiIoSystem::Open(short nCh, std::string_view rName, StreamMode nMode, SbiStreamFlags nFlags, short nLen) { nError = ERRCODE_NONE; if( nCh >= CHANNELS || !nCh ) diff --git a/basic/source/runtime/methods.cxx b/basic/source/runtime/methods.cxx index 1fbcdd9680e2..84d51c760f1e 100644 --- a/basic/source/runtime/methods.cxx +++ b/basic/source/runtime/methods.cxx @@ -63,6 +63,7 @@ #include <com/sun/star/bridge/oleautomation/XAutomationObject.hpp> #include <memory> #include <random> +#include <string_view> #include <o3tl/char16_t2wchar_t.hxx> using namespace comphelper; @@ -2575,7 +2576,7 @@ static OUString implSetupWildcard(const OUString& rFileParam, SbiRTLData& rRTLDa return aPathStr; } -static bool implCheckWildcard(const OUString& rName, SbiRTLData const& rRTLData) +static bool implCheckWildcard(std::u16string_view rName, SbiRTLData const& rRTLData) { bool bMatch = true; diff --git a/basic/source/sbx/sbxvalue.cxx b/basic/source/sbx/sbxvalue.cxx index 90edef4cb7e7..19ddc1aa2a64 100644 --- a/basic/source/sbx/sbxvalue.cxx +++ b/basic/source/sbx/sbxvalue.cxx @@ -20,6 +20,7 @@ #include <config_features.h> #include <math.h> +#include <string_view> #include <o3tl/float_int_conversion.hxx> #include <tools/debug.hxx> @@ -1499,7 +1500,7 @@ bool SbxValue::LoadData( SvStream& r, sal_uInt16 ) } else { - write_uInt16_lenPrefixed_uInt8s_FromOUString(r, OUString(), RTL_TEXTENCODING_ASCII_US); + write_uInt16_lenPrefixed_uInt8s_FromOUString(r, std::u16string_view(), RTL_TEXTENCODING_ASCII_US); } break; case SbxERROR: diff --git a/chart2/qa/extras/chart2dump/chart2dump.cxx b/chart2/qa/extras/chart2dump/chart2dump.cxx index 7fd7c4a8da61..a3ad005ea0e7 100644 --- a/chart2/qa/extras/chart2dump/chart2dump.cxx +++ b/chart2/qa/extras/chart2dump/chart2dump.cxx @@ -124,7 +124,7 @@ protected: { if (m_aReferenceFile.is_open()) m_aReferenceFile.close(); - OString sReferenceFile = OUStringToOString(m_directories.getPathFromSrc(getReferenceDirName()) + sFileName, RTL_TEXTENCODING_UTF8); + OString sReferenceFile = OUStringToOString(OUString(m_directories.getPathFromSrc(getReferenceDirName()) + sFileName), RTL_TEXTENCODING_UTF8); m_aReferenceFile.open(sReferenceFile.getStr(), std::ios_base::in); CPPUNIT_ASSERT_MESSAGE(OString("Can't open reference file: " + sReferenceFile).getStr(), m_aReferenceFile.is_open()); } @@ -132,7 +132,7 @@ protected: { if (m_aDumpFile.is_open()) m_aDumpFile.close(); - OString sDumpFile = OUStringToOString(m_directories.getPathFromSrc(getReferenceDirName()) + sFileName, RTL_TEXTENCODING_UTF8); + OString sDumpFile = OUStringToOString(OUString(m_directories.getPathFromSrc(getReferenceDirName()) + sFileName), RTL_TEXTENCODING_UTF8); m_aDumpFile.open(sDumpFile.getStr(), std::ios_base::out | std::ofstream::binary | std::ofstream::trunc); CPPUNIT_ASSERT_MESSAGE(OString("Can't open dump file: " + sDumpFile).getStr(), m_aDumpFile.is_open()); } diff --git a/chart2/qa/extras/chart2geometry.cxx b/chart2/qa/extras/chart2geometry.cxx index 6ded1a5e76ab..c15f15f66864 100644 --- a/chart2/qa/extras/chart2geometry.cxx +++ b/chart2/qa/extras/chart2geometry.cxx @@ -23,6 +23,7 @@ #include <libxml/xpathInternals.h> #include <algorithm> +#include <string_view> using uno::Reference; using beans::XPropertySet; @@ -170,7 +171,7 @@ void Chart2GeometryTest::registerNamespaces(xmlXPathContextPtr& pXmlXPathCtx) } } -static OString OU2O(const OUString& sOUSource) +static OString OU2O(std::u16string_view sOUSource) { return rtl::OUStringToOString(sOUSource, RTL_TEXTENCODING_UTF8); } diff --git a/chart2/qa/extras/xshape/chart2xshape.cxx b/chart2/qa/extras/xshape/chart2xshape.cxx index a1a0032effc3..3acb981cb78d 100644 --- a/chart2/qa/extras/xshape/chart2xshape.cxx +++ b/chart2/qa/extras/xshape/chart2xshape.cxx @@ -16,6 +16,7 @@ #include <test/xmltesttools.hxx> #include <fstream> +#include <string_view> class Chart2XShapeTest : public ChartTest, public XmlTestTools { @@ -49,7 +50,7 @@ private: namespace { -bool checkDumpAgainstFile(const OUString& rDump, const OUString& aFilePath) +bool checkDumpAgainstFile(const OUString& rDump, std::u16string_view aFilePath) { OString aOFile = OUStringToOString(aFilePath, RTL_TEXTENCODING_UTF8); diff --git a/chart2/source/controller/inc/ChartController.hxx b/chart2/source/controller/inc/ChartController.hxx index aa399f2164b3..cecef8f81f0d 100644 --- a/chart2/source/controller/inc/ChartController.hxx +++ b/chart2/source/controller/inc/ChartController.hxx @@ -40,6 +40,7 @@ #include <com/sun/star/lang/XMultiServiceFactory.hpp> #include <memory> +#include <string_view> namespace com::sun::star::accessibility { class XAccessible; } namespace com::sun::star::accessibility { class XAccessibleContext; } @@ -426,7 +427,7 @@ private: //executeDispatch methods void executeDispatch_ObjectProperties(); - void executeDispatch_FormatObject( const OUString& rDispatchCommand ); + void executeDispatch_FormatObject( std::u16string_view rDispatchCommand ); void executeDlg_ObjectProperties( const OUString& rObjectCID ); bool executeDlg_ObjectProperties_withoutUndoGuard( const OUString& rObjectCID, bool bSuccessOnUnchanged ); diff --git a/chart2/source/controller/main/ChartController_Properties.cxx b/chart2/source/controller/main/ChartController_Properties.cxx index 687625b89c51..666c9979830e 100644 --- a/chart2/source/controller/main/ChartController_Properties.cxx +++ b/chart2/source/controller/main/ChartController_Properties.cxx @@ -650,7 +650,7 @@ OUString lcl_getObjectCIDForCommand( std::string_view rDispatchCommand, const un } // anonymous namespace -void ChartController::executeDispatch_FormatObject(const OUString& rDispatchCommand) +void ChartController::executeDispatch_FormatObject(std::u16string_view rDispatchCommand) { uno::Reference< XChartDocument > xChartDocument( getModel(), uno::UNO_QUERY ); OString aCommand( OUStringToOString( rDispatchCommand, RTL_TEXTENCODING_ASCII_US ) ); diff --git a/codemaker/source/codemaker/global.cxx b/codemaker/source/codemaker/global.cxx index 8d9b5907252f..be8543cde74c 100644 --- a/codemaker/source/codemaker/global.cxx +++ b/codemaker/source/codemaker/global.cxx @@ -356,7 +356,7 @@ FileStream &operator<<(FileStream& o, const OStringBuffer& s) { return o; } -FileStream & operator <<(FileStream & out, OUString const & s) { +FileStream & operator <<(FileStream & out, std::u16string_view s) { return out << OUStringToOString(s, RTL_TEXTENCODING_UTF8); } diff --git a/codemaker/source/commoncpp/commoncpp.cxx b/codemaker/source/commoncpp/commoncpp.cxx index b7eaac4ae59e..efe0dd0b48bf 100644 --- a/codemaker/source/commoncpp/commoncpp.cxx +++ b/codemaker/source/commoncpp/commoncpp.cxx @@ -63,7 +63,7 @@ OString scopedCppName(OString const & type, bool ns_alias) } OString translateUnoToCppType( - codemaker::UnoType::Sort sort, OUString const & nucleus) + codemaker::UnoType::Sort sort, std::u16string_view nucleus) { OStringBuffer buf; if (sort <= codemaker::UnoType::Sort::Any) { @@ -75,7 +75,7 @@ OString translateUnoToCppType( buf.append(cppTypes[static_cast<int>(sort)]); } else { if (sort == codemaker::UnoType::Sort::Interface - && nucleus == "com.sun.star.uno.XInterface") + && nucleus == u"com.sun.star.uno.XInterface") { buf.append("::css::uno::XInterface"); } else { diff --git a/codemaker/source/cppumaker/cpputype.cxx b/codemaker/source/cppumaker/cpputype.cxx index 75906b9c5f00..c98d8d76e214 100644 --- a/codemaker/source/cppumaker/cpputype.cxx +++ b/codemaker/source/cppumaker/cpputype.cxx @@ -25,6 +25,7 @@ #include <cstdlib> #include <map> #include <set> +#include <string_view> #include <memory> #include <vector> #include <iostream> @@ -164,7 +165,7 @@ public: void dump(CppuOptions const & options); void dumpFile( - OUString const & uri, OUString const & name, bool hpp, + std::u16string_view uri, OUString const & name, bool hpp, CppuOptions const & options); void dumpDependedTypes( @@ -219,7 +220,7 @@ protected: OUString resolveOuterTypedefs(OUString const & name) const; - OUString resolveAllTypedefs(OUString const & name) const; + OUString resolveAllTypedefs(std::u16string_view name) const; codemaker::cpp::IdentifierTranslationMode isGlobal() const; @@ -412,7 +413,7 @@ void CppuType::dump(CppuOptions const & options) } void CppuType::dumpFile( - OUString const & uri, OUString const & name, bool hpp, + std::u16string_view uri, OUString const & name, bool hpp, CppuOptions const & options) { OUString fileUri( @@ -990,7 +991,7 @@ OUString CppuType::resolveOuterTypedefs(OUString const & name) const } } -OUString CppuType::resolveAllTypedefs(OUString const & name) const +OUString CppuType::resolveAllTypedefs(std::u16string_view name) const { sal_Int32 k1; OUString n(b2u(codemaker::UnoType::decompose(u2b(name), &k1))); @@ -1126,11 +1127,11 @@ private: } void dumpExceptionTypeName( - FileStream & out, OUString const & prefix, sal_uInt32 index, - OUString const & name) const; + FileStream & out, std::u16string_view prefix, sal_uInt32 index, + std::u16string_view name) const; sal_Int32 dumpExceptionTypeNames( - FileStream & out, OUString const & prefix, + FileStream & out, std::u16string_view prefix, std::vector< OUString > const & exceptions, bool runtimeException) const; rtl::Reference< unoidl::InterfaceTypeEntity > entity_; @@ -1456,9 +1457,9 @@ void InterfaceType::dumpCppuAttributes(FileStream & out, sal_uInt32 & index) << "::rtl::OUString sAttributeName" << n << "( \"" << name_ << "::" << attr.name << "\" );\n"; sal_Int32 getExcn = dumpExceptionTypeNames( - out, "get", attr.getExceptions, false); + out, u"get", attr.getExceptions, false); sal_Int32 setExcn = dumpExceptionTypeNames( - out, "set", attr.setExceptions, false); + out, u"set", attr.setExceptions, false); out << indent() << ("typelib_typedescription_newExtendedInterfaceAttribute(" " &pAttribute,\n"); @@ -1525,7 +1526,7 @@ void InterfaceType::dumpCppuMethods(FileStream & out, sal_uInt32 & index) ++m; } sal_Int32 excn = dumpExceptionTypeNames( - out, "", method.exceptions, + out, u"", method.exceptions, method.name != "acquire" && method.name != "release"); out << indent() << "::rtl::OUString sReturnType" << n << "( \"" << returnType << "\" );\n" << indent() @@ -1589,15 +1590,15 @@ void InterfaceType::dumpMethodsCppuDecl( } void InterfaceType::dumpExceptionTypeName( - FileStream & out, OUString const & prefix, sal_uInt32 index, - OUString const & name) const + FileStream & out, std::u16string_view prefix, sal_uInt32 index, + std::u16string_view name) const { out << indent() << "::rtl::OUString the_" << prefix << "ExceptionName" << index << "( \"" << name << "\" );\n"; } sal_Int32 InterfaceType::dumpExceptionTypeNames( - FileStream & out, OUString const & prefix, + FileStream & out, std::u16string_view prefix, std::vector< OUString > const & exceptions, bool runtimeException) const { sal_Int32 count = 0; @@ -1608,7 +1609,7 @@ sal_Int32 InterfaceType::dumpExceptionTypeNames( } if (runtimeException) { dumpExceptionTypeName( - out, prefix, count++, "com.sun.star.uno.RuntimeException"); + out, prefix, count++, u"com.sun.star.uno.RuntimeException"); } if (count != 0) { out << indent() << "rtl_uString * the_" << prefix << "Exceptions[] = {"; @@ -1765,7 +1766,7 @@ void ConstantGroup::dumpDeclaration(FileStream & out) } } -void dumpTypeParameterName(FileStream & out, OUString const & name) +void dumpTypeParameterName(FileStream & out, std::u16string_view name) { // Prefix all type parameters with "typeparam_" to avoid problems when a // struct member has the same name as a type parameter, as in @@ -2722,7 +2723,7 @@ void PolyStructType::dumpTemplateParameters(FileStream & out) const out << " >"; } -OUString typeToIdentifier(OUString const & name) +OUString typeToIdentifier(std::u16string_view name) { sal_Int32 k; OUString n(b2u(codemaker::UnoType::decompose(u2b(name), &k))); @@ -3553,7 +3554,7 @@ private: }; void failsToSupply( - FileStream & o, OUString const & service, OString const & type) + FileStream & o, std::u16string_view service, OString const & type) { o << "::rtl::OUString(\"component context fails to supply service \") + \"" << service << "\" + \" of type \" + \"" << type << "\""; diff --git a/codemaker/source/cppumaker/dumputils.cxx b/codemaker/source/cppumaker/dumputils.cxx index 1f993b3ef7d8..15b62e04a407 100644 --- a/codemaker/source/cppumaker/dumputils.cxx +++ b/codemaker/source/cppumaker/dumputils.cxx @@ -70,7 +70,7 @@ bool dumpNamespaceClose( } void dumpTypeIdentifier(FileStream & out, OUString const & entityName) { - out << entityName.copy(entityName.lastIndexOf('.') + 1); + out << entityName.subView(entityName.lastIndexOf('.') + 1); } } diff --git a/codemaker/source/cppumaker/includes.cxx b/codemaker/source/cppumaker/includes.cxx index a07c651bec01..db7dae46bccc 100644 --- a/codemaker/source/cppumaker/includes.cxx +++ b/codemaker/source/cppumaker/includes.cxx @@ -265,7 +265,7 @@ void Includes::dumpInclude( << (hpp ? "hpp" : "hdl") << "\"\n"; } -bool Includes::isInterfaceType(OString const & entityName) const { +bool Includes::isInterfaceType(std::string_view entityName) const { return m_manager->getSort(b2u(entityName)) == UnoType::Sort::Interface; } diff --git a/codemaker/source/cppumaker/includes.hxx b/codemaker/source/cppumaker/includes.hxx index d8070217fe3b..0362c417ac2a 100644 --- a/codemaker/source/cppumaker/includes.hxx +++ b/codemaker/source/cppumaker/includes.hxx @@ -21,6 +21,7 @@ #include <rtl/ref.hxx> #include <rtl/ustring.hxx> +#include <string_view> #include <vector> #include "dependencies.hxx" @@ -68,7 +69,7 @@ private: Includes(Includes const &) = delete; Includes& operator =(const Includes&) = delete; - bool isInterfaceType(OString const & entityName) const; + bool isInterfaceType(std::string_view entityName) const; rtl::Reference< TypeManager > m_manager; Dependencies::Map m_map; diff --git a/comphelper/qa/string/test_string.cxx b/comphelper/qa/string/test_string.cxx index faedac30260f..10b69fbf8243 100644 --- a/comphelper/qa/string/test_string.cxx +++ b/comphelper/qa/string/test_string.cxx @@ -91,7 +91,7 @@ public: const OUString& str1, sal_Int32 off1, sal_Int32 len1, const OUString& str2, sal_Int32 off2, sal_Int32 len2) override { - return str1.copy(off1, len1).compareTo(str2.copy(off2, len2)); + return str1.copy(off1, len1).compareTo(str2.subView(off2, len2)); } virtual sal_Int32 SAL_CALL compareString( const OUString& str1, @@ -238,7 +238,7 @@ void TestString::testNatural() ); // Original behavior CPPUNIT_ASSERT( - OUString("Heading 9").compareTo("Heading 10") > 0 + OUString("Heading 9").compareTo(u"Heading 10") > 0 ); CPPUNIT_ASSERT( compareNatural("Heading 10", "Heading 9", xCollator, xBI, lang::Locale()) > 0 @@ -248,7 +248,7 @@ void TestString::testNatural() compareNatural("July, the 4th", "July, the 10th", xCollator, xBI, lang::Locale()) < 0 ); CPPUNIT_ASSERT( - OUString("July, the 4th").compareTo("July, the 10th") > 0 + OUString("July, the 4th").compareTo(u"July, the 10th") > 0 ); CPPUNIT_ASSERT( compareNatural("July, the 10th", "July, the 4th", xCollator, xBI, lang::Locale()) > 0 @@ -258,7 +258,7 @@ void TestString::testNatural() compareNatural("abc08", "abc010", xCollator, xBI, lang::Locale()) < 0 ); CPPUNIT_ASSERT( - OUString("abc08").compareTo("abc010") > 0 + OUString("abc08").compareTo(u"abc010") > 0 ); CPPUNIT_ASSERT( compareNatural("abc010", "abc08", xCollator, xBI, lang::Locale()) > 0 diff --git a/comphelper/source/misc/docpasswordhelper.cxx b/comphelper/source/misc/docpasswordhelper.cxx index 4cc0f5c74269..bd8ce5d7de7f 100644 --- a/comphelper/source/misc/docpasswordhelper.cxx +++ b/comphelper/source/misc/docpasswordhelper.cxx @@ -20,6 +20,7 @@ #include <config_gpgme.h> #include <algorithm> +#include <string_view> #include <comphelper/docpasswordhelper.hxx> #include <comphelper/storagehelper.hxx> @@ -56,11 +57,11 @@ using namespace ::com::sun::star; namespace comphelper { -static uno::Sequence< sal_Int8 > GeneratePBKDF2Hash( const OUString& aPassword, const uno::Sequence< sal_Int8 >& aSalt, sal_Int32 nCount, sal_Int32 nHashLength ) +static uno::Sequence< sal_Int8 > GeneratePBKDF2Hash( std::u16string_view aPassword, const uno::Sequence< sal_Int8 >& aSalt, sal_Int32 nCount, sal_Int32 nHashLength ) { uno::Sequence< sal_Int8 > aResult; - if ( !aPassword.isEmpty() && aSalt.hasElements() && nCount && nHashLength ) + if ( !aPassword.empty() && aSalt.hasElements() && nCount && nHashLength ) { OString aBytePass = OUStringToOString( aPassword, RTL_TEXTENCODING_UTF8 ); // FIXME this is subject to the SHA1-bug tdf#114939 - see also @@ -84,7 +85,7 @@ IDocPasswordVerifier::~IDocPasswordVerifier() } -uno::Sequence< beans::PropertyValue > DocPasswordHelper::GenerateNewModifyPasswordInfo( const OUString& aPassword ) +uno::Sequence< beans::PropertyValue > DocPasswordHelper::GenerateNewModifyPasswordInfo( std::u16string_view aPassword ) { uno::Sequence< beans::PropertyValue > aResult; @@ -109,10 +110,10 @@ uno::Sequence< beans::PropertyValue > DocPasswordHelper::GenerateNewModifyPasswo } -bool DocPasswordHelper::IsModifyPasswordCorrect( const OUString& aPassword, const uno::Sequence< beans::PropertyValue >& aInfo ) +bool DocPasswordHelper::IsModifyPasswordCorrect( std::u16string_view aPassword, const uno::Sequence< beans::PropertyValue >& aInfo ) { bool bResult = false; - if ( !aPassword.isEmpty() && aInfo.hasElements() ) + if ( !aPassword.empty() && aInfo.hasElements() ) { OUString sAlgorithm; uno::Sequence< sal_Int8 > aSalt; @@ -223,7 +224,7 @@ sal_uInt32 DocPasswordHelper::GetWordHashAsUINT32( sal_uInt16 DocPasswordHelper::GetXLHashAsUINT16( - const OUString& aUString, + std::u16string_view aUString, rtl_TextEncoding nEnc ) { sal_uInt16 nResult = 0; @@ -248,7 +249,7 @@ sal_uInt16 DocPasswordHelper::GetXLHashAsUINT16( Sequence< sal_Int8 > DocPasswordHelper::GetXLHashAsSequence( - const OUString& aUString ) + std::u16string_view aUString ) { sal_uInt16 nHash = GetXLHashAsUINT16( aUString ); return {sal_Int8(nHash >> 8), sal_Int8(nHash & 0xFF)}; diff --git a/comphelper/source/misc/storagehelper.cxx b/comphelper/source/misc/storagehelper.cxx index 8308e9138514..43739da24c10 100644 --- a/comphelper/source/misc/storagehelper.cxx +++ b/comphelper/source/misc/storagehelper.cxx @@ -379,11 +379,11 @@ uno::Reference< embed::XStorage > OStorageHelper::GetStorageOfFormatFromStream( } -uno::Sequence< beans::NamedValue > OStorageHelper::CreatePackageEncryptionData( const OUString& aPassword ) +uno::Sequence< beans::NamedValue > OStorageHelper::CreatePackageEncryptionData( std::u16string_view aPassword ) { // TODO/LATER: Should not the method be part of DocPasswordHelper? uno::Sequence< beans::NamedValue > aEncryptionData; - if ( !aPassword.isEmpty() ) + if ( !aPassword.empty() ) { sal_Int32 nSha1Ind = 0; // generate SHA256 start key diff --git a/compilerplugins/clang/stringadd.cxx b/compilerplugins/clang/stringadd.cxx index 3410c2a6c436..b4994ab60ec6 100644 --- a/compilerplugins/clang/stringadd.cxx +++ b/compilerplugins/clang/stringadd.cxx @@ -291,18 +291,36 @@ bool StringAdd::isSideEffectFree(Expr const* expr) { // check for calls through OUString::number/OUString::unacquired if (auto calleeMethodDecl = dyn_cast_or_null<CXXMethodDecl>(callExpr->getCalleeDecl())) - if (calleeMethodDecl && calleeMethodDecl->getIdentifier()) + if (calleeMethodDecl) { - auto name = calleeMethodDecl->getName(); - if (callExpr->getNumArgs() > 0 - && (name == "number" || name == "unacquired" || name == "boolean" - || name == "copy")) + if (calleeMethodDecl->getIdentifier()) { - auto tc = loplugin::TypeCheck(calleeMethodDecl->getParent()); - if (tc.Class("OUString") || tc.Class("OString")) + auto name = calleeMethodDecl->getName(); + if (callExpr->getNumArgs() > 0 + && (name == "number" || name == "unacquired" || name == "boolean" + || name == "copy")) { - if (isSideEffectFree(callExpr->getArg(0))) - return true; + auto tc = loplugin::TypeCheck(calleeMethodDecl->getParent()); + if (tc.Class("OUString") || tc.Class("OString")) + { + if (isSideEffectFree(callExpr->getArg(0))) + return true; + } + } + } + else if (auto const d = dyn_cast<CXXConversionDecl>(calleeMethodDecl)) + { + if (loplugin::TypeCheck(d->getConversionType()) + .ClassOrStruct("basic_string_view") + .StdNamespace()) + { + auto const tc = loplugin::TypeCheck(calleeMethodDecl->getParent()); + if (tc.Class("OUString").Namespace("rtl").GlobalNamespace() + || tc.Class("OString").Namespace("rtl").GlobalNamespace()) + { + if (isSideEffectFree(callExpr->getCallee())) + return true; + } } } } diff --git a/connectivity/source/commontools/CommonTools.cxx b/connectivity/source/commontools/CommonTools.cxx index 5c84bf6e6f18..223129a71e92 100644 --- a/connectivity/source/commontools/CommonTools.cxx +++ b/connectivity/source/commontools/CommonTools.cxx @@ -141,7 +141,7 @@ namespace connectivity return aRet; } - bool existsJavaClassByName( const ::rtl::Reference< jvmaccess::VirtualMachine >& _pJVM,const OUString& _sClassName ) + bool existsJavaClassByName( const ::rtl::Reference< jvmaccess::VirtualMachine >& _pJVM,std::u16string_view _sClassName ) { bool bRet = false; if ( _pJVM.is() ) diff --git a/connectivity/source/commontools/DriversConfig.cxx b/connectivity/source/commontools/DriversConfig.cxx index 9d2ab8a475d7..c95d30091184 100644 --- a/connectivity/source/commontools/DriversConfig.cxx +++ b/connectivity/source/commontools/DriversConfig.cxx @@ -144,7 +144,7 @@ DriversConfig& DriversConfig::operator=( const DriversConfig& _rhs ) } -OUString DriversConfig::getDriverFactoryName(const OUString& _sURL) const +OUString DriversConfig::getDriverFactoryName(std::u16string_view _sURL) const { const TInstalledDrivers& rDrivers = m_aNode->getInstalledDrivers(m_xORB); OUString sRet; @@ -162,7 +162,7 @@ OUString DriversConfig::getDriverFactoryName(const OUString& _sURL) const return sRet; } -OUString DriversConfig::getDriverTypeDisplayName(const OUString& _sURL) const +OUString DriversConfig::getDriverTypeDisplayName(std::u16string_view _sURL) const { const TInstalledDrivers& rDrivers = m_aNode->getInstalledDrivers(m_xORB); OUString sRet; @@ -180,22 +180,25 @@ OUString DriversConfig::getDriverTypeDisplayName(const OUString& _sURL) const return sRet; } -const ::comphelper::NamedValueCollection& DriversConfig::getProperties(const OUString& _sURL) const +const ::comphelper::NamedValueCollection& DriversConfig::getProperties(std::u16string_view _sURL) + const { return impl_get(_sURL,1); } -const ::comphelper::NamedValueCollection& DriversConfig::getFeatures(const OUString& _sURL) const +const ::comphelper::NamedValueCollection& DriversConfig::getFeatures(std::u16string_view _sURL) + const { return impl_get(_sURL,0); } -const ::comphelper::NamedValueCollection& DriversConfig::getMetaData(const OUString& _sURL) const +const ::comphelper::NamedValueCollection& DriversConfig::getMetaData(std::u16string_view _sURL) + const { return impl_get(_sURL,2); } -const ::comphelper::NamedValueCollection& DriversConfig::impl_get(const OUString& _sURL,sal_Int32 _nProps) const +const ::comphelper::NamedValueCollection& DriversConfig::impl_get(std::u16string_view _sURL,sal_Int32 _nProps) const { const TInstalledDrivers& rDrivers = m_aNode->getInstalledDrivers(m_xORB); const ::comphelper::NamedValueCollection* pRet = nullptr; diff --git a/connectivity/source/drivers/dbase/dindexnode.cxx b/connectivity/source/drivers/dbase/dindexnode.cxx index 1ac10800f0a9..69648c480e79 100644 --- a/connectivity/source/drivers/dbase/dindexnode.cxx +++ b/connectivity/source/drivers/dbase/dindexnode.cxx @@ -760,7 +760,7 @@ int ONDXKey::Compare(const ONDXKey& rKey) const } else if (IsText(getDBType())) { - nRes = getValue().getString().compareTo(rKey.getValue()); + nRes = getValue().getString().compareTo(rKey.getValue().getString()); } else { diff --git a/connectivity/source/drivers/evoab2/NStatement.cxx b/connectivity/source/drivers/evoab2/NStatement.cxx index 1616f9fb1f1f..80b02d82f0a5 100644 --- a/connectivity/source/drivers/evoab2/NStatement.cxx +++ b/connectivity/source/drivers/evoab2/NStatement.cxx @@ -17,6 +17,10 @@ * the License at http://www.apache.org/licenses/LICENSE-2.0 . */ +#include <sal/config.h> + +#include <string_view> + #include <osl/diagnose.h> #include <rtl/ustring.hxx> #include <sal/log.hxx> @@ -54,9 +58,9 @@ EBookQuery * createTrue() return e_book_query_from_string("(exists \"full_name\")"); } -EBookQuery * createTest( const OUString &aColumnName, +EBookQuery * createTest( std::u16string_view aColumnName, EBookQueryTest eTest, - const OUString &aMatch ) + std::u16string_view aMatch ) { OString sMatch = OUStringToOString( aMatch, RTL_TEXTENCODING_UTF8 ); OString sColumnName = OUStringToOString( aColumnName, RTL_TEXTENCODING_UTF8 ); @@ -364,7 +368,7 @@ EBookQuery *OCommonStatement::whereAnalysis( const OSQLParseNode* parseTree ) { // String containing only a '%' and nothing else matches everything pResult = createTest( aColumnName, E_BOOK_QUERY_CONTAINS, - "" ); + u"" ); } else if( aMatchString.indexOf( WILDCARD ) == -1 ) { // Simple string , eg. "to match" "contains in evo" @@ -381,9 +385,10 @@ EBookQuery *OCommonStatement::whereAnalysis( const OSQLParseNode* parseTree ) else if( aMatchString.indexOf ( WILDCARD ) == aMatchString.lastIndexOf ( WILDCARD ) ) { // One occurrence of '%' matches... if ( aMatchString.startsWith(OUStringChar(WILDCARD)) ) - pResult = createTest( aColumnName, E_BOOK_QUERY_ENDS_WITH, aMatchString.copy( 1 ) ); + pResult = createTest( + aColumnName, E_BOOK_QUERY_ENDS_WITH, aMatchString.subView( 1 ) ); else if ( aMatchString.indexOf ( WILDCARD ) == aMatchString.getLength() - 1 ) - pResult = createTest( aColumnName, E_BOOK_QUERY_BEGINS_WITH, aMatchString.copy( 0, aMatchString.getLength() - 1 ) ); + pResult = createTest( aColumnName, E_BOOK_QUERY_BEGINS_WITH, aMatchString.subView( 0, aMatchString.getLength() - 1 ) ); else m_xConnection->throwGenericSQLException(STR_QUERY_LIKE_WILDCARD,*this); } @@ -391,7 +396,7 @@ EBookQuery *OCommonStatement::whereAnalysis( const OSQLParseNode* parseTree ) aMatchString.startsWith(OUStringChar(WILDCARD)) && aMatchString.indexOf ( WILDCARD, 1) == aMatchString.getLength() - 1 ) { // one '%' at the start and another at the end - pResult = createTest( aColumnName, E_BOOK_QUERY_CONTAINS, aMatchString.copy (1, aMatchString.getLength() - 2) ); + pResult = createTest( aColumnName, E_BOOK_QUERY_CONTAINS, aMatchString.subView (1, aMatchString.getLength() - 2) ); } else m_xConnection->throwGenericSQLException(STR_QUERY_LIKE_WILDCARD_MANY,*this); diff --git a/connectivity/source/drivers/file/FStringFunctions.cxx b/connectivity/source/drivers/file/FStringFunctions.cxx index 1df5e723c4ee..8bac436e07be 100644 --- a/connectivity/source/drivers/file/FStringFunctions.cxx +++ b/connectivity/source/drivers/file/FStringFunctions.cxx @@ -43,7 +43,7 @@ ORowSetValue OOp_Ascii::operate(const ORowSetValue& lhs) const { if (lhs.isNull()) return lhs; - OString sStr(OUStringToOString(lhs, RTL_TEXTENCODING_ASCII_US)); + OString sStr(OUStringToOString(lhs.getString(), RTL_TEXTENCODING_ASCII_US)); sal_Int32 nAscii = sStr.toChar(); return nAscii; } diff --git a/connectivity/source/drivers/firebird/StatementCommonBase.cxx b/connectivity/source/drivers/firebird/StatementCommonBase.cxx index c1219d74b8ed..1d7d5ef32bdf 100644 --- a/connectivity/source/drivers/firebird/StatementCommonBase.cxx +++ b/connectivity/source/drivers/firebird/StatementCommonBase.cxx @@ -124,7 +124,7 @@ void SAL_CALL OStatementCommonBase::close() dispose(); } -void OStatementCommonBase::prepareAndDescribeStatement(const OUString& sql, +void OStatementCommonBase::prepareAndDescribeStatement(std::u16string_view sql, XSQLDA*& pOutSqlda, XSQLDA* pInSqlda) { diff --git a/connectivity/source/drivers/firebird/StatementCommonBase.hxx b/connectivity/source/drivers/firebird/StatementCommonBase.hxx index b321a27db4f4..c92dd8634109 100644 --- a/connectivity/source/drivers/firebird/StatementCommonBase.hxx +++ b/connectivity/source/drivers/firebird/StatementCommonBase.hxx @@ -20,6 +20,10 @@ #ifndef INCLUDED_CONNECTIVITY_SOURCE_DRIVERS_FIREBIRD_STATEMENTCOMMONBASE_HXX #define INCLUDED_CONNECTIVITY_SOURCE_DRIVERS_FIREBIRD_STATEMENTCOMMONBASE_HXX +#include <sal/config.h> + +#include <string_view> + #include "Connection.hxx" #include "SubComponent.hxx" @@ -81,7 +85,7 @@ namespace connectivity::firebird virtual ~OStatementCommonBase() override; /// @throws css::sdbc::SQLException - void prepareAndDescribeStatement(const OUString& sqlIn, + void prepareAndDescribeStatement(std::u16string_view sqlIn, XSQLDA*& pOutSqlda, XSQLDA* pInSqlda=nullptr); diff --git a/connectivity/source/drivers/jdbc/Class.cxx b/connectivity/source/drivers/jdbc/Class.cxx index a99dd1fb051d..862827d12c93 100644 --- a/connectivity/source/drivers/jdbc/Class.cxx +++ b/connectivity/source/drivers/jdbc/Class.cxx @@ -36,7 +36,7 @@ jclass java_lang_Class::getMyClass() const return theClass; } -java_lang_Class* java_lang_Class::forName(const OUString& _par0) +java_lang_Class* java_lang_Class::forName(std::u16string_view _par0) { jobject out(nullptr); SDBThreadAttach t; diff --git a/connectivity/source/drivers/odbc/ODatabaseMetaDataResultSet.cxx b/connectivity/source/drivers/odbc/ODatabaseMetaDataResultSet.cxx index 7afd4bed54f9..a47758f31a5d 100644 --- a/connectivity/source/drivers/odbc/ODatabaseMetaDataResultSet.cxx +++ b/connectivity/source/drivers/odbc/ODatabaseMetaDataResultSet.cxx @@ -822,7 +822,7 @@ void ODatabaseMetaDataResultSet::openTypeInfo() } void ODatabaseMetaDataResultSet::openTables(const Any& catalog, const OUString& schemaPattern, - const OUString& tableNamePattern, + std::u16string_view tableNamePattern, const Sequence< OUString >& types ) { OString aPKQ,aPKO,aPKN,aCOL; @@ -919,7 +919,8 @@ void ODatabaseMetaDataResultSet::openSchemas() } void ODatabaseMetaDataResultSet::openColumnPrivileges( const Any& catalog, const OUString& schema, - const OUString& table, const OUString& columnNamePattern ) + std::u16string_view table, + std::u16string_view columnNamePattern ) { const OUString *pSchemaPat = nullptr; @@ -953,7 +954,7 @@ void ODatabaseMetaDataResultSet::openColumnPrivileges( const Any& catalog, cons } void ODatabaseMetaDataResultSet::openColumns( const Any& catalog, const OUString& schemaPattern, - const OUString& tableNamePattern, const OUString& columnNamePattern ) + std::u16string_view tableNamePattern, std::u16string_view columnNamePattern ) { const OUString *pSchemaPat = nullptr; @@ -1020,7 +1021,7 @@ void ODatabaseMetaDataResultSet::openColumns( const Any& catalog, } void ODatabaseMetaDataResultSet::openProcedureColumns( const Any& catalog, const OUString& schemaPattern, - const OUString& procedureNamePattern,const OUString& columnNamePattern ) + std::u16string_view procedureNamePattern,std::u16string_view columnNamePattern ) { const OUString *pSchemaPat = nullptr; @@ -1053,7 +1054,7 @@ void ODatabaseMetaDataResultSet::openProcedureColumns( const Any& catalog, } void ODatabaseMetaDataResultSet::openProcedures(const Any& catalog, const OUString& schemaPattern, - const OUString& procedureNamePattern) + std::u16string_view procedureNamePattern) { const OUString *pSchemaPat = nullptr; @@ -1083,11 +1084,11 @@ void ODatabaseMetaDataResultSet::openProcedures(const Any& catalog, const OUStri } void ODatabaseMetaDataResultSet::openSpecialColumns(bool _bRowVer,const Any& catalog, const OUString& schema, - const OUString& table,sal_Int32 scope, bool nullable ) + std::u16string_view table,sal_Int32 scope, bool nullable ) { // Some ODBC drivers really don't like getting an empty string as tableName // E.g. psqlodbc up to at least version 09.01.0100 segfaults - if (table.isEmpty()) + if (table.empty()) { const char errMsg[] = "ODBC: Trying to get special columns of empty table name"; const char SQLState[] = "HY009"; @@ -1123,13 +1124,13 @@ void ODatabaseMetaDataResultSet::openSpecialColumns(bool _bRowVer,const Any& cat } void ODatabaseMetaDataResultSet::openVersionColumns(const Any& catalog, const OUString& schema, - const OUString& table) + std::u16string_view table) { openSpecialColumns(true,catalog,schema,table,SQL_SCOPE_TRANSACTION,false); } void ODatabaseMetaDataResultSet::openBestRowIdentifier( const Any& catalog, const OUString& schema, - const OUString& table,sal_Int32 scope,bool nullable ) + std::u16string_view table,sal_Int32 scope,bool nullable ) { openSpecialColumns(false,catalog,schema,table,scope,nullable); } @@ -1198,7 +1199,7 @@ void ODatabaseMetaDataResultSet::openExportedKeys(const Any& catalog, const OUSt } void ODatabaseMetaDataResultSet::openPrimaryKeys(const Any& catalog, const OUString& schema, - const OUString& table) + std::u16string_view table) { const OUString *pSchemaPat = nullptr; @@ -1228,7 +1229,7 @@ void ODatabaseMetaDataResultSet::openPrimaryKeys(const Any& catalog, const OUStr } void ODatabaseMetaDataResultSet::openTablePrivileges(const Any& catalog, const OUString& schemaPattern, - const OUString& tableNamePattern) + std::u16string_view tableNamePattern) { const OUString *pSchemaPat = nullptr; @@ -1257,7 +1258,7 @@ void ODatabaseMetaDataResultSet::openTablePrivileges(const Any& catalog, const O } void ODatabaseMetaDataResultSet::openIndexInfo( const Any& catalog, const OUString& schema, - const OUString& table, bool unique, bool approximate ) + std::u16string_view table, bool unique, bool approximate ) { const OUString *pSchemaPat = nullptr; diff --git a/connectivity/source/drivers/odbc/OStatement.cxx b/connectivity/source/drivers/odbc/OStatement.cxx index 6e0a37169064..dc693b964d56 100644 --- a/connectivity/source/drivers/odbc/OStatement.cxx +++ b/connectivity/source/drivers/odbc/OStatement.cxx @@ -833,7 +833,7 @@ void OStatement_Base::setMaxFieldSize(sal_Int64 _par0) setStmtOption<SQLULEN, SQL_IS_UINTEGER>(SQL_ATTR_MAX_LENGTH, _par0); } -void OStatement_Base::setCursorName(const OUString &_par0) +void OStatement_Base::setCursorName(std::u16string_view _par0) { OSL_ENSURE(m_aStatementHandle,"StatementHandle is null!"); OString aName(OUStringToOString(_par0,getOwnConnection()->getTextEncoding())); diff --git a/connectivity/source/drivers/postgresql/pq_connection.cxx b/connectivity/source/drivers/postgresql/pq_connection.cxx index d9889dea8091..4d56d52ec9a9 100644 --- a/connectivity/source/drivers/postgresql/pq_connection.cxx +++ b/connectivity/source/drivers/postgresql/pq_connection.cxx @@ -443,7 +443,7 @@ void Connection::initialize( const Sequence< Any >& aArguments ) nColon = url.indexOf( ':' , 1+ nColon ); if( nColon != -1 ) { - o = OUStringToOString( url.copy(nColon+1), ConnectionSettings::encoding ); + o = OUStringToOString( url.subView(nColon+1), ConnectionSettings::encoding ); } } { diff --git a/connectivity/source/drivers/postgresql/pq_statement.cxx b/connectivity/source/drivers/postgresql/pq_statement.cxx index dd7ab576b37f..ff3b05dc8190 100644 --- a/connectivity/source/drivers/postgresql/pq_statement.cxx +++ b/connectivity/source/drivers/postgresql/pq_statement.cxx @@ -61,6 +61,7 @@ #include <com/sun/star/container/XEnumerationAccess.hpp> #include <string.h> +#include <string_view> using osl::MutexGuard; @@ -239,7 +240,7 @@ sal_Int32 Statement::executeUpdate( const OUString& sql ) /// @throws SQLException static void raiseSQLException( const Reference< XInterface> & owner, - const OString & sql, + std::string_view sql, const char * errorMsg, const char *errorType = nullptr ) { diff --git a/connectivity/source/drivers/postgresql/pq_tools.cxx b/connectivity/source/drivers/postgresql/pq_tools.cxx index bece8a806f29..543f042f921e 100644 --- a/connectivity/source/drivers/postgresql/pq_tools.cxx +++ b/connectivity/source/drivers/postgresql/pq_tools.cxx @@ -57,6 +57,7 @@ #include <libpq-fe.h> #include <string.h> +#include <string_view> using com::sun::star::beans::XPropertySet; @@ -91,16 +92,16 @@ OUString concatQualified( const OUString & a, const OUString &b) return a + "." + b; } -static OString iOUStringToOString( const OUString& str, ConnectionSettings const *settings) { +static OString iOUStringToOString( std::u16string_view str, ConnectionSettings const *settings) { OSL_ENSURE(settings, "pgsql-sdbc: OUStringToOString got NULL settings"); - return OUStringToOString( str, ConnectionSettings::encoding ); + return rtl::OUStringToOString( str, ConnectionSettings::encoding ); } -OString OUStringToOString( const OUString& str, ConnectionSettings const *settings) { +OString OUStringToOString( std::u16string_view str, ConnectionSettings const *settings) { return iOUStringToOString( str, settings ); } -void bufferEscapeConstant( OUStringBuffer & buf, const OUString & value, ConnectionSettings *settings ) +void bufferEscapeConstant( OUStringBuffer & buf, std::u16string_view value, ConnectionSettings *settings ) { OString y = iOUStringToOString( value, settings ); @@ -127,14 +128,14 @@ void bufferEscapeConstant( OUStringBuffer & buf, const OUString & value, Connect buf.append( OStringToOUString( strbuf.makeStringAndClear(), RTL_TEXTENCODING_UTF8 ) ); } -static void ibufferQuoteConstant( OUStringBuffer & buf, const OUString & value, ConnectionSettings *settings ) +static void ibufferQuoteConstant( OUStringBuffer & buf, std::u16string_view value, ConnectionSettings *settings ) { buf.append( "'" ); bufferEscapeConstant( buf, value, settings ); buf.append( "'" ); } -void bufferQuoteConstant( OUStringBuffer & buf, const OUString & value, ConnectionSettings *settings ) +void bufferQuoteConstant( OUStringBuffer & buf, std::u16string_view value, ConnectionSettings *settings ) { return ibufferQuoteConstant( buf, value, settings ); } @@ -151,7 +152,7 @@ void bufferQuoteAnyConstant( OUStringBuffer & buf, const Any &val, ConnectionSet buf.append( "NULL" ); } -static void ibufferQuoteIdentifier( OUStringBuffer & buf, const OUString &toQuote, ConnectionSettings *settings ) +static void ibufferQuoteIdentifier( OUStringBuffer & buf, std::u16string_view toQuote, ConnectionSettings *settings ) { OSL_ENSURE(settings, "pgsql-sdbc: bufferQuoteIdentifier got NULL settings"); @@ -171,14 +172,14 @@ static void ibufferQuoteIdentifier( OUStringBuffer & buf, const OUString &toQuot PQfreemem( cstr ); } -void bufferQuoteIdentifier( OUStringBuffer & buf, const OUString &toQuote, ConnectionSettings *settings ) +void bufferQuoteIdentifier( OUStringBuffer & buf, std::u16string_view toQuote, ConnectionSettings *settings ) { return ibufferQuoteIdentifier(buf, toQuote, settings); } void bufferQuoteQualifiedIdentifier( - OUStringBuffer & buf, const OUString &schema, const OUString &table, ConnectionSettings *settings ) + OUStringBuffer & buf, std::u16string_view schema, std::u16string_view table, ConnectionSettings *settings ) { ibufferQuoteIdentifier(buf, schema, settings); buf.append( "." ); @@ -187,9 +188,9 @@ void bufferQuoteQualifiedIdentifier( void bufferQuoteQualifiedIdentifier( OUStringBuffer & buf, - const OUString &schema, - const OUString &table, - const OUString &col, + std::u16string_view schema, + std::u16string_view table, + std::u16string_view col, ConnectionSettings *settings) { ibufferQuoteIdentifier(buf, schema, settings); @@ -544,10 +545,10 @@ void tokenizeSQL( const OString & sql, std::vector< OString > &vec ) } -void splitConcatenatedIdentifier( const OUString & source, OUString *first, OUString *second) +void splitConcatenatedIdentifier( std::u16string_view source, OUString *first, OUString *second) { std::vector< OString > vec; - tokenizeSQL( OUStringToOString( source, RTL_TEXTENCODING_UTF8 ), vec ); + tokenizeSQL( rtl::OUStringToOString( source, RTL_TEXTENCODING_UTF8 ), vec ); switch (vec.size()) { case 1: diff --git a/connectivity/source/drivers/postgresql/pq_tools.hxx b/connectivity/source/drivers/postgresql/pq_tools.hxx index 0647a1b38f55..90490be81eb6 100644 --- a/connectivity/source/drivers/postgresql/pq_tools.hxx +++ b/connectivity/source/drivers/postgresql/pq_tools.hxx @@ -57,28 +57,28 @@ bool isWhitespace( sal_Unicode c ); OUString concatQualified( const OUString & a, const OUString &b); -OString OUStringToOString( const OUString& str, ConnectionSettings const *settings); +OString OUStringToOString( std::u16string_view str, ConnectionSettings const *settings); -void bufferQuoteConstant( OUStringBuffer & buf, const OUString & str, ConnectionSettings *settings ); +void bufferQuoteConstant( OUStringBuffer & buf, std::u16string_view str, ConnectionSettings *settings ); void bufferQuoteAnyConstant( OUStringBuffer & buf, const css::uno::Any &val, ConnectionSettings *settings ); -void bufferEscapeConstant( OUStringBuffer & buf, const OUString & str, ConnectionSettings *settings ); +void bufferEscapeConstant( OUStringBuffer & buf, std::u16string_view str, ConnectionSettings *settings ); OUString sqltype2string( const css::uno::Reference< css::beans::XPropertySet > & column ); void bufferQuoteQualifiedIdentifier( - OUStringBuffer & buf, const OUString &schema, const OUString &name, ConnectionSettings *settings ); + OUStringBuffer & buf, std::u16string_view schema, std::u16string_view name, ConnectionSettings *settings ); void bufferQuoteQualifiedIdentifier( OUStringBuffer & buf, - const OUString &schema, - const OUString &name, - const OUString &col, + std::u16string_view schema, + std::u16string_view name, + std::u16string_view col, ConnectionSettings *settings ); -void bufferQuoteIdentifier( OUStringBuffer & buf, const OUString &toQuote, ConnectionSettings *settings ); +void bufferQuoteIdentifier( OUStringBuffer & buf, std::u16string_view toQuote, ConnectionSettings *settings ); void bufferKey2TableConstraint( OUStringBuffer &buf, const css::uno::Reference< css::beans::XPropertySet > &key, @@ -115,7 +115,7 @@ OUString array2String( const css::uno::Sequence< css::uno::Any > &seq ); css::uno::Reference< css::sdbc::XConnection > extractConnectionFromStatement( const css::uno::Reference< css::uno::XInterface > & stmt ); -void splitConcatenatedIdentifier( const OUString & source, OUString *first, OUString *second); +void splitConcatenatedIdentifier( std::u16string_view source, OUString *first, OUString *second); void fillAttnum2attnameMap( diff --git a/connectivity/source/drivers/postgresql/pq_xcolumns.cxx b/connectivity/source/drivers/postgresql/pq_xcolumns.cxx index 4edb1aabc068..ed3af3579d2a 100644 --- a/connectivity/source/drivers/postgresql/pq_xcolumns.cxx +++ b/connectivity/source/drivers/postgresql/pq_xcolumns.cxx @@ -328,8 +328,8 @@ void Columns::refresh() void alterColumnByDescriptor( - const OUString & schemaName, - const OUString & tableName, + std::u16string_view schemaName, + std::u16string_view tableName, ConnectionSettings *settings, const Reference< XStatement > &stmt, const css::uno::Reference< css::beans::XPropertySet > & past, diff --git a/connectivity/source/drivers/postgresql/pq_xcolumns.hxx b/connectivity/source/drivers/postgresql/pq_xcolumns.hxx index ab8c47914516..78bb9770ebdf 100644 --- a/connectivity/source/drivers/postgresql/pq_xcolumns.hxx +++ b/connectivity/source/drivers/postgresql/pq_xcolumns.hxx @@ -37,6 +37,10 @@ #ifndef INCLUDED_CONNECTIVITY_SOURCE_DRIVERS_POSTGRESQL_PQ_XCOLUMNS_HXX #define INCLUDED_CONNECTIVITY_SOURCE_DRIVERS_POSTGRESQL_PQ_XCOLUMNS_HXX +#include <sal/config.h> + +#include <string_view> + #include "pq_xcontainer.hxx" #include "pq_xbase.hxx" @@ -46,8 +50,8 @@ namespace pq_sdbc_driver { void alterColumnByDescriptor( - const OUString & schemaName, - const OUString & tableName, + std::u16string_view schemaName, + std::u16string_view tableName, ConnectionSettings *settings, const css::uno::Reference< css::sdbc::XStatement > &stmt, const css::uno::Reference< css::beans::XPropertySet > & past, diff --git a/connectivity/source/inc/java/lang/Class.hxx b/connectivity/source/inc/java/lang/Class.hxx index bc68a01a536a..bdf8e2742472 100644 --- a/connectivity/source/inc/java/lang/Class.hxx +++ b/connectivity/source/inc/java/lang/Class.hxx @@ -21,6 +21,10 @@ //************ Class: java.lang.Class +#include <sal/config.h> + +#include <string_view> + #include <java/lang/Object.hxx> namespace connectivity @@ -36,7 +40,7 @@ namespace connectivity // a Constructor, that is needed for when Returning the Object is needed: java_lang_Class( JNIEnv * pEnv, jobject myObj ) : java_lang_Object( pEnv, myObj ){} - static java_lang_Class * forName( const OUString &_par0 ); + static java_lang_Class * forName( std::u16string_view _par0 ); // return the jre object jobject newInstanceObject(); diff --git a/connectivity/source/inc/odbc/ODatabaseMetaDataResultSet.hxx b/connectivity/source/inc/odbc/ODatabaseMetaDataResultSet.hxx index 41f3f756cf74..8f10f3c10ad4 100644 --- a/connectivity/source/inc/odbc/ODatabaseMetaDataResultSet.hxx +++ b/connectivity/source/inc/odbc/ODatabaseMetaDataResultSet.hxx @@ -39,6 +39,7 @@ #include <odbc/ODatabaseMetaData.hxx> #include <odbc/odbcbasedllapi.hxx> #include <memory> +#include <string_view> namespace connectivity::odbc { @@ -199,31 +200,31 @@ namespace connectivity::odbc /// @throws css::sdbc::SQLException /// @throws css::uno::RuntimeException void openTables(const css::uno::Any& catalog, const OUString& schemaPattern, - const OUString& tableNamePattern, const css::uno::Sequence< OUString >& types ); + std::u16string_view tableNamePattern, const css::uno::Sequence< OUString >& types ); /// @throws css::sdbc::SQLException /// @throws css::uno::RuntimeException void openColumnPrivileges( const css::uno::Any& catalog, const OUString& schema, - const OUString& table, const OUString& columnNamePattern ); + std::u16string_view table, std::u16string_view columnNamePattern ); /// @throws css::sdbc::SQLException /// @throws css::uno::RuntimeException void openColumns( const css::uno::Any& catalog, const OUString& schemaPattern, - const OUString& tableNamePattern, const OUString& columnNamePattern ); + std::u16string_view tableNamePattern, std::u16string_view columnNamePattern ); /// @throws css::sdbc::SQLException /// @throws css::uno::RuntimeException void openProcedureColumns( const css::uno::Any& catalog, const OUString& schemaPattern, - const OUString& procedureNamePattern,const OUString& columnNamePattern ); + std::u16string_view procedureNamePattern,std::u16string_view columnNamePattern ); /// @throws css::sdbc::SQLException /// @throws css::uno::RuntimeException void openProcedures( const css::uno::Any& catalog, const OUString& schemaPattern, - const OUString& procedureNamePattern); + std::u16string_view procedureNamePattern); /// @throws css::sdbc::SQLException /// @throws css::uno::RuntimeException void openVersionColumns(const css::uno::Any& catalog, const OUString& schema, - const OUString& table); + std::u16string_view table); /// @throws css::sdbc::SQLException /// @throws css::uno::RuntimeException void openBestRowIdentifier( const css::uno::Any& catalog, const OUString& schema, - const OUString& table,sal_Int32 scope, bool nullable ); + std::u16string_view table,sal_Int32 scope, bool nullable ); /// @throws css::sdbc::SQLException /// @throws css::uno::RuntimeException void openForeignKeys( const css::uno::Any& catalog, const OUString* schema,const OUString* table, @@ -236,19 +237,19 @@ namespace connectivity::odbc void openImportedKeys(const css::uno::Any& catalog, const OUString& schema,const OUString& table); /// @throws css::sdbc::SQLException /// @throws css::uno::RuntimeException - void openPrimaryKeys(const css::uno::Any& catalog, const OUString& schema,const OUString& table); + void openPrimaryKeys(const css::uno::Any& catalog, const OUString& schema,std::u16string_view table); /// @throws css::sdbc::SQLException /// @throws css::uno::RuntimeException void openTablePrivileges(const css::uno::Any& catalog, const OUString& schemaPattern, - const OUString& tableNamePattern); + std::u16string_view tableNamePattern); /// @throws css::sdbc::SQLException /// @throws css::uno::RuntimeException void openSpecialColumns(bool _bRowVer,const css::uno::Any& catalog, const OUString& schema, - const OUString& table,sal_Int32 scope, bool nullable ); + std::u16string_view table,sal_Int32 scope, bool nullable ); /// @throws css::sdbc::SQLException /// @throws css::uno::RuntimeException void openIndexInfo( const css::uno::Any& catalog, const OUString& schema, - const OUString& table,bool unique,bool approximate ); + std::u16string_view table,bool unique,bool approximate ); protected: using OPropertySetHelper::getFastPropertyValue; diff --git a/connectivity/source/inc/odbc/OStatement.hxx b/connectivity/source/inc/odbc/OStatement.hxx index 54b28cac825e..1b7b3a569434 100644 --- a/connectivity/source/inc/odbc/OStatement.hxx +++ b/connectivity/source/inc/odbc/OStatement.hxx @@ -35,6 +35,7 @@ #include <odbc/OFunctions.hxx> #include <odbc/OConnection.hxx> #include <odbc/odbcbasedllapi.hxx> +#include <string_view> #include <vector> #include <com/sun/star/lang/XServiceInfo.hpp> @@ -91,7 +92,7 @@ namespace connectivity::odbc void setMaxRows(sal_Int64 _par0) ; void setFetchDirection(sal_Int32 _par0) ; void setFetchSize(sal_Int32 _par0) ; - void setCursorName(const OUString &_par0); + void setCursorName(std::u16string_view _par0); void setEscapeProcessing( const bool _bEscapeProc ); template < typename T, SQLINTEGER BufferLength > SQLRETURN setStmtOption (SQLINTEGER fOption, T value) const; diff --git a/connectivity/source/parse/internalnode.cxx b/connectivity/source/parse/internalnode.cxx index ccee05746a17..1906ad3d4625 100644 --- a/connectivity/source/parse/internalnode.cxx +++ b/connectivity/source/parse/internalnode.cxx @@ -33,7 +33,7 @@ OSQLInternalNode::OSQLInternalNode(const char* pNewValue, } -OSQLInternalNode::OSQLInternalNode(const OString &NewValue, +OSQLInternalNode::OSQLInternalNode(std::string_view NewValue, SQLNodeType eNodeType, sal_uInt32 nNodeID) :OSQLParseNode(NewValue,eNodeType,nNodeID) diff --git a/connectivity/source/parse/sqlnode.cxx b/connectivity/source/parse/sqlnode.cxx index d31bcd2a9ada..544d14e6491a 100644 --- a/connectivity/source/parse/sqlnode.cxx +++ b/connectivity/source/parse/sqlnode.cxx @@ -1599,7 +1599,7 @@ OSQLParseNode::OSQLParseNode(const char * pNewValue, OSL_ENSURE(m_eNodeType >= SQLNodeType::Rule && m_eNodeType <= SQLNodeType::Concat,"OSQLParseNode: created with invalid NodeType"); } -OSQLParseNode::OSQLParseNode(const OString &_rNewValue, +OSQLParseNode::OSQLParseNode(std::string_view _rNewValue, SQLNodeType eNewNodeType, sal_uInt32 nNewNodeID) :m_pParent(nullptr) @@ -2508,7 +2508,7 @@ void OSQLParseNode::parseLeaf(OUStringBuffer& rString, const SQLParseNodeParamet } -sal_Int32 OSQLParser::getFunctionReturnType(const OUString& _sFunctionName, const IParseContext* pContext) +sal_Int32 OSQLParser::getFunctionReturnType(std::u16string_view _sFunctionName, const IParseContext* pContext) { sal_Int32 nType = DataType::VARCHAR; OString sFunctionName(OUStringToOString(_sFunctionName,RTL_TEXTENCODING_UTF8)); diff --git a/cppu/source/LogBridge/LogBridge.cxx b/cppu/source/LogBridge/LogBridge.cxx index c0dc02c243ad..b93b43b64e78 100644 --- a/cppu/source/LogBridge/LogBridge.cxx +++ b/cppu/source/LogBridge/LogBridge.cxx @@ -199,7 +199,8 @@ static void LogProbe( { OString sTemp; if ( pMemberType && pMemberType->pTypeName ) - sTemp = OUStringToOString(pMemberType->pTypeName,RTL_TEXTENCODING_ASCII_US); + sTemp = OUStringToOString( + OUString::unacquired(&pMemberType->pTypeName),RTL_TEXTENCODING_ASCII_US); if ( pre ) { SAL_INFO("cppu.log", "{ LogBridge () " << sTemp ); diff --git a/cppu/source/typelib/typelib.cxx b/cppu/source/typelib/typelib.cxx index 5d0d0b84f573..21f84241f578 100644 --- a/cppu/source/typelib/typelib.cxx +++ b/cppu/source/typelib/typelib.cxx @@ -279,7 +279,7 @@ TypeDescriptor_Init_Impl::~TypeDescriptor_Init_Impl() typelib_TypeDescriptionReference * pTDR = rEntry.second; if (pTDR) { - OString aTypeName( OUStringToOString( pTDR->pTypeName, RTL_TEXTENCODING_ASCII_US ) ); + OString aTypeName( OUStringToOString( OUString::unacquired(&pTDR->pTypeName), RTL_TEXTENCODING_ASCII_US ) ); SAL_INFO("cppu.typelib", "remaining type: " << aTypeName << "; ref count = " << pTDR->nRefCount); } else diff --git a/cppu/source/uno/lbenv.cxx b/cppu/source/uno/lbenv.cxx index 3a86f9882b7f..93a6a1bb588f 100644 --- a/cppu/source/uno/lbenv.cxx +++ b/cppu/source/uno/lbenv.cxx @@ -41,6 +41,7 @@ #include "prim.hxx" #include "loadmodule.hxx" +#include <string_view> #include <unordered_map> #include <vector> #include <stdio.h> @@ -672,7 +673,7 @@ void writeLine( void writeLine( - void * stream, const OUString & rLine, const char * pFilter ) + void * stream, std::u16string_view rLine, const char * pFilter ) { OString aLine( OUStringToOString( rLine, RTL_TEXTENCODING_ASCII_US ) ); @@ -777,7 +778,8 @@ extern "C" void SAL_CALL uno_dumpEnvironmentByName( else { writeLine( - stream, "environment \"" + OUString::unacquired(&pEnvDcp) + "\" does not exist!", + stream, + OUString("environment \"" + OUString::unacquired(&pEnvDcp) + "\" does not exist!"), pFilter ); } } diff --git a/cpputools/source/unoexe/unoexe.cxx b/cpputools/source/unoexe/unoexe.cxx index 31365aa43c7b..bc1df676a38a 100644 --- a/cpputools/source/unoexe/unoexe.cxx +++ b/cpputools/source/unoexe/unoexe.cxx @@ -18,6 +18,7 @@ */ #include <stdio.h> +#include <string_view> #include <sal/main.h> #include <sal/log.hxx> @@ -68,7 +69,7 @@ static void out( const char * pText ) fprintf( stderr, "%s", pText ); } -static void out( const OUString & rText ) +static void out( std::u16string_view rText ) { if (! s_quiet) { diff --git a/cui/source/dialogs/AdditionsDialog.cxx b/cui/source/dialogs/AdditionsDialog.cxx index 2a00f1f28a0c..832a7314b440 100644 --- a/cui/source/dialogs/AdditionsDialog.cxx +++ b/cui/source/dialogs/AdditionsDialog.cxx @@ -7,6 +7,11 @@ * file, You can obtain one at http://mozilla.org/MPL/2.0/. * */ + +#include <sal/config.h> + +#include <string_view> + #include <config_folders.h> #include <AdditionsDialog.hxx> @@ -142,54 +147,61 @@ void parseResponse(const std::string& rResponse, std::vector<AdditionInfo>& aAdd try { AdditionInfo aNewAddition = { - OStringToOUString(OString(arrayElement.child("id").string_value().get()), - RTL_TEXTENCODING_UTF8), - OStringToOUString(OString(arrayElement.child("name").string_value().get()), - RTL_TEXTENCODING_UTF8), - OStringToOUString(OString(arrayElement.child("author").string_value().get()), + OStringToOUString(std::string_view(arrayElement.child("id").string_value().get()), RTL_TEXTENCODING_UTF8), - OStringToOUString(OString(arrayElement.child("url").string_value().get()), + OStringToOUString(std::string_view(arrayElement.child("name").string_value().get()), RTL_TEXTENCODING_UTF8), - OStringToOUString(OString(arrayElement.child("screenshotURL").string_value().get()), + OStringToOUString( + std::string_view(arrayElement.child("author").string_value().get()), + RTL_TEXTENCODING_UTF8), + OStringToOUString(std::string_view(arrayElement.child("url").string_value().get()), RTL_TEXTENCODING_UTF8), OStringToOUString( - OString(arrayElement.child("extensionIntroduction").string_value().get()), + std::string_view(arrayElement.child("screenshotURL").string_value().get()), RTL_TEXTENCODING_UTF8), OStringToOUString( - OString(arrayElement.child("extensionDescription").string_value().get()), + std::string_view( + arrayElement.child("extensionIntroduction").string_value().get()), RTL_TEXTENCODING_UTF8), - OStringToOUString(OString(arrayElement.child("releases") - .child(0) - .child("compatibility") - .string_value() - .get()), - RTL_TEXTENCODING_UTF8), - OStringToOUString(OString(arrayElement.child("releases") - .child(0) - .child("releaseName") - .string_value() - .get()), - RTL_TEXTENCODING_UTF8), - OStringToOUString(OString(arrayElement.child("releases") - .child(0) - .child("license") - .string_value() - .get()), - RTL_TEXTENCODING_UTF8), - OStringToOUString(OString(arrayElement.child("commentNumber").string_value().get()), + OStringToOUString( + std::string_view( + arrayElement.child("extensionDescription").string_value().get()), + RTL_TEXTENCODING_UTF8), + OStringToOUString(std::string_view(arrayElement.child("releases") + .child(0) + .child("compatibility") + .string_value() + .get()), RTL_TEXTENCODING_UTF8), - OStringToOUString(OString(arrayElement.child("commentURL").string_value().get()), + OStringToOUString(std::string_view(arrayElement.child("releases") + .child(0) + .child("releaseName") + .string_value() + .get()), RTL_TEXTENCODING_UTF8), - OStringToOUString(OString(arrayElement.child("rating").string_value().get()), + OStringToOUString(std::string_view(arrayElement.child("releases") + .child(0) + .child("license") + .string_value() + .get()), RTL_TEXTENCODING_UTF8), OStringToOUString( - OString(arrayElement.child("downloadNumber").string_value().get()), + std::string_view(arrayElement.child("commentNumber").string_value().get()), + RTL_TEXTENCODING_UTF8), + OStringToOUString( + std::string_view(arrayElement.child("commentURL").string_value().get()), + RTL_TEXTENCODING_UTF8), + OStringToOUString( + std::string_view(arrayElement.child("rating").string_value().get()), + RTL_TEXTENCODING_UTF8), + OStringToOUString( + std::string_view(arrayElement.child("downloadNumber").string_value().get()), RTL_TEXTENCODING_UTF8), - OStringToOUString(OString(arrayElement.child("releases") - .child(0) - .child("downloadURL") - .string_value() - .get()), + OStringToOUString(std::string_view(arrayElement.child("releases") + .child(0) + .child("downloadURL") + .string_value() + .get()), RTL_TEXTENCODING_UTF8) }; diff --git a/dbaccess/qa/unit/dbtest_base.cxx b/dbaccess/qa/unit/dbtest_base.cxx index 72f4e9b685f1..f0b276cbb1ea 100644 --- a/dbaccess/qa/unit/dbtest_base.cxx +++ b/dbaccess/qa/unit/dbtest_base.cxx @@ -47,7 +47,9 @@ utl::TempFile DBTestBase::createTempCopy(OUString const & pathname) { tmp.EnableKillingFile(); auto const e = osl::File::copy(url, tmp.GetURL()); CPPUNIT_ASSERT_EQUAL_MESSAGE( - (OUStringToOString("<" + url + "> -> <" + tmp.GetURL() + ">", RTL_TEXTENCODING_UTF8) + (OString( + "<" + OUStringToOString(url, RTL_TEXTENCODING_UTF8) + "> -> <" + + OUStringToOString(tmp.GetURL(), RTL_TEXTENCODING_UTF8) + ">") .getStr()), osl::FileBase::E_None, e); return tmp; diff --git a/dbaccess/source/core/misc/dsntypes.cxx b/dbaccess/source/core/misc/dsntypes.cxx index b44b11fc16f0..494994c347da 100644 --- a/dbaccess/source/core/misc/dsntypes.cxx +++ b/dbaccess/source/core/misc/dsntypes.cxx @@ -72,7 +72,7 @@ ODsnTypeCollection::~ODsnTypeCollection() #endif } -OUString ODsnTypeCollection::getTypeDisplayName(const OUString& _sURL) const +OUString ODsnTypeCollection::getTypeDisplayName(std::u16string_view _sURL) const { return m_aDriverConfig.getDriverTypeDisplayName(_sURL); } @@ -130,7 +130,7 @@ bool ODsnTypeCollection::hasDriver( const char* _pAsciiPattern ) const return !sPrefix.isEmpty(); } -bool ODsnTypeCollection::isConnectionUrlRequired(const OUString& _sURL) const +bool ODsnTypeCollection::isConnectionUrlRequired(std::u16string_view _sURL) const { OUString sRet; OUString sOldPattern; @@ -146,7 +146,7 @@ bool ODsnTypeCollection::isConnectionUrlRequired(const OUString& _sURL) const return !sRet.isEmpty() && sRet[sRet.getLength()-1] == '*'; } -OUString ODsnTypeCollection::getMediaType(const OUString& _sURL) const +OUString ODsnTypeCollection::getMediaType(std::u16string_view _sURL) const { const ::comphelper::NamedValueCollection& aFeatures = m_aDriverConfig.getMetaData(_sURL); return aFeatures.getOrDefault("MediaType",OUString()); @@ -236,43 +236,43 @@ void ODsnTypeCollection::extractHostNamePort(const OUString& _rDsn,OUString& _sD } } -OUString ODsnTypeCollection::getJavaDriverClass(const OUString& _sURL) const +OUString ODsnTypeCollection::getJavaDriverClass(std::u16string_view _sURL) const { const ::comphelper::NamedValueCollection& aFeatures = m_aDriverConfig.getProperties(_sURL); return aFeatures.getOrDefault("JavaDriverClass",OUString()); } -bool ODsnTypeCollection::isFileSystemBased(const OUString& _sURL) const +bool ODsnTypeCollection::isFileSystemBased(std::u16string_view _sURL) const { const ::comphelper::NamedValueCollection& aFeatures = m_aDriverConfig.getMetaData(_sURL); return aFeatures.getOrDefault("FileSystemBased",false); } -bool ODsnTypeCollection::supportsTableCreation(const OUString& _sURL) const +bool ODsnTypeCollection::supportsTableCreation(std::u16string_view _sURL) const { const ::comphelper::NamedValueCollection& aFeatures = m_aDriverConfig.getMetaData(_sURL); return aFeatures.getOrDefault("SupportsTableCreation",false); } -bool ODsnTypeCollection::supportsColumnDescription(const OUString& _sURL) const +bool ODsnTypeCollection::supportsColumnDescription(std::u16string_view _sURL) const { const ::comphelper::NamedValueCollection& aFeatures = m_aDriverConfig.getMetaData(_sURL); return aFeatures.getOrDefault("SupportsColumnDescription",false); } -bool ODsnTypeCollection::supportsBrowsing(const OUString& _sURL) const +bool ODsnTypeCollection::supportsBrowsing(std::u16string_view _sURL) const { const ::comphelper::NamedValueCollection& aFeatures = m_aDriverConfig.getMetaData(_sURL); return aFeatures.getOrDefault("SupportsBrowsing",false); } -bool ODsnTypeCollection::supportsDBCreation(const OUString& _sURL) const +bool ODsnTypeCollection::supportsDBCreation(std::u16string_view _sURL) const { const ::comphelper::NamedValueCollection& aFeatures = m_aDriverConfig.getMetaData(_sURL); return aFeatures.getOrDefault("SupportsDBCreation",false); } -Sequence<PropertyValue> ODsnTypeCollection::getDefaultDBSettings( const OUString& _sURL ) const +Sequence<PropertyValue> ODsnTypeCollection::getDefaultDBSettings( std::u16string_view _sURL ) const { const ::comphelper::NamedValueCollection& aProperties = m_aDriverConfig.getProperties(_sURL); return aProperties.getPropertyValues(); @@ -467,7 +467,7 @@ void ODsnTypeCollection::fillPageIds(const OUString& _sURL,std::vector<sal_Int16 } } -OUString ODsnTypeCollection::getType(const OUString& _sURL) const +OUString ODsnTypeCollection::getType(std::u16string_view _sURL) const { OUString sOldPattern; for (auto const& dsnPrefix : m_aDsnPrefixes) @@ -481,7 +481,7 @@ OUString ODsnTypeCollection::getType(const OUString& _sURL) const return sOldPattern; } -sal_Int32 ODsnTypeCollection::getIndexOf(const OUString& _sURL) const +sal_Int32 ODsnTypeCollection::getIndexOf(std::u16string_view _sURL) const { sal_Int32 nRet = -1; OUString sOldPattern; diff --git a/dbaccess/source/filter/hsqldb/rowinputbinary.cxx b/dbaccess/source/filter/hsqldb/rowinputbinary.cxx index 89c748fcbb82..5ded17936c38 100644 --- a/dbaccess/source/filter/hsqldb/rowinputbinary.cxx +++ b/dbaccess/source/filter/hsqldb/rowinputbinary.cxx @@ -17,6 +17,10 @@ * the License at http://www.apache.org/licenses/LICENSE-2.0 . */ +#include <sal/config.h> + +#include <string_view> + #include "rowinputbinary.hxx" #include <com/sun/star/sdbc/DataType.hpp> #include <com/sun/star/io/WrongFormatException.hpp> @@ -82,7 +86,8 @@ OUString lcl_double_dabble(const std::vector<sal_uInt8>& bytes) digit += '0'; /* Resize and return the resulting string. */ - return OStringToOUString(OString(scratch.data(), scratch.size()), RTL_TEXTENCODING_UTF8); + return OStringToOUString(std::string_view(scratch.data(), scratch.size()), + RTL_TEXTENCODING_UTF8); } OUString lcl_makeStringFromBigint(const std::vector<sal_uInt8>& bytes) diff --git a/dbaccess/source/filter/hsqldb/utils.cxx b/dbaccess/source/filter/hsqldb/utils.cxx index 3dc8f2e55b16..f2b2b517b8fc 100644 --- a/dbaccess/source/filter/hsqldb/utils.cxx +++ b/dbaccess/source/filter/hsqldb/utils.cxx @@ -51,7 +51,7 @@ int getHexValue(sal_Unicode c) } // unnamed namespace //Convert ascii escaped unicode to utf-8 -OUString utils::convertToUTF8(const OString& original) +OUString utils::convertToUTF8(std::string_view original) { OUString res = OStringToOUString(original, RTL_TEXTENCODING_UTF8); for (sal_Int32 i = 0;;) diff --git a/dbaccess/source/filter/hsqldb/utils.hxx b/dbaccess/source/filter/hsqldb/utils.hxx index f0a0e35249a0..b8ed1a222c4c 100644 --- a/dbaccess/source/filter/hsqldb/utils.hxx +++ b/dbaccess/source/filter/hsqldb/utils.hxx @@ -9,11 +9,15 @@ #pragma once +#include <sal/config.h> + +#include <string_view> + #include <rtl/ustring.hxx> namespace dbahsql::utils { -OUString convertToUTF8(const OString& original); +OUString convertToUTF8(std::string_view original); OUString getTableNameFromStmt(const OUString& sSql); diff --git a/dbaccess/source/inc/dsntypes.hxx b/dbaccess/source/inc/dsntypes.hxx index 38f8ba9213a0..629759ccfd47 100644 --- a/dbaccess/source/inc/dsntypes.hxx +++ b/dbaccess/source/inc/dsntypes.hxx @@ -22,6 +22,7 @@ #include <sal/config.h> +#include <string_view> #include <vector> #include <dbadllapi.hxx> @@ -117,7 +118,7 @@ public: ~ODsnTypeCollection(); /// get the datasource type display name from a DSN string - OUString getTypeDisplayName(const OUString& _sURL) const; + OUString getTypeDisplayName(std::u16string_view _sURL) const; /// on a given string, cut the type prefix and return the result OUString cutPrefix(const OUString& _sURL) const; @@ -129,10 +130,10 @@ public: bool hasDriver( const char* _pAsciiPattern ) const; /// on a given string, return the Java Driver Class - OUString getJavaDriverClass(const OUString& _sURL) const; + OUString getJavaDriverClass(std::u16string_view _sURL) const; /// returns the media type of a file based database - OUString getMediaType(const OUString& _sURL) const; + OUString getMediaType(std::u16string_view _sURL) const; /// returns the dsn prefix for a given media type OUString getDatasourcePrefixFromMediaType(std::u16string_view _sMediaType, std::u16string_view _sExtension ); @@ -140,21 +141,21 @@ public: void extractHostNamePort(const OUString& _rDsn,OUString& _sDatabaseName,OUString& _rHostname,sal_Int32& _nPortNumber) const; /// check if the given data source allows creation of tables - bool supportsTableCreation(const OUString& _sURL) const; + bool supportsTableCreation(std::u16string_view _sURL) const; /// check if the given data source allows to show column description. - bool supportsColumnDescription(const OUString& _sURL) const; + bool supportsColumnDescription(std::u16string_view _sURL) const; // check if a Browse button may be shown to insert connection url - bool supportsBrowsing(const OUString& _sURL) const; + bool supportsBrowsing(std::u16string_view _sURL) const; // check if a Create New Database button may be shown to insert connection url - bool supportsDBCreation(const OUString& _sURL) const; + bool supportsDBCreation(std::u16string_view _sURL) const; /// check if the given data source type is based on the file system - i.e. the URL is a prefix plus a file URL - bool isFileSystemBased(const OUString& _sURL) const; + bool isFileSystemBased(std::u16string_view _sURL) const; - bool isConnectionUrlRequired(const OUString& _sURL) const; + bool isConnectionUrlRequired(std::u16string_view _sURL) const; /// checks if the given data source type embeds its data into the database document static bool isEmbeddedDatabase( const OUString& _sURL ); @@ -167,7 +168,7 @@ public: /** returns default settings for newly created databases of the given type. */ css::uno::Sequence< css::beans::PropertyValue> - getDefaultDBSettings( const OUString& _sURL ) const; + getDefaultDBSettings( std::u16string_view _sURL ) const; /// get access to the first element of the types collection inline TypeIterator begin() const; @@ -178,9 +179,9 @@ public: DATASOURCE_TYPE determineType(const OUString& _rDsn) const; - sal_Int32 getIndexOf(const OUString& _sURL) const; + sal_Int32 getIndexOf(std::u16string_view _sURL) const; sal_Int32 size() const; - OUString getType(const OUString& _sURL) const; + OUString getType(std::u16string_view _sURL) const; }; //- ODsnTypeCollection::TypeIterator diff --git a/dbaccess/source/ui/dlg/dbwizsetup.cxx b/dbaccess/source/ui/dlg/dbwizsetup.cxx index 473c0d32ca34..88fd1151bfef 100644 --- a/dbaccess/source/ui/dlg/dbwizsetup.cxx +++ b/dbaccess/source/ui/dlg/dbwizsetup.cxx @@ -293,7 +293,7 @@ void ODbTypeWizDialogSetup::activateDatabasePath() { sal_Int32 nCreateNewDBIndex = m_pCollection->getIndexOf( m_pGeneralPage->GetSelectedType() ); if ( nCreateNewDBIndex == -1 ) - nCreateNewDBIndex = m_pCollection->getIndexOf( "sdbc:dbase:" ); + nCreateNewDBIndex = m_pCollection->getIndexOf( u"sdbc:dbase:" ); OSL_ENSURE( nCreateNewDBIndex != -1, "ODbTypeWizDialogSetup::activateDatabasePath: the GeneralPage should have prevented this!" ); activatePath( static_cast< PathId >( nCreateNewDBIndex + 1 ), true ); diff --git a/dbaccess/source/ui/dlg/generalpage.cxx b/dbaccess/source/ui/dlg/generalpage.cxx index d61032fd4919..d02ac934fba7 100644 --- a/dbaccess/source/ui/dlg/generalpage.cxx +++ b/dbaccess/source/ui/dlg/generalpage.cxx @@ -461,7 +461,7 @@ namespace dbaui // If no driver for embedded DBs is installed, and no dBase driver, then hide the "Create new database" option sal_Int32 nCreateNewDBIndex = m_pCollection->getIndexOf( dbaccess::ODsnTypeCollection::getEmbeddedDatabase() ); if ( nCreateNewDBIndex == -1 ) - nCreateNewDBIndex = m_pCollection->getIndexOf( "sdbc:dbase:" ); + nCreateNewDBIndex = m_pCollection->getIndexOf( u"sdbc:dbase:" ); bool bHideCreateNew = ( nCreateNewDBIndex == -1 ); // also, if our application policies tell us to hide the option, do it @@ -551,7 +551,7 @@ namespace dbaui // Sets the default selected database on startup. if (m_xRB_CreateDatabase->get_active() ) { - return m_pCollection->getTypeDisplayName( "sdbc:firebird:" ); + return m_pCollection->getTypeDisplayName( u"sdbc:firebird:" ); } return OGeneralPage::getDatasourceName( _rSet ); diff --git a/desktop/inc/dp_misc.h b/desktop/inc/dp_misc.h index 2953cd53cfde..0d9eadb90cb3 100644 --- a/desktop/inc/dp_misc.h +++ b/desktop/inc/dp_misc.h @@ -19,6 +19,10 @@ #pragma once +#include <sal/config.h> + +#include <string_view> + #include <osl/mutex.hxx> #include <osl/process.h> #include <com/sun/star/uno/XComponentContext.hpp> @@ -106,13 +110,13 @@ oslProcess raiseProcess( OUString const & appURL, as target encoding. */ DESKTOP_DEPLOYMENTMISC_DLLPUBLIC -void writeConsole(OUString const & sText); +void writeConsole(std::u16string_view sText); /** writes the argument to the console using the error stream. Otherwise the same as writeConsole. */ DESKTOP_DEPLOYMENTMISC_DLLPUBLIC -void writeConsoleError(OUString const & sText); +void writeConsoleError(std::u16string_view sText); /** reads from the console. diff --git a/desktop/qa/desktop_lib/test_desktop_lib.cxx b/desktop/qa/desktop_lib/test_desktop_lib.cxx index 8a5b3f54d81a..82586de384b1 100644 --- a/desktop/qa/desktop_lib/test_desktop_lib.cxx +++ b/desktop/qa/desktop_lib/test_desktop_lib.cxx @@ -2084,7 +2084,7 @@ void DesktopLOKTest::testGetFontSubset() rtl_UriEncodeKeepEscapes, RTL_TEXTENCODING_UTF8 ); - OString aCommand = OUStringToOString(".uno:FontSubset&name=" + aFontName, RTL_TEXTENCODING_UTF8); + OString aCommand = ".uno:FontSubset&name=" + OUStringToOString(aFontName, RTL_TEXTENCODING_UTF8); boost::property_tree::ptree aTree; char* pJSON = pDocument->m_pDocumentClass->getCommandValues(pDocument, aCommand.getStr()); std::stringstream aStream(pJSON); diff --git a/desktop/source/app/dispatchwatcher.cxx b/desktop/source/app/dispatchwatcher.cxx index 50b92ecb7834..9ab77f399ec4 100644 --- a/desktop/source/app/dispatchwatcher.cxx +++ b/desktop/source/app/dispatchwatcher.cxx @@ -61,6 +61,7 @@ #include <osl/thread.hxx> #include <osl/file.hxx> #include <iostream> +#include <string_view> using namespace ::osl; using namespace ::com::sun::star::uno; @@ -89,7 +90,7 @@ struct DispatchHolder Reference< XDispatch > xDispatch; }; -std::shared_ptr<const SfxFilter> impl_lookupExportFilterForUrl( const OUString& rUrl, const OUString& rFactory ) +std::shared_ptr<const SfxFilter> impl_lookupExportFilterForUrl( std::u16string_view rUrl, const OUString& rFactory ) { // create the list of filters OUStringBuffer sQuery(256); diff --git a/desktop/source/deployment/manager/dp_activepackages.cxx b/desktop/source/deployment/manager/dp_activepackages.cxx index b301bc5ad22b..c1c5f2b28dba 100644 --- a/desktop/source/deployment/manager/dp_activepackages.cxx +++ b/desktop/source/deployment/manager/dp_activepackages.cxx @@ -21,6 +21,7 @@ #include <sal/config.h> +#include <string_view> #include <utility> #include <osl/diagnose.h> @@ -44,11 +45,11 @@ namespace { constexpr const char separator[] = "\xff"; -OString oldKey(OUString const & fileName) { +OString oldKey(std::u16string_view fileName) { return OUStringToOString(fileName, RTL_TEXTENCODING_UTF8); } -OString newKey(OUString const & id) { +OString newKey(std::u16string_view id) { return separator + OUStringToOString(id, RTL_TEXTENCODING_UTF8); } diff --git a/desktop/source/deployment/misc/dp_misc.cxx b/desktop/source/deployment/misc/dp_misc.cxx index 21b9d4b4496b..81785e536a40 100644 --- a/desktop/source/deployment/misc/dp_misc.cxx +++ b/desktop/source/deployment/misc/dp_misc.cxx @@ -455,19 +455,19 @@ Reference<XInterface> resolveUnoURL( return nullptr; // warning C4715 } -static void writeConsoleWithStream(OUString const & sText, FILE * stream) +static void writeConsoleWithStream(std::u16string_view sText, FILE * stream) { OString s = OUStringToOString(sText, osl_getThreadTextEncoding()); fprintf(stream, "%s", s.getStr()); fflush(stream); } -void writeConsole(OUString const & sText) +void writeConsole(std::u16string_view sText) { writeConsoleWithStream(sText, stdout); } -void writeConsoleError(OUString const & sText) +void writeConsoleError(std::u16string_view sText) { writeConsoleWithStream(sText, stderr); } @@ -479,7 +479,7 @@ OUString readConsole() // read one char less so that the last char in buf is always zero if (fgets(buf, 1024, stdin) != nullptr) { - OUString value = OStringToOUString(OString(buf), osl_getThreadTextEncoding()); + OUString value = OStringToOUString(std::string_view(buf), osl_getThreadTextEncoding()); return value.trim(); } throw css::uno::RuntimeException("reading from stdin failed"); diff --git a/desktop/source/lib/init.cxx b/desktop/source/lib/init.cxx index e1e8ac652d3f..cc2cee9913c0 100644 --- a/desktop/source/lib/init.cxx +++ b/desktop/source/lib/init.cxx @@ -31,6 +31,8 @@ #include <algorithm> #include <memory> #include <iostream> +#include <string_view> + #include <boost/property_tree/json_parser.hpp> #include <boost/algorithm/string.hpp> @@ -283,7 +285,7 @@ static char *convertOString(const OString &rStr) return pMemory; } -static char *convertOUString(const OUString &aStr) +static char *convertOUString(std::u16string_view aStr) { return convertOString(OUStringToOString(aStr, RTL_TEXTENCODING_UTF8)); } @@ -3492,7 +3494,7 @@ static void doc_postWindowExtTextInputEvent(LibreOfficeKitDocument* pThis, unsig return; } - SfxLokHelper::postExtTextEventAsync(pWindow, nType, OUString::fromUtf8(OString(pText, strlen(pText)))); + SfxLokHelper::postExtTextEventAsync(pWindow, nType, OUString::fromUtf8(std::string_view(pText, strlen(pText)))); } static void doc_removeTextContext(LibreOfficeKitDocument* pThis, unsigned nLOKWindowId, int nCharBefore, int nCharAfter) @@ -4584,7 +4586,7 @@ static char* getFonts (const char* pCommand) return pJson; } -static char* getFontSubset (const OString& aFontName) +static char* getFontSubset (std::string_view aFontName) { OUString aFoundFont(::rtl::Uri::decode(OStringToOUString(aFontName, RTL_TEXTENCODING_UTF8), rtl_UriDecodeStrict, RTL_TEXTENCODING_UTF8)); SfxObjectShell* pDocSh = SfxObjectShell::Current(); @@ -5053,7 +5055,7 @@ static char* doc_getCommandValues(LibreOfficeKitDocument* pThis, const char* pCo } else if (aCommand.startsWith(aFontSubset)) { - return getFontSubset(OString(pCommand + aFontSubset.getLength())); + return getFontSubset(std::string_view(pCommand + aFontSubset.getLength())); } else { diff --git a/desktop/source/pkgchk/unopkg/unopkg_app.cxx b/desktop/source/pkgchk/unopkg/unopkg_app.cxx index 53b2a23aec91..857902dd4f4e 100644 --- a/desktop/source/pkgchk/unopkg/unopkg_app.cxx +++ b/desktop/source/pkgchk/unopkg/unopkg_app.cxx @@ -70,8 +70,8 @@ struct ExtensionName }; -const char s_usingText [] = -"\n" +const char16_t s_usingText [] = +u"\n" "using: " APP_NAME " add <options> extension-path...\n" " " APP_NAME " validate <options> extension-identifier...\n" " " APP_NAME " remove <options> extension-identifier...\n" @@ -231,7 +231,7 @@ extern "C" int unopkg_main() return 0; } else if (isOption( info_version, &nPos )) { - dp_misc::writeConsole("\n" APP_NAME " Version 3.3\n"); + dp_misc::writeConsole(u"\n" APP_NAME " Version 3.3\n"); return 0; } //consume all bootstrap variables which may occur before the sub-command @@ -271,12 +271,12 @@ extern "C" int unopkg_main() if (cmdArg[ 0 ] == '-') { // is option: - dp_misc::writeConsoleError( + dp_misc::writeConsoleError(OUString( "\nERROR: unexpected option " + cmdArg + "!\n Use " APP_NAME " " + toString(info_help) + - " to print all options.\n"); + " to print all options.\n")); return 1; } else @@ -478,7 +478,7 @@ extern "C" int unopkg_main() vec_packages.size(), false); dp_misc::writeConsole( - "All deployed " + repository + " extensions:\n\n"); + OUString("All deployed " + repository + " extensions:\n\n")); } else { @@ -612,7 +612,7 @@ extern "C" int unopkg_main() catch (const LockFileException & e) { // No logger since it requires UNO which we don't have here - dp_misc::writeConsoleError(e.Message + "\n"); + dp_misc::writeConsoleError(OUString(e.Message + "\n")); bShowFailedMsg = false; } catch (const css::uno::Exception & e ) { diff --git a/desktop/source/pkgchk/unopkg/unopkg_cmdenv.cxx b/desktop/source/pkgchk/unopkg/unopkg_cmdenv.cxx index 98a957c014e8..1d4907b9a263 100644 --- a/desktop/source/pkgchk/unopkg/unopkg_cmdenv.cxx +++ b/desktop/source/pkgchk/unopkg/unopkg_cmdenv.cxx @@ -139,9 +139,9 @@ void CommandEnvironmentImpl::printLicense( OUString sNewLine("\n"); - dp_misc::writeConsole(sNewLine + sNewLine + s1 + sNewLine + sNewLine); - dp_misc::writeConsole(sLicense + sNewLine + sNewLine); - dp_misc::writeConsole(s2 + sNewLine); + dp_misc::writeConsole(OUString(sNewLine + sNewLine + s1 + sNewLine + sNewLine)); + dp_misc::writeConsole(OUString(sLicense + sNewLine + sNewLine)); + dp_misc::writeConsole(OUString(s2 + sNewLine)); dp_misc::writeConsole(s3); //the user may enter "yes" or "no", we compare in a case insensitive way @@ -168,7 +168,7 @@ void CommandEnvironmentImpl::printLicense( } else { - dp_misc::writeConsole(sNewLine + sNewLine + s4 + sNewLine); + dp_misc::writeConsole(OUString(sNewLine + sNewLine + s4 + sNewLine)); } } while(true); @@ -254,7 +254,7 @@ void CommandEnvironmentImpl::handle( { OUString sMsg(DpResId(RID_STR_UNSUPPORTED_PLATFORM)); sMsg = sMsg.replaceAll("%Name", platExc.package->getDisplayName()); - dp_misc::writeConsole("\n" + sMsg + "\n\n"); + dp_misc::writeConsole(OUString("\n" + sMsg + "\n\n")); approve = true; } else { @@ -272,7 +272,7 @@ void CommandEnvironmentImpl::handle( if (abort && m_option_verbose) { OUString msg = ::comphelper::anyToString(request); - dp_misc::writeConsoleError("\nERROR: " + msg + "\n"); + dp_misc::writeConsoleError(OUString("\nERROR: " + msg + "\n")); } // select: @@ -339,15 +339,15 @@ void CommandEnvironmentImpl::update_( Any const & Status ) for ( sal_Int32 n = 0; n < m_logLevel; ++n ) { if (bUseErr) - dp_misc::writeConsoleError(" "); + dp_misc::writeConsoleError(u" "); else - dp_misc::writeConsole(" "); + dp_misc::writeConsole(u" "); } if (bUseErr) - dp_misc::writeConsoleError(msg + "\n"); + dp_misc::writeConsoleError(OUString(msg + "\n")); else - dp_misc::writeConsole(msg + "\n"); + dp_misc::writeConsole(OUString(msg + "\n")); } diff --git a/desktop/source/pkgchk/unopkg/unopkg_misc.cxx b/desktop/source/pkgchk/unopkg/unopkg_misc.cxx index f4c691fec9aa..3b16dc59855e 100644 --- a/desktop/source/pkgchk/unopkg/unopkg_misc.cxx +++ b/desktop/source/pkgchk/unopkg/unopkg_misc.cxx @@ -227,7 +227,7 @@ namespace { void printf_space( sal_Int32 space ) { while (space--) - dp_misc::writeConsole(" "); + dp_misc::writeConsole(u" "); } @@ -235,7 +235,7 @@ void printf_line( OUString const & name, OUString const & value, sal_Int32 level ) { printf_space( level ); - dp_misc::writeConsole(name + ": " + value + "\n"); + dp_misc::writeConsole(OUString(name + ": " + value + "\n")); } @@ -282,13 +282,13 @@ void printf_package( Sequence< Reference<deployment::XPackage> > seq( xPackage->getBundle( Reference<task::XAbortChannel>(), xCmdEnv ) ); printf_space( level + 1 ); - dp_misc::writeConsole("bundled Packages: {\n"); + dp_misc::writeConsole(u"bundled Packages: {\n"); std::vector<Reference<deployment::XPackage> >vec_bundle; ::comphelper::sequenceToContainer(vec_bundle, seq); printf_packages( vec_bundle, std::vector<bool>(vec_bundle.size()), xCmdEnv, level + 2 ); printf_space( level + 1 ); - dp_misc::writeConsole("}\n"); + dp_misc::writeConsole(u"}\n"); } } // anon namespace @@ -300,7 +300,7 @@ static void printf_unaccepted_licenses( dp_misc::getIdentifier(ext) ); printf_line( "Identifier", id, 0 ); printf_space(1); - dp_misc::writeConsole("License not accepted\n\n"); + dp_misc::writeConsole(u"License not accepted\n\n"); } @@ -314,7 +314,7 @@ void printf_packages( if (allExtensions.empty()) { printf_space( level ); - dp_misc::writeConsole("<none>\n"); + dp_misc::writeConsole(u"<none>\n"); } else { @@ -325,7 +325,7 @@ void printf_packages( printf_unaccepted_licenses(extension); else printf_package( extension, xCmdEnv, level ); - dp_misc::writeConsole("\n"); + dp_misc::writeConsole(u"\n"); ++index; } } @@ -365,16 +365,16 @@ Reference<XComponentContext> connectToOffice( if (verbose) { - dp_misc::writeConsole( + dp_misc::writeConsole(OUString( "Raising process: " + appURL + "\nArguments: --nologo --nodefault " + args[2] + - "\n"); + "\n")); } ::dp_misc::raiseProcess( appURL, args ); if (verbose) - dp_misc::writeConsole("OK. Connecting..."); + dp_misc::writeConsole(u"OK. Connecting..."); OUString sUnoUrl = "uno:pipe,name=" + pipeId + ";urp;StarOffice.ComponentContext"; Reference<XComponentContext> xRet( @@ -382,7 +382,7 @@ Reference<XComponentContext> connectToOffice( sUnoUrl, xLocalComponentContext ), UNO_QUERY_THROW ); if (verbose) - dp_misc::writeConsole("OK.\n"); + dp_misc::writeConsole(u"OK.\n"); return xRet; } diff --git a/drawinglayer/source/dumper/EnhancedShapeDumper.cxx b/drawinglayer/source/dumper/EnhancedShapeDumper.cxx index 84fbc58dbb3b..611ac87cd33d 100644 --- a/drawinglayer/source/dumper/EnhancedShapeDumper.cxx +++ b/drawinglayer/source/dumper/EnhancedShapeDumper.cxx @@ -429,7 +429,7 @@ void EnhancedShapeDumper::dumpEnhancedCustomShapeGeometryService(const uno::Refe dumpHandlesAsElement(aHandles); } } -void EnhancedShapeDumper::dumpTypeAsAttribute(const OUString& sType) +void EnhancedShapeDumper::dumpTypeAsAttribute(std::u16string_view sType) { xmlTextWriterWriteFormatAttribute(xmlWriter, BAD_CAST("type"), "%s", OUStringToOString(sType, RTL_TEXTENCODING_UTF8).getStr()); diff --git a/drawinglayer/source/dumper/EnhancedShapeDumper.hxx b/drawinglayer/source/dumper/EnhancedShapeDumper.hxx index 2949bb95448f..f6c8453e9087 100644 --- a/drawinglayer/source/dumper/EnhancedShapeDumper.hxx +++ b/drawinglayer/source/dumper/EnhancedShapeDumper.hxx @@ -8,6 +8,10 @@ */ #pragma once +#include <sal/config.h> + +#include <string_view> + #include <libxml/xmlwriter.h> #include <com/sun/star/beans/XPropertySet.hpp> @@ -73,7 +77,7 @@ public: // EnhancedCustomShapeGeometry.idl void dumpEnhancedCustomShapeGeometryService(const css::uno::Reference< css::beans::XPropertySet >& xPropSet); - void dumpTypeAsAttribute(const OUString& sType); + void dumpTypeAsAttribute(std::u16string_view sType); void dumpViewBoxAsElement(css::awt::Rectangle aViewBox); void dumpMirroredXAsAttribute(bool bMirroredX); // also used in EnhancedCustomShapeHandle void dumpMirroredYAsAttribute(bool bMirroredY); // also used in EnhancedCustomShapeHandle diff --git a/drawinglayer/source/dumper/XShapeDumper.cxx b/drawinglayer/source/dumper/XShapeDumper.cxx index be72eeb2b8a9..5ea63dccc323 100644 --- a/drawinglayer/source/dumper/XShapeDumper.cxx +++ b/drawinglayer/source/dumper/XShapeDumper.cxx @@ -42,6 +42,7 @@ #include <rtl/strbuf.hxx> #include <libxml/xmlwriter.h> #include <iostream> +#include <string_view> #include <rtl/ustring.hxx> #define DEBUG_DUMPER 0 @@ -62,9 +63,9 @@ void dumpPropertyValueAsElement(const beans::PropertyValue& rPropertyValue, xmlT void dumpFillStyleAsAttribute(css::drawing::FillStyle eFillStyle, xmlTextWriterPtr xmlWriter); void dumpFillColorAsAttribute(sal_Int32 aColor, xmlTextWriterPtr xmlWriter); void dumpFillTransparenceAsAttribute(sal_Int32 aTransparence, xmlTextWriterPtr xmlWriter); -void dumpFillTransparenceGradientNameAsAttribute(const OUString& sTranspGradName, xmlTextWriterPtr xmlWriter); +void dumpFillTransparenceGradientNameAsAttribute(std::u16string_view sTranspGradName, xmlTextWriterPtr xmlWriter); void dumpFillTransparenceGradientAsElement(const css::awt::Gradient& rTranspGrad, xmlTextWriterPtr xmlWriter); -void dumpFillGradientNameAsAttribute(const OUString& sGradName, xmlTextWriterPtr xmlWriter); +void dumpFillGradientNameAsAttribute(std::u16string_view sGradName, xmlTextWriterPtr xmlWriter); void dumpFillGradientAsElement(const css::awt::Gradient& rGradient, xmlTextWriterPtr xmlWriter); void dumpFillHatchAsElement(const css::drawing::Hatch& rHatch, xmlTextWriterPtr xmlWriter); void dumpFillBackgroundAsAttribute(bool bBackground, xmlTextWriterPtr xmlWriter); @@ -84,13 +85,13 @@ void dumpFillBitmapTileAsAttribute(bool bBitmapTile, xmlTextWriterPtr xmlWriter) // LineProperties.idl void dumpLineStyleAsAttribute(css::drawing::LineStyle eLineStyle, xmlTextWriterPtr xmlWriter); void dumpLineDashAsElement(const css::drawing::LineDash& rLineDash, xmlTextWriterPtr xmlWriter); -void dumpLineDashNameAsAttribute(const OUString& sLineDashName, xmlTextWriterPtr xmlWriter); +void dumpLineDashNameAsAttribute(std::u16string_view sLineDashName, xmlTextWriterPtr xmlWriter); void dumpLineColorAsAttribute(sal_Int32 aLineColor, xmlTextWriterPtr xmlWriter); void dumpLineTransparenceAsAttribute(sal_Int32 aLineTransparence, xmlTextWriterPtr xmlWriter); void dumpLineWidthAsAttribute(sal_Int32 aLineWidth, xmlTextWriterPtr xmlWriter); void dumpLineJointAsAttribute(css::drawing::LineJoint eLineJoint, xmlTextWriterPtr xmlWriter); -void dumpLineStartNameAsAttribute(const OUString& sLineStartName, xmlTextWriterPtr xmlWriter); -void dumpLineEndNameAsAttribute(const OUString& sLineEndName, xmlTextWriterPtr xmlWriter); +void dumpLineStartNameAsAttribute(std::u16string_view sLineStartName, xmlTextWriterPtr xmlWriter); +void dumpLineEndNameAsAttribute(std::u16string_view sLineEndName, xmlTextWriterPtr xmlWriter); void dumpLineStartAsElement(const css::drawing::PolyPolygonBezierCoords& rLineStart, xmlTextWriterPtr xmlWriter); void dumpLineEndAsElement(const css::drawing::PolyPolygonBezierCoords& rLineEnd, xmlTextWriterPtr xmlWriter); void dumpLineStartCenterAsAttribute(bool bLineStartCenter, xmlTextWriterPtr xmlWriter); @@ -142,23 +143,24 @@ void dumpShadowYDistanceAsAttribute(sal_Int32 aShadowYDistance, xmlTextWriterPtr //Shape.idl void dumpZOrderAsAttribute(sal_Int32 aZOrder, xmlTextWriterPtr xmlWriter); void dumpLayerIDAsAttribute(sal_Int32 aLayerID, xmlTextWriterPtr xmlWriter); -void dumpLayerNameAsAttribute(const OUString& sLayerName, xmlTextWriterPtr xmlWriter); +void dumpLayerNameAsAttribute(std::u16string_view sLayerName, xmlTextWriterPtr xmlWriter); void dumpVisibleAsAttribute(bool bVisible, xmlTextWriterPtr xmlWriter); void dumpPrintableAsAttribute(bool bPrintable, xmlTextWriterPtr xmlWriter); void dumpMoveProtectAsAttribute(bool bMoveProtect, xmlTextWriterPtr xmlWriter); -void dumpNameAsAttribute(const OUString& sName, xmlTextWriterPtr xmlWriter); +void dumpNameAsAttribute(std::u16string_view sName, xmlTextWriterPtr xmlWriter); void dumpSizeProtectAsAttribute(bool bSizeProtect, xmlTextWriterPtr xmlWriter); void dumpHomogenMatrixLine3(const css::drawing::HomogenMatrixLine3& rLine, xmlTextWriterPtr xmlWriter); void dumpTransformationAsElement(const css::drawing::HomogenMatrix3& rTransformation, xmlTextWriterPtr xmlWriter); void dumpNavigationOrderAsAttribute(sal_Int32 aNavigationOrder, xmlTextWriterPtr xmlWriter); -void dumpHyperlinkAsAttribute(const OUString& sHyperlink, xmlTextWriterPtr xmlWriter); +void dumpHyperlinkAsAttribute(std::u16string_view sHyperlink, xmlTextWriterPtr xmlWriter); void dumpInteropGrabBagAsElement(const uno::Sequence< beans::PropertyValue>& aInteropGrabBag, xmlTextWriterPtr xmlWriter); // CustomShape.idl -void dumpCustomShapeEngineAsAttribute(const OUString& sCustomShapeEngine, xmlTextWriterPtr xmlWriter); -void dumpCustomShapeDataAsAttribute(const OUString& sCustomShapeData, xmlTextWriterPtr xmlWriter); +void dumpCustomShapeEngineAsAttribute(std::u16string_view sCustomShapeEngine, xmlTextWriterPtr xmlWriter); +void dumpCustomShapeDataAsAttribute( + std::u16string_view sCustomShapeData, xmlTextWriterPtr xmlWriter); void dumpCustomShapeGeometryAsElement(const css::uno::Sequence< css::beans::PropertyValue>& aCustomShapeGeometry, xmlTextWriterPtr xmlWriter); -void dumpCustomShapeReplacementURLAsAttribute(const OUString& sCustomShapeReplacementURL, xmlTextWriterPtr xmlWriter); +void dumpCustomShapeReplacementURLAsAttribute(std::u16string_view sCustomShapeReplacementURL, xmlTextWriterPtr xmlWriter); // XShape.idl void dumpPositionAsAttribute(const css::awt::Point& rPoint, xmlTextWriterPtr xmlWriter); @@ -229,7 +231,7 @@ void dumpFillTransparenceAsAttribute(sal_Int32 aTransparence, xmlTextWriterPtr x xmlTextWriterWriteFormatAttribute(xmlWriter, BAD_CAST("fillTransparence"), "%" SAL_PRIdINT32, aTransparence); } -void dumpFillTransparenceGradientNameAsAttribute(const OUString& sTranspGradName, xmlTextWriterPtr xmlWriter) +void dumpFillTransparenceGradientNameAsAttribute(std::u16string_view sTranspGradName, xmlTextWriterPtr xmlWriter) { xmlTextWriterWriteFormatAttribute(xmlWriter, BAD_CAST("fillTransparenceGradientName"), "%s", OUStringToOString(sTranspGradName, RTL_TEXTENCODING_UTF8).getStr()); @@ -279,7 +281,7 @@ void dumpFillTransparenceGradientAsElement(const awt::Gradient& rTranspGrad, xml xmlTextWriterEndElement( xmlWriter ); } -void dumpFillGradientNameAsAttribute(const OUString& sGradName, xmlTextWriterPtr xmlWriter) +void dumpFillGradientNameAsAttribute(std::u16string_view sGradName, xmlTextWriterPtr xmlWriter) { xmlTextWriterWriteFormatAttribute(xmlWriter, BAD_CAST("fillGradientName"), "%s", OUStringToOString(sGradName, RTL_TEXTENCODING_UTF8).getStr()); @@ -493,7 +495,7 @@ void dumpLineDashAsElement(const drawing::LineDash& rLineDash, xmlTextWriterPtr xmlTextWriterEndElement( xmlWriter ); } -void dumpLineDashNameAsAttribute(const OUString& sLineDashName, xmlTextWriterPtr xmlWriter) +void dumpLineDashNameAsAttribute(std::u16string_view sLineDashName, xmlTextWriterPtr xmlWriter) { xmlTextWriterWriteFormatAttribute(xmlWriter, BAD_CAST("lineDashName"), "%s", OUStringToOString(sLineDashName, RTL_TEXTENCODING_UTF8).getStr()); @@ -538,13 +540,13 @@ void dumpLineJointAsAttribute(drawing::LineJoint eLineJoint, xmlTextWriterPtr xm } } -void dumpLineStartNameAsAttribute(const OUString& sLineStartName, xmlTextWriterPtr xmlWriter) +void dumpLineStartNameAsAttribute(std::u16string_view sLineStartName, xmlTextWriterPtr xmlWriter) { xmlTextWriterWriteFormatAttribute(xmlWriter, BAD_CAST("lineStartName"), "%s", OUStringToOString(sLineStartName, RTL_TEXTENCODING_UTF8).getStr()); } -void dumpLineEndNameAsAttribute(const OUString& sLineEndName, xmlTextWriterPtr xmlWriter) +void dumpLineEndNameAsAttribute(std::u16string_view sLineEndName, xmlTextWriterPtr xmlWriter) { xmlTextWriterWriteFormatAttribute(xmlWriter, BAD_CAST("lineEndName"), "%s", OUStringToOString(sLineEndName, RTL_TEXTENCODING_UTF8).getStr()); @@ -989,7 +991,7 @@ void dumpLayerIDAsAttribute(sal_Int32 aLayerID, xmlTextWriterPtr xmlWriter) xmlTextWriterWriteFormatAttribute(xmlWriter, BAD_CAST("layerID"), "%" SAL_PRIdINT32, aLayerID); } -void dumpLayerNameAsAttribute(const OUString& sLayerName, xmlTextWriterPtr xmlWriter) +void dumpLayerNameAsAttribute(std::u16string_view sLayerName, xmlTextWriterPtr xmlWriter) { xmlTextWriterWriteFormatAttribute(xmlWriter, BAD_CAST("layerName"), "%s", OUStringToOString(sLayerName, RTL_TEXTENCODING_UTF8).getStr()); @@ -1019,9 +1021,9 @@ void dumpMoveProtectAsAttribute(bool bMoveProtect, xmlTextWriterPtr xmlWriter) xmlTextWriterWriteFormatAttribute( xmlWriter, BAD_CAST("moveProtect"), "%s", "false"); } -void dumpNameAsAttribute(const OUString& sName, xmlTextWriterPtr xmlWriter) +void dumpNameAsAttribute(std::u16string_view sName, xmlTextWriterPtr xmlWriter) { - if(!sName.isEmpty() && !m_bNameDumped) + if(!sName.empty() && !m_bNameDumped) { xmlTextWriterWriteFormatAttribute(xmlWriter, BAD_CAST("name"), "%s", OUStringToOString(sName, RTL_TEXTENCODING_UTF8).getStr()); m_bNameDumped = true; @@ -1065,7 +1067,7 @@ void dumpNavigationOrderAsAttribute(sal_Int32 aNavigationOrder, xmlTextWriterPtr xmlTextWriterWriteFormatAttribute(xmlWriter, BAD_CAST("navigationOrder"), "%" SAL_PRIdINT32, aNavigationOrder); } -void dumpHyperlinkAsAttribute(const OUString& sHyperlink, xmlTextWriterPtr xmlWriter) +void dumpHyperlinkAsAttribute(std::u16string_view sHyperlink, xmlTextWriterPtr xmlWriter) { xmlTextWriterWriteFormatAttribute(xmlWriter, BAD_CAST("hyperlink"), "%s", OUStringToOString(sHyperlink, RTL_TEXTENCODING_UTF8).getStr()); @@ -1108,13 +1110,14 @@ void dumpShapeDescriptorAsAttribute( const uno::Reference< drawing::XShapeDescri // ---------- CustomShape.idl ---------- -void dumpCustomShapeEngineAsAttribute(const OUString& sCustomShapeEngine, xmlTextWriterPtr xmlWriter) +void dumpCustomShapeEngineAsAttribute(std::u16string_view sCustomShapeEngine, xmlTextWriterPtr xmlWriter) { xmlTextWriterWriteFormatAttribute(xmlWriter, BAD_CAST("customShapeEngine"), "%s", OUStringToOString(sCustomShapeEngine, RTL_TEXTENCODING_UTF8).getStr()); } -void dumpCustomShapeDataAsAttribute(const OUString& sCustomShapeData, xmlTextWriterPtr xmlWriter) +void dumpCustomShapeDataAsAttribute( + std::u16string_view sCustomShapeData, xmlTextWriterPtr xmlWriter) { xmlTextWriterWriteFormatAttribute(xmlWriter, BAD_CAST("customShapeData"), "%s", OUStringToOString(sCustomShapeData, RTL_TEXTENCODING_UTF8).getStr()); @@ -1220,7 +1223,7 @@ void dumpCustomShapeGeometryAsElement(const uno::Sequence< beans::PropertyValue> xmlTextWriterEndElement( xmlWriter ); } -void dumpCustomShapeReplacementURLAsAttribute(const OUString& sCustomShapeReplacementURL, xmlTextWriterPtr xmlWriter) +void dumpCustomShapeReplacementURLAsAttribute(std::u16string_view sCustomShapeReplacementURL, xmlTextWriterPtr xmlWriter) { xmlTextWriterWriteFormatAttribute(xmlWriter, BAD_CAST("customShapeReplacementURL"), "%s", OUStringToOString(sCustomShapeReplacementURL, RTL_TEXTENCODING_UTF8).getStr()); diff --git a/editeng/source/misc/svxacorr.cxx b/editeng/source/misc/svxacorr.cxx index feab628d7f04..e6fd6ec459cb 100644 --- a/editeng/source/misc/svxacorr.cxx +++ b/editeng/source/misc/svxacorr.cxx @@ -1884,7 +1884,7 @@ OUString EncryptBlockName_Imp(const OUString& rName) } /* This code is copied from SwXMLTextBlocks::GeneratePackageName */ -static void GeneratePackageName ( const OUString& rShort, OUString& rPackageName ) +static void GeneratePackageName ( std::u16string_view rShort, OUString& rPackageName ) { OString sByte(OUStringToOString(rShort, RTL_TEXTENCODING_UTF7)); OUStringBuffer aBuf(OStringToOUString(sByte, RTL_TEXTENCODING_ASCII_US)); diff --git a/extensions/source/bibliography/general.cxx b/extensions/source/bibliography/general.cxx index deaaafa4d9dc..1d2f66517a10 100644 --- a/extensions/source/bibliography/general.cxx +++ b/extensions/source/bibliography/general.cxx @@ -423,7 +423,7 @@ void BibGeneralPage::CommitActiveControl() } void BibGeneralPage::AddControlWithError( const OUString& rColumnName, FixedText &rLabel, - OUString& rErrorString, const OString& sHelpId, sal_uInt16 nIndexInFTArray, std::vector<vcl::Window*> &rChildren) + OUString& rErrorString, std::string_view sHelpId, sal_uInt16 nIndexInFTArray, std::vector<vcl::Window*> &rChildren) { const OUString aColumnUIName(rLabel.GetText()); // adds also the XControl and creates a map entry in nFT2CtrlMap[] for mapping between control and FT @@ -448,7 +448,7 @@ void BibGeneralPage::AddControlWithError( const OUString& rColumnName, FixedText bool BibGeneralPage::AddXControl( const OUString& rName, - FixedText& rLabel, const OString& sHelpId, sal_Int16& rIndex, + FixedText& rLabel, std::string_view sHelpId, sal_Int16& rIndex, std::vector<vcl::Window*>& rChildren) { uno::Reference< awt::XControlModel > xCtrModel; diff --git a/extensions/source/bibliography/general.hxx b/extensions/source/bibliography/general.hxx index 8a5ac2127c16..107f40fe2bc6 100644 --- a/extensions/source/bibliography/general.hxx +++ b/extensions/source/bibliography/general.hxx @@ -20,6 +20,10 @@ #ifndef INCLUDED_EXTENSIONS_SOURCE_BIBLIOGRAPHY_GENERAL_HXX #define INCLUDED_EXTENSIONS_SOURCE_BIBLIOGRAPHY_GENERAL_HXX +#include <sal/config.h> + +#include <string_view> + #include <com/sun/star/awt/XFocusListener.hpp> #include <com/sun/star/awt/XControlContainer.hpp> #include <com/sun/star/form/XBoundComponent.hpp> @@ -124,12 +128,12 @@ class BibGeneralPage : public TabPage BibDataManager* pDatMan; bool - AddXControl( const OUString& rName, FixedText& rLabel, const OString& sHelpId, + AddXControl( const OUString& rName, FixedText& rLabel, std::string_view sHelpId, sal_Int16& rIndex, std::vector<vcl::Window*>& rChildren ); void AddControlWithError( const OUString& rColumnName, FixedText& rLabel, OUString& rErrorString, - const OString& sHelpId, sal_uInt16 nIndexInFTArray, std::vector<vcl::Window*>& rChildren ); + std::string_view sHelpId, sal_uInt16 nIndexInFTArray, std::vector<vcl::Window*>& rChildren ); protected: void InitFixedTexts(); // create mnemonics and set text an all fixed texts diff --git a/extensions/source/logging/loghandler.cxx b/extensions/source/logging/loghandler.cxx index e52a807db24f..afc33605b9fc 100644 --- a/extensions/source/logging/loghandler.cxx +++ b/extensions/source/logging/loghandler.cxx @@ -109,7 +109,7 @@ namespace logging } - bool LogHandlerHelper::setEncoding( const OUString& _rEncoding ) + bool LogHandlerHelper::setEncoding( std::u16string_view _rEncoding ) { OString sAsciiEncoding( OUStringToOString( _rEncoding, RTL_TEXTENCODING_ASCII_US ) ); rtl_TextEncoding eEncoding = rtl_getTextEncodingFromMimeCharset( sAsciiEncoding.getStr() ); diff --git a/extensions/source/logging/loghandler.hxx b/extensions/source/logging/loghandler.hxx index 89248c811c22..1e0feaa06c7c 100644 --- a/extensions/source/logging/loghandler.hxx +++ b/extensions/source/logging/loghandler.hxx @@ -20,6 +20,10 @@ #ifndef INCLUDED_EXTENSIONS_SOURCE_LOGGING_LOGHANDLER_HXX #define INCLUDED_EXTENSIONS_SOURCE_LOGGING_LOGHANDLER_HXX +#include <sal/config.h> + +#include <string_view> + #include <com/sun/star/logging/XLogFormatter.hpp> #include <com/sun/star/uno/XComponentContext.hpp> #include <com/sun/star/logging/LogRecord.hpp> @@ -59,7 +63,7 @@ namespace logging void setIsInitialized() { m_bInitialized = true; } bool getEncoding( OUString& _out_rEncoding ) const; - bool setEncoding( const OUString& _rEncoding ); + bool setEncoding( std::u16string_view _rEncoding ); rtl_TextEncoding getTextEncoding() const { return m_eEncoding; } diff --git a/extensions/source/propctrlr/pcrcommon.cxx b/extensions/source/propctrlr/pcrcommon.cxx index 90924d7fc7e4..b6c826b61a5e 100644 --- a/extensions/source/propctrlr/pcrcommon.cxx +++ b/extensions/source/propctrlr/pcrcommon.cxx @@ -44,7 +44,7 @@ namespace pcr } - OUString HelpIdUrl::getHelpURL( const OString& sHelpId ) + OUString HelpIdUrl::getHelpURL( std::string_view sHelpId ) { OUStringBuffer aBuffer; OUString aTmp( OStringToOUString(sHelpId, RTL_TEXTENCODING_UTF8) ); diff --git a/extensions/source/propctrlr/pcrcommon.hxx b/extensions/source/propctrlr/pcrcommon.hxx index e200396a6c7e..4544ba244c4c 100644 --- a/extensions/source/propctrlr/pcrcommon.hxx +++ b/extensions/source/propctrlr/pcrcommon.hxx @@ -23,6 +23,10 @@ #define EDITOR_LIST_APPEND (SAL_MAX_UINT16) #define EDITOR_LIST_ENTRY_NOTFOUND (SAL_MAX_UINT16) +#include <sal/config.h> + +#include <string_view> + #include <com/sun/star/uno/Sequence.hxx> #include <com/sun/star/beans/XPropertyChangeListener.hpp> #include <com/sun/star/beans/PropertyChangeEvent.hpp> @@ -66,7 +70,7 @@ namespace pcr { public: static OString getHelpId( const OUString& _rHelpURL ); - static OUString getHelpURL( const OString& ); + static OUString getHelpURL( std::string_view ); }; diff --git a/extensions/source/scanner/sane.cxx b/extensions/source/scanner/sane.cxx index f8f85de5d9e1..839602458e6e 100644 --- a/extensions/source/scanner/sane.cxx +++ b/extensions/source/scanner/sane.cxx @@ -414,7 +414,7 @@ void Sane::SetOptionValue( int n, bool bSet ) ControlOption( n, SANE_ACTION_SET_VALUE, &nRet ); } -void Sane::SetOptionValue( int n, const OUString& rSet ) +void Sane::SetOptionValue( int n, std::u16string_view rSet ) { if( ! maHandle || mppOptions[n]->type != SANE_TYPE_STRING ) return; diff --git a/extensions/source/scanner/sane.hxx b/extensions/source/scanner/sane.hxx index 7963e677128a..a0e631942a02 100644 --- a/extensions/source/scanner/sane.hxx +++ b/extensions/source/scanner/sane.hxx @@ -18,6 +18,10 @@ */ #pragma once +#include <sal/config.h> + +#include <string_view> + #include <cppuhelper/implbase.hxx> #include <osl/thread.h> #include <osl/module.h> @@ -144,7 +148,7 @@ public: bool GetOptionValue( int, double* ); void SetOptionValue( int, bool ); - void SetOptionValue( int, const OUString& ); + void SetOptionValue( int, std::u16string_view ); void SetOptionValue( int, double, int nElement = 0 ); void SetOptionValue( int, double const * ); diff --git a/extensions/source/update/check/download.cxx b/extensions/source/update/check/download.cxx index 436f48b78416..3e8ad4e2c09c 100644 --- a/extensions/source/update/check/download.cxx +++ b/extensions/source/update/check/download.cxx @@ -17,6 +17,9 @@ * the License at http://www.apache.org/licenses/LICENSE-2.0 . */ +#include <sal/config.h> + +#include <string_view> #include <curl/curl.h> @@ -70,7 +73,8 @@ static void openFile( OutData& out ) sal_Int32 nIndex = aURL.lastIndexOf('/'); if( nIndex > 0 ) { - out.File = out.DestinationDir + OStringToOUString(aURL.copy(nIndex), RTL_TEXTENCODING_UTF8); + out.File = out.DestinationDir + + OStringToOUString(aURL.subView(nIndex), RTL_TEXTENCODING_UTF8); oslFileError rc; @@ -206,7 +210,7 @@ Download::getProxyForURL(const OUString& rURL, OString& rHost, sal_Int32& rPort) } -static bool curl_run(const OUString& rURL, OutData& out, const OString& aProxyHost, sal_Int32 nProxyPort) +static bool curl_run(std::u16string_view rURL, OutData& out, const OString& aProxyHost, sal_Int32 nProxyPort) { /* Need to investigate further whether it is necessary to call * curl_global_init or not - leave it for now (as the ftp UCB content diff --git a/filter/source/graphicfilter/idxf/dxfreprd.cxx b/filter/source/graphicfilter/idxf/dxfreprd.cxx index 1f74ada603a3..340f8fcb5e0a 100644 --- a/filter/source/graphicfilter/idxf/dxfreprd.cxx +++ b/filter/source/graphicfilter/idxf/dxfreprd.cxx @@ -436,7 +436,7 @@ namespace { } } -OUString DXFRepresentation::ToOUString(const OString& s) const +OUString DXFRepresentation::ToOUString(std::string_view s) const { OUString result = OStringToOUString(s, getTextEncoding(), RTL_TEXTTOUNICODE_FLAGS_UNDEFINED_ERROR diff --git a/filter/source/graphicfilter/idxf/dxfreprd.hxx b/filter/source/graphicfilter/idxf/dxfreprd.hxx index d002e285afd8..99745343ff7f 100644 --- a/filter/source/graphicfilter/idxf/dxfreprd.hxx +++ b/filter/source/graphicfilter/idxf/dxfreprd.hxx @@ -23,7 +23,7 @@ #include "dxfblkrd.hxx" #include "dxftblrd.hxx" #include <array> - +#include <string_view> //--------------------Other stuff--------------------------------------------- @@ -100,7 +100,7 @@ public: rtl_TextEncoding getTextEncoding() const; void setTextEncoding(rtl_TextEncoding aEnc) { mEnc = aEnc; } - OUString ToOUString(const OString& s) const; + OUString ToOUString(std::string_view s) const; double getGlobalLineTypeScale() const { return mfGlobalLineTypeScale; } void setGlobalLineTypeScale(double fGlobalLineTypeScale) { mfGlobalLineTypeScale = fGlobalLineTypeScale; } diff --git a/filter/source/xsltfilter/LibXSLTTransformer.cxx b/filter/source/xsltfilter/LibXSLTTransformer.cxx index c3fc742bae03..027e338a0677 100644 --- a/filter/source/xsltfilter/LibXSLTTransformer.cxx +++ b/filter/source/xsltfilter/LibXSLTTransformer.cxx @@ -11,6 +11,7 @@ #include <algorithm> #include <cstring> #include <map> +#include <string_view> #include <utility> #include <vector> #include <libxml/parser.h> @@ -147,7 +148,7 @@ namespace XSLT streamName = ensureStringValue(streamName, ctxt); oh->insertByName(OStringToOUString(reinterpret_cast<char*>(streamName->stringval), RTL_TEXTENCODING_UTF8), - OString(reinterpret_cast<char*>(value->stringval))); + std::string_view(reinterpret_cast<char*>(value->stringval))); valuePush(ctxt, xmlXPathNewCString("")); } diff --git a/filter/source/xsltfilter/OleHandler.cxx b/filter/source/xsltfilter/OleHandler.cxx index f298c01b7040..49a8991cc9e8 100644 --- a/filter/source/xsltfilter/OleHandler.cxx +++ b/filter/source/xsltfilter/OleHandler.cxx @@ -57,7 +57,7 @@ namespace XSLT } } - void OleHandler::initRootStorageFromBase64(const OString& content) + void OleHandler::initRootStorageFromBase64(std::string_view content) { Sequence<sal_Int8> oleData; ::comphelper::Base64::decode(oleData, OStringToOUString( @@ -132,7 +132,7 @@ namespace XSLT } void - OleHandler::insertByName(const OUString& streamName, const OString& content) + OleHandler::insertByName(const OUString& streamName, std::string_view content) { if ( streamName == "oledata.mso" ) { @@ -167,7 +167,7 @@ namespace XSLT } void - OleHandler::insertSubStorage(const OUString& streamName, const OString& content) + OleHandler::insertSubStorage(const OUString& streamName, std::string_view content) { //decode the base64 string Sequence<sal_Int8> oledata; diff --git a/filter/source/xsltfilter/OleHandler.hxx b/filter/source/xsltfilter/OleHandler.hxx index 9c0c17ea030a..1fd00aa39ab7 100644 --- a/filter/source/xsltfilter/OleHandler.hxx +++ b/filter/source/xsltfilter/OleHandler.hxx @@ -13,6 +13,7 @@ #include <cstdio> #include <cstring> #include <map> +#include <string_view> #include <vector> #include <iostream> #include <libxml/parser.h> @@ -66,7 +67,7 @@ namespace XSLT if (m_tcontext) m_tcontext->_private = nullptr; } - void insertByName(const OUString& streamName, const OString& content); + void insertByName(const OUString& streamName, std::string_view content); OString getByName(const OUString& streamName); void registercontext(xsltTransformContextPtr context) { @@ -83,8 +84,8 @@ namespace XSLT void ensureCreateRootStorage(); OString encodeSubStorage(const OUString& streamName); - void insertSubStorage(const OUString& streamName, const OString& content); - void initRootStorageFromBase64(const OString& content); + void insertSubStorage(const OUString& streamName, std::string_view content); + void initRootStorageFromBase64(std::string_view content); css::uno::Reference<XStream> createTempFile(); }; } diff --git a/forms/source/component/DatabaseForm.cxx b/forms/source/component/DatabaseForm.cxx index d46cd0b0d3f3..97c76efb5eff 100644 --- a/forms/source/component/DatabaseForm.cxx +++ b/forms/source/component/DatabaseForm.cxx @@ -17,6 +17,9 @@ * the License at http://www.apache.org/licenses/LICENSE-2.0 . */ +#include <sal/config.h> + +#include <string_view> #include <componenttools.hxx> #include "DatabaseForm.hxx" @@ -916,7 +919,7 @@ void ODatabaseForm::Encode( OUString& rString ) void ODatabaseForm::InsertTextPart( INetMIMEMessage& rParent, const OUString& rName, - const OUString& rData ) + std::u16string_view rData ) { // Create part as MessageChild std::unique_ptr<INetMIMEMessage> pChild(new INetMIMEMessage); @@ -2075,7 +2078,7 @@ void SAL_CALL ODatabaseForm::submit( const Reference<XControl>& Control, } static void lcl_dispatch(const Reference< XFrame >& xFrame,const Reference<XURLTransformer>& xTransformer,const OUString& aURLStr,const OUString& aReferer,const OUString& aTargetName - ,const OUString& aData,rtl_TextEncoding _eEncoding) + ,std::u16string_view aData,rtl_TextEncoding _eEncoding) { URL aURL; aURL.Complete = aURLStr; diff --git a/forms/source/component/DatabaseForm.hxx b/forms/source/component/DatabaseForm.hxx index b64352e5e1f3..c89a197ba4e9 100644 --- a/forms/source/component/DatabaseForm.hxx +++ b/forms/source/component/DatabaseForm.hxx @@ -21,6 +21,7 @@ #include <sal/config.h> +#include <string_view> #include <vector> #include <propertybaghelper.hxx> @@ -505,7 +506,7 @@ private: void FillSuccessfulList(HtmlSuccessfulObjList& rList, const css::uno::Reference< css::awt::XControl>& rxSubmitButton, const css::awt::MouseEvent& MouseEvt); - static void InsertTextPart(INetMIMEMessage& rParent, const OUString& rName, const OUString& rData); + static void InsertTextPart(INetMIMEMessage& rParent, const OUString& rName, std::u16string_view rData); static void InsertFilePart(INetMIMEMessage& rParent, const OUString& rName, const OUString& rFileName); static void Encode(OUString& rString); diff --git a/forms/source/xforms/submission/serialization_urlencoded.cxx b/forms/source/xforms/submission/serialization_urlencoded.cxx index ab27bf5908ae..22a625ccb4a0 100644 --- a/forms/source/xforms/submission/serialization_urlencoded.cxx +++ b/forms/source/xforms/submission/serialization_urlencoded.cxx @@ -69,7 +69,8 @@ bool CSerializationURLEncoded::is_unreserved(char c) } return false; } -void CSerializationURLEncoded::encode_and_append(const OUString& aString, OStringBuffer& aBuffer) +void CSerializationURLEncoded::encode_and_append( + std::u16string_view aString, OStringBuffer& aBuffer) { OString utf8String = OUStringToOString(aString, RTL_TEXTENCODING_UTF8); const sal_uInt8 *pString = reinterpret_cast< const sal_uInt8 * >( utf8String.getStr() ); diff --git a/forms/source/xforms/submission/serialization_urlencoded.hxx b/forms/source/xforms/submission/serialization_urlencoded.hxx index afd9d5488568..334066f93ba5 100644 --- a/forms/source/xforms/submission/serialization_urlencoded.hxx +++ b/forms/source/xforms/submission/serialization_urlencoded.hxx @@ -20,6 +20,10 @@ #ifndef INCLUDED_FORMS_SOURCE_XFORMS_SUBMISSION_SERIALIZATION_URLENCODED_HXX #define INCLUDED_FORMS_SOURCE_XFORMS_SUBMISSION_SERIALIZATION_URLENCODED_HXX +#include <sal/config.h> + +#include <string_view> + #include <com/sun/star/io/XPipe.hpp> #include <rtl/strbuf.hxx> @@ -32,7 +36,7 @@ private: css::uno::Reference<css::io::XPipe> m_aPipe; static bool is_unreserved(char); - static void encode_and_append(const OUString& aString, OStringBuffer& aBuffer); + static void encode_and_append(std::u16string_view aString, OStringBuffer& aBuffer); void serialize_node(const css::uno::Reference<css::xml::dom::XNode>& aNode); public: diff --git a/fpicker/source/office/OfficeControlAccess.cxx b/fpicker/source/office/OfficeControlAccess.cxx index b8bd0cfed4d7..9095c12ee873 100644 --- a/fpicker/source/office/OfficeControlAccess.cxx +++ b/fpicker/source/office/OfficeControlAccess.cxx @@ -211,7 +211,7 @@ namespace svt return sHelpURL; } - Any OControlAccess::getControlProperty( const OUString& rControlName, const OUString& rControlProperty ) + Any OControlAccess::getControlProperty( std::u16string_view rControlName, const OUString& rControlProperty ) { // look up the control sal_Int16 nControlId = -1; @@ -232,7 +232,7 @@ namespace svt return implGetControlProperty( pControl, aPropDesc->nPropertyId ); } - weld::Widget* OControlAccess::implGetControl( const OUString& rControlName, sal_Int16* _pId, PropFlags* _pPropertyMask ) const + weld::Widget* OControlAccess::implGetControl( std::u16string_view rControlName, sal_Int16* _pId, PropFlags* _pPropertyMask ) const { weld::Widget* pControl = nullptr; ControlDescription tmpDesc; @@ -260,7 +260,7 @@ namespace svt return pControl; } - void OControlAccess::setControlProperty( const OUString& rControlName, const OUString& rControlProperty, const css::uno::Any& rValue ) + void OControlAccess::setControlProperty( std::u16string_view rControlName, const OUString& rControlProperty, const css::uno::Any& rValue ) { // look up the control sal_Int16 nControlId = -1; @@ -292,7 +292,7 @@ namespace svt return aControls; } - Sequence< OUString > OControlAccess::getSupportedControlProperties( const OUString& rControlName ) + Sequence< OUString > OControlAccess::getSupportedControlProperties( std::u16string_view rControlName ) { sal_Int16 nControlId = -1; PropFlags nPropertyMask = PropFlags::NONE; @@ -311,7 +311,7 @@ namespace svt return aProps; } - bool OControlAccess::isControlSupported( const OUString& rControlName ) + bool OControlAccess::isControlSupported( std::u16string_view rControlName ) { ControlDescription tmpDesc; OString aControlName = OUStringToOString(rControlName, RTL_TEXTENCODING_UTF8); @@ -319,7 +319,7 @@ namespace svt return ::std::binary_search( s_pControls, s_pControlsEnd, tmpDesc, ControlDescriptionLookup() ); } - bool OControlAccess::isControlPropertySupported( const OUString& rControlName, const OUString& rControlProperty ) + bool OControlAccess::isControlPropertySupported( std::u16string_view rControlName, const OUString& rControlProperty ) { // look up the control sal_Int16 nControlId = -1; diff --git a/fpicker/source/office/OfficeControlAccess.hxx b/fpicker/source/office/OfficeControlAccess.hxx index eabc3c3705c8..3495e95aedc3 100644 --- a/fpicker/source/office/OfficeControlAccess.hxx +++ b/fpicker/source/office/OfficeControlAccess.hxx @@ -20,6 +20,10 @@ #ifndef INCLUDED_FPICKER_SOURCE_OFFICE_OFFICECONTROLACCESS_HXX #define INCLUDED_FPICKER_SOURCE_OFFICE_OFFICECONTROLACCESS_HXX +#include <sal/config.h> + +#include <string_view> + #include "fileview.hxx" #include "pickercallbacks.hxx" #include <o3tl/typed_flags_set.hxx> @@ -66,14 +70,14 @@ namespace svt OControlAccess( IFilePickerController* pController, SvtFileView* pFileView ); // XControlAccess implementation - void setControlProperty( const OUString& rControlName, const OUString& rControlProperty, const css::uno::Any& rValue ); - css::uno::Any getControlProperty( const OUString& rControlName, const OUString& rControlProperty ); + void setControlProperty( std::u16string_view rControlName, const OUString& rControlProperty, const css::uno::Any& rValue ); + css::uno::Any getControlProperty( std::u16string_view rControlName, const OUString& rControlProperty ); // XControlInformation implementation css::uno::Sequence< OUString > getSupportedControls( ) const; - css::uno::Sequence< OUString > getSupportedControlProperties( const OUString& rControlName ); - static bool isControlSupported( const OUString& rControlName ); - bool isControlPropertySupported( const OUString& rControlName, const OUString& rControlProperty ); + css::uno::Sequence< OUString > getSupportedControlProperties( std::u16string_view rControlName ); + static bool isControlSupported( std::u16string_view rControlName ); + bool isControlPropertySupported( std::u16string_view rControlName, const OUString& rControlProperty ); // XFilePickerControlAccess void setValue( sal_Int16 nId, sal_Int16 nCtrlAction, const css::uno::Any& rValue ); @@ -105,7 +109,7 @@ namespace svt weld::Widget* pControl, PropFlags nProperty, const css::uno::Any& rValue, bool bIgnoreIllegalArgument = true ); - weld::Widget* implGetControl( const OUString& rControlName, sal_Int16* pId, PropFlags* pPropertyMask = nullptr ) const; + weld::Widget* implGetControl( std::u16string_view rControlName, sal_Int16* pId, PropFlags* pPropertyMask = nullptr ) const; /** implements the various methods for retrieving properties from controls diff --git a/framework/inc/dispatch/interceptionhelper.hxx b/framework/inc/dispatch/interceptionhelper.hxx index 73146ea92bf7..61c4ed8c9ef9 100644 --- a/framework/inc/dispatch/interceptionhelper.hxx +++ b/framework/inc/dispatch/interceptionhelper.hxx @@ -32,6 +32,7 @@ #include <cppuhelper/weakref.hxx> #include <deque> +#include <string_view> namespace framework{ @@ -103,7 +104,7 @@ class InterceptionHelper final : public ::cppu::WeakImplHelper< @return An iterator object, which points directly to the located item inside this list. In case no interceptor could be found, it points to the end of this list! */ - iterator findByPattern(const OUString& sURL) + iterator findByPattern(std::u16string_view sURL) { iterator pIt; for (pIt=begin(); pIt!=end(); ++pIt) diff --git a/framework/inc/helper/persistentwindowstate.hxx b/framework/inc/helper/persistentwindowstate.hxx index f467ef9a2286..6b811b9ec3d9 100644 --- a/framework/inc/helper/persistentwindowstate.hxx +++ b/framework/inc/helper/persistentwindowstate.hxx @@ -20,6 +20,10 @@ #ifndef INCLUDED_FRAMEWORK_INC_HELPER_PERSISTENTWINDOWSTATE_HXX #define INCLUDED_FRAMEWORK_INC_HELPER_PERSISTENTWINDOWSTATE_HXX +#include <sal/config.h> + +#include <string_view> + #include <com/sun/star/lang/XInitialization.hpp> #include <com/sun/star/frame/XFrame.hpp> #include <com/sun/star/frame/XFrameActionListener.hpp> @@ -154,7 +158,7 @@ class PersistentWindowState final : public ::cppu::WeakImplHelper< contains the information about position and size. */ static void implst_setWindowStateOnWindow(const css::uno::Reference< css::awt::XWindow >& xWindow , - const OUString& sWindowState); + std::u16string_view sWindowState); }; // class PersistentWindowState diff --git a/framework/source/helper/persistentwindowstate.cxx b/framework/source/helper/persistentwindowstate.cxx index 29ad01c1d0fc..5d4212e1ac2a 100644 --- a/framework/source/helper/persistentwindowstate.cxx +++ b/framework/source/helper/persistentwindowstate.cxx @@ -222,11 +222,11 @@ OUString PersistentWindowState::implst_getWindowStateFromWindow(const css::uno:: } void PersistentWindowState::implst_setWindowStateOnWindow(const css::uno::Reference< css::awt::XWindow >& xWindow , - const OUString& sWindowState) + std::u16string_view sWindowState) { if ( (!xWindow.is() ) || - ( sWindowState.isEmpty() ) + ( sWindowState.empty() ) ) return; diff --git a/framework/source/jobs/jobdata.cxx b/framework/source/jobs/jobdata.cxx index 3f7a96674d3d..e04b18227326 100644 --- a/framework/source/jobs/jobdata.cxx +++ b/framework/source/jobs/jobdata.cxx @@ -17,6 +17,10 @@ * the License at http://www.apache.org/licenses/LICENSE-2.0 . */ +#include <sal/config.h> + +#include <string_view> + #include <jobs/configaccess.hxx> #include <jobs/jobdata.hxx> #include <classes/converter.hxx> @@ -415,15 +419,15 @@ void JobData::disableJob() aConfig.close(); } -static bool isEnabled( const OUString& sAdminTime , - const OUString& sUserTime ) +static bool isEnabled( std::u16string_view sAdminTime , + std::u16string_view sUserTime ) { /*Attention! To prevent interpreting of TriGraphs inside next const string value, we have to encode all '?' signs. Otherwise e.g. "??-" will be translated to "~" ... */ - WildCard aISOPattern("\?\?\?\?-\?\?-\?\?*"); + WildCard aISOPattern(u"\?\?\?\?-\?\?-\?\?*"); bool bValidAdmin = aISOPattern.Matches(sAdminTime); bool bValidUser = aISOPattern.Matches(sUserTime ); diff --git a/helpcompiler/source/BasCodeTagger.cxx b/helpcompiler/source/BasCodeTagger.cxx index deaaa0f5253d..415dec04c470 100644 --- a/helpcompiler/source/BasCodeTagger.cxx +++ b/helpcompiler/source/BasCodeTagger.cxx @@ -141,7 +141,7 @@ void BasicCodeTagger::tagParagraph( xmlNodePtr paragraph ) m_Highlighter.getHighlightPortions( strLine, portions ); for (auto const& portion : portions) { - OString sToken(OUStringToOString(strLine.copy(portion.nBegin, portion.nEnd-portion.nBegin), RTL_TEXTENCODING_UTF8)); + OString sToken(OUStringToOString(strLine.subView(portion.nBegin, portion.nEnd-portion.nBegin), RTL_TEXTENCODING_UTF8)); xmlNodePtr text = xmlNewText(reinterpret_cast<const xmlChar*>(sToken.getStr())); if ( portion.tokenType != TokenType::Whitespace ) { diff --git a/helpcompiler/source/HelpLinker.cxx b/helpcompiler/source/HelpLinker.cxx index 46a9fac2edf2..166ff9918f76 100644 --- a/helpcompiler/source/HelpLinker.cxx +++ b/helpcompiler/source/HelpLinker.cxx @@ -847,10 +847,10 @@ HelpProcessingErrorInfo& HelpProcessingErrorInfo::operator=( const struct HelpPr bool compileExtensionHelp ( const OUString& aOfficeHelpPath, - const OUString& aExtensionName, + std::u16string_view aExtensionName, const OUString& aExtensionLanguageRoot, sal_Int32 nXhpFileCount, const OUString* pXhpFiles, - const OUString& aDestination, + std::u16string_view aDestination, HelpProcessingErrorInfo& o_rHelpProcessingErrorInfo ) { diff --git a/i18nlangtag/source/isolang/isolang.cxx b/i18nlangtag/source/isolang/isolang.cxx index ecab61113ab1..ae1b42ba3ab0 100644 --- a/i18nlangtag/source/isolang/isolang.cxx +++ b/i18nlangtag/source/isolang/isolang.cxx @@ -1416,8 +1416,8 @@ LanguageType MsLangId::Conversion::convertIsoNamesToLanguage( const OUString& rL // static -LanguageType MsLangId::Conversion::convertIsoNamesToLanguage( const OString& rLang, - const OString& rCountry ) +LanguageType MsLangId::Conversion::convertIsoNamesToLanguage( std::string_view rLang, + std::string_view rCountry ) { OUString aLang = OStringToOUString( rLang, RTL_TEXTENCODING_ASCII_US); OUString aCountry = OStringToOUString( rCountry, RTL_TEXTENCODING_ASCII_US); diff --git a/i18nlangtag/source/languagetag/languagetag.cxx b/i18nlangtag/source/languagetag/languagetag.cxx index 2f77ee148f71..70895cab1651 100644 --- a/i18nlangtag/source/languagetag/languagetag.cxx +++ b/i18nlangtag/source/languagetag/languagetag.cxx @@ -1521,7 +1521,7 @@ void LanguageTag::convertFromRtlLocale() if (maLocale.Variant.isEmpty()) return; - OString aStr = OUStringToOString( maLocale.Language + "_" + maLocale.Country + maLocale.Variant, + OString aStr = OUStringToOString(maLocale.Language, RTL_TEXTENCODING_UTF8) + "_" + OUStringToOString(OUString(maLocale.Country + maLocale.Variant), RTL_TEXTENCODING_UTF8); /* FIXME: let liblangtag parse this entirely with * lt_tag_convert_from_locale() but that needs a patch to pass the diff --git a/i18nlangtag/source/languagetag/languagetagicu.cxx b/i18nlangtag/source/languagetag/languagetagicu.cxx index 18d37f704773..c35e7a85ef8b 100644 --- a/i18nlangtag/source/languagetag/languagetagicu.cxx +++ b/i18nlangtag/source/languagetag/languagetagicu.cxx @@ -35,7 +35,7 @@ icu::Locale LanguageTagIcu::getIcuLocale( const LanguageTag & rLanguageTag ) // static -icu::Locale LanguageTagIcu::getIcuLocale( const LanguageTag & rLanguageTag, const OUString & rVariant, const OUString & rKeywords ) +icu::Locale LanguageTagIcu::getIcuLocale( const LanguageTag & rLanguageTag, std::u16string_view rVariant, std::u16string_view rKeywords ) { /* FIXME: how should this work with any BCP47? */ return icu::Locale( diff --git a/i18npool/source/collator/collator_unicode.cxx b/i18npool/source/collator/collator_unicode.cxx index c05a9cb025c6..dd273e687f21 100644 --- a/i18npool/source/collator/collator_unicode.cxx +++ b/i18npool/source/collator/collator_unicode.cxx @@ -403,7 +403,7 @@ Collator_Unicode::loadCollatorAlgorithm(const OUString& rAlgorithm, const lang:: uppercase itself, so we don't have to bother with that. */ icu::Locale icuLocale( LanguageTagIcu::getIcuLocale( LanguageTag( rLocale), - "", rAlgorithm.isEmpty() ? OUString("") : "collation=" + rAlgorithm)); + u"", rAlgorithm.isEmpty() ? OUString("") : "collation=" + rAlgorithm)); // FIXME: apparently we get here in LOKit case only. When the language is Japanese, we pass "ja@collation=phonetic (alphanumeric first)" to ICU // and ICU does not like this (U_ILLEGAL_ARGUMENT_ERROR). Subsequently LOKit crashes, because collator is nullptr. diff --git a/i18npool/source/localedata/LocaleNode.cxx b/i18npool/source/localedata/LocaleNode.cxx index 997355ffab4e..3040f3312d42 100644 --- a/i18npool/source/localedata/LocaleNode.cxx +++ b/i18npool/source/localedata/LocaleNode.cxx @@ -201,7 +201,7 @@ void LocaleNode::incError( const char* pStr ) const fprintf( stderr, "Error: %s\n", pStr); } -void LocaleNode::incError( const OUString& rStr ) const +void LocaleNode::incError( std::u16string_view rStr ) const { incError( OSTR( rStr)); } @@ -212,13 +212,13 @@ void LocaleNode::incErrorInt( const char* pStr, int nVal ) const fprintf( stderr, pStr, nVal); } -void LocaleNode::incErrorStr( const char* pStr, const OUString& rVal ) const +void LocaleNode::incErrorStr( const char* pStr, std::u16string_view rVal ) const { ++nError; fprintf( stderr, pStr, OSTR( rVal)); } -void LocaleNode::incErrorStrStr( const char* pStr, const OUString& rVal1, const OUString& rVal2 ) const +void LocaleNode::incErrorStrStr( const char* pStr, std::u16string_view rVal1, std::u16string_view rVal2 ) const { ++nError; fprintf(stderr, pStr, OSTR(rVal1), OSTR(rVal2)); @@ -1526,8 +1526,8 @@ static void lcl_writeAbbrFullNarrArrays( const OFileWriter & of, sal_Int16 nCoun } } -bool LCCalendarNode::expectedCalendarElement( const OUString& rName, - const LocaleNode* pNode, sal_Int16 nChild, const OUString& rCalendarID ) const +bool LCCalendarNode::expectedCalendarElement( std::u16string_view rName, + const LocaleNode* pNode, sal_Int16 nChild, std::u16string_view rCalendarID ) const { bool bFound = true; if (nChild >= 0) @@ -1734,7 +1734,7 @@ void LCCalendarNode::generateCode (const OFileWriter &of) const } else { if (erasNode == nullptr) erasNode = calNode -> getChildAt(nChild); - if (!expectedCalendarElement("Eras", erasNode, -1, calendarID)) + if (!expectedCalendarElement(u"Eras", erasNode, -1, calendarID)) { --nChild; } @@ -1746,7 +1746,7 @@ void LCCalendarNode::generateCode (const OFileWriter &of) const elementTag = "era"; for (j = 0; j < nbOfEras[i]; j++) { LocaleNode *currNode = erasNode -> getChildAt(j); - if (!expectedCalendarElement("Era", currNode, -1, calendarID)) + if (!expectedCalendarElement(u"Era", currNode, -1, calendarID)) { continue; // for } @@ -1764,7 +1764,7 @@ void LCCalendarNode::generateCode (const OFileWriter &of) const } ++nChild; - if (expectedCalendarElement("StartDayOfWeek", calNode, nChild, calendarID)) + if (expectedCalendarElement(u"StartDayOfWeek", calNode, nChild, calendarID)) { str = calNode->getChildAt(nChild)->getChildAt(0)->getValue(); if (nbOfDays[i]) @@ -1783,7 +1783,7 @@ void LCCalendarNode::generateCode (const OFileWriter &of) const ++nChild; } - if (expectedCalendarElement("MinimalDaysInFirstWeek", calNode, nChild, calendarID)) + if (expectedCalendarElement(u"MinimalDaysInFirstWeek", calNode, nChild, calendarID)) { str = calNode ->getChildAt(nChild)-> getValue(); sal_Int16 nDays = sal::static_int_cast<sal_Int16>( str.toInt32() ); diff --git a/i18npool/source/localedata/LocaleNode.hxx b/i18npool/source/localedata/LocaleNode.hxx index 0d46a9e80876..b187cc9adbd9 100644 --- a/i18npool/source/localedata/LocaleNode.hxx +++ b/i18npool/source/localedata/LocaleNode.hxx @@ -20,6 +20,7 @@ #define INCLUDED_I18NPOOL_SOURCE_LOCALEDATA_LOCALENODE_HXX #include <string> +#include <string_view> #include <vector> #include <memory> @@ -41,13 +42,13 @@ public: void writeAsciiString(const char *str)const ; void writeInt(sal_Int16 nb) const; void writeFunction(const char *func, const char *count, const char *array) const; - void writeRefFunction(const char *func, const OUString& useLocale) const; + void writeRefFunction(const char *func, std::u16string_view useLocale) const; void writeFunction(const char *func, const char *count, const char *array, const char *from, const char *to) const; - void writeRefFunction(const char *func, const OUString& useLocale, const char *to) const; + void writeRefFunction(const char *func, std::u16string_view useLocale, const char *to) const; void writeFunction2(const char *func, const char *style, const char* attr, const char *array) const; - void writeRefFunction2(const char *func, const OUString& useLocale) const; + void writeRefFunction2(const char *func, std::u16string_view useLocale) const; void writeFunction3(const char *func, const char *style, const char* levels, const char* attr, const char *array) const; - void writeRefFunction3(const char *func, const OUString& useLocale) const; + void writeRefFunction3(const char *func, std::u16string_view useLocale) const; void writeIntParameter(const char* pAsciiStr, const sal_Int16 count, sal_Int16 val) const; bool writeDefaultParameter(const char* pAsciiStr, std::u16string_view str, sal_Int16 count) const; void writeParameter(const char* pAsciiStr, const OUString& aChars) const; @@ -109,13 +110,14 @@ public: // ++nError with output to stderr void incError( const char* pStr ) const; // ++nError with output to stderr - void incError( const OUString& rStr ) const; + void incError( std::u16string_view rStr ) const; // ++nError with output to stderr, pStr should contain "%d" void incErrorInt( const char* pStr, int nVal ) const; // ++nError with output to stderr, pStr should contain "%s" - void incErrorStr( const char* pStr, const OUString& rVal ) const; + void incErrorStr( const char* pStr, std::u16string_view rVal ) const; // ++nError with output to stderr, pStr should contain "%s %s" - void incErrorStrStr( const char* pStr, const OUString& rVal1, const OUString& rVal2 ) const; + void incErrorStrStr( const char* pStr, std::u16string_view rVal1, std::u16string_view rVal2 ) + const; static LocaleNode* createNode (const OUString& name,const Reference< XAttributeList > & attr); }; @@ -176,8 +178,8 @@ public: virtual void generateCode (const OFileWriter &of) const override; - bool expectedCalendarElement( const OUString& rName, - const LocaleNode* pNode, sal_Int16 nChild, const OUString& rCalendarID ) const; + bool expectedCalendarElement( std::u16string_view rName, + const LocaleNode* pNode, sal_Int16 nChild, std::u16string_view rCalendarID ) const; }; class LCCurrencyNode : public LocaleNode { diff --git a/i18npool/source/localedata/filewriter.cxx b/i18npool/source/localedata/filewriter.cxx index f8643025d91d..4c095b14bc84 100644 --- a/i18npool/source/localedata/filewriter.cxx +++ b/i18npool/source/localedata/filewriter.cxx @@ -57,7 +57,7 @@ void OFileWriter::writeFunction(const char *func, const char *count, const char fprintf(m_f, "\treturn (sal_Unicode**)%s;\n}\n", array); } -void OFileWriter::writeRefFunction(const char *func, const OUString& useLocale) const +void OFileWriter::writeRefFunction(const char *func, std::u16string_view useLocale) const { OString aRefLocale( OUStringToOString(useLocale, RTL_TEXTENCODING_ASCII_US) ); const char* locale = aRefLocale.getStr(); @@ -75,7 +75,7 @@ void OFileWriter::writeFunction(const char *func, const char *count, const char fprintf(m_f, "\treturn (sal_Unicode**)%s;\n}\n", array); } -void OFileWriter::writeRefFunction(const char *func, const OUString& useLocale, const char *to) const +void OFileWriter::writeRefFunction(const char *func, std::u16string_view useLocale, const char *to) const { OString aRefLocale( OUStringToOString(useLocale, RTL_TEXTENCODING_ASCII_US) ); const char* locale = aRefLocale.getStr(); @@ -94,7 +94,7 @@ void OFileWriter::writeFunction2(const char *func, const char *style, const char fprintf(m_f, "\treturn %s;\n}\n", array); } -void OFileWriter::writeRefFunction2(const char *func, const OUString& useLocale) const +void OFileWriter::writeRefFunction2(const char *func, std::u16string_view useLocale) const { OString aRefLocale( OUStringToOString(useLocale, RTL_TEXTENCODING_ASCII_US) ); const char* locale = aRefLocale.getStr(); @@ -112,7 +112,7 @@ void OFileWriter::writeFunction3(const char *func, const char *style, const char fprintf(m_f, "\treturn %s;\n}\n", array); } -void OFileWriter::writeRefFunction3(const char *func, const OUString& useLocale) const +void OFileWriter::writeRefFunction3(const char *func, std::u16string_view useLocale) const { OString aRefLocale( OUStringToOString(useLocale, RTL_TEXTENCODING_ASCII_US) ); const char* locale = aRefLocale.getStr(); diff --git a/idl/inc/database.hxx b/idl/inc/database.hxx index 3e7706b25b1e..44ef25eafbcf 100644 --- a/idl/inc/database.hxx +++ b/idl/inc/database.hxx @@ -27,6 +27,7 @@ #include <rtl/ustring.hxx> #include <set> +#include <string_view> #include <exception> class SvCommand; @@ -112,7 +113,7 @@ public: sal_uInt32 GetUniqueId() { return ++nUniqueId; } bool FindId( const OString& rIdName, sal_uLong * pVal ); void InsertId( const OString& rIdName, sal_uLong nVal ); - bool ReadIdFile( const OString& rFileName ); + bool ReadIdFile( std::string_view rFileName ); SvMetaType * FindType( const OString& rName ); static SvMetaType * FindType( const SvMetaType *, SvRefMemberList<SvMetaType *>& ); @@ -124,7 +125,7 @@ public: SvMetaClass * ReadKnownClass( SvTokenStream & rInStm ); SvMetaClass * FindKnownClass( const OString& aName ); void AddDepFile(OUString const& rFileName); - void WriteDepFile(SvFileStream & rStream, OUString const& rTarget); + void WriteDepFile(SvFileStream & rStream, std::u16string_view rTarget); }; class SvIdlWorkingBase : public SvIdlDataBase diff --git a/idl/source/prj/command.cxx b/idl/source/prj/command.cxx index 29b01d11219a..b665d792d8bb 100644 --- a/idl/source/prj/command.cxx +++ b/idl/source/prj/command.cxx @@ -154,7 +154,7 @@ static bool ResponseFile( std::vector<OUString> * pList, int argc, char ** argv static_cast<unsigned char>(aStr[n]) ) ) n++; if( n != nPos ) - pList->push_back( OStringToOUString(aStr.copy(nPos, n - nPos), RTL_TEXTENCODING_ASCII_US) ); + pList->push_back( OStringToOUString(aStr.subView(nPos, n - nPos), RTL_TEXTENCODING_ASCII_US) ); } } } diff --git a/idl/source/prj/database.cxx b/idl/source/prj/database.cxx index 37bf552c76e2..de8aad3d9b74 100644 --- a/idl/source/prj/database.cxx +++ b/idl/source/prj/database.cxx @@ -22,6 +22,8 @@ #include <algorithm> #include <stdio.h> #include <stdlib.h> +#include <string_view> + #include <database.hxx> #include <globals.hxx> #include <rtl/strbuf.hxx> @@ -129,7 +131,7 @@ void SvIdlDataBase::InsertId( const OString& rIdName, sal_uLong nVal ) pIdTable->Insert( rIdName, &nHash )->SetValue( nVal ); } -bool SvIdlDataBase::ReadIdFile( const OString& rOFileName ) +bool SvIdlDataBase::ReadIdFile( std::string_view rOFileName ) { OUString rFileName = OStringToOUString(rOFileName, RTL_TEXTENCODING_ASCII_US); OUString aFullName; @@ -506,7 +508,7 @@ struct WriteDep { SvFileStream & m_rStream; explicit WriteDep(SvFileStream & rStream) : m_rStream(rStream) { } - void operator() (OUString const& rItem) + void operator() (std::u16string_view rItem) { m_rStream.WriteCharPtr( " \\\n " ); m_rStream.WriteOString( OUStringToOString(rItem, RTL_TEXTENCODING_UTF8) ); @@ -519,7 +521,7 @@ struct WriteDummy { SvFileStream & m_rStream; explicit WriteDummy(SvFileStream & rStream) : m_rStream(rStream) { } - void operator() (OUString const& rItem) + void operator() (std::u16string_view rItem) { m_rStream.WriteOString( OUStringToOString(rItem, RTL_TEXTENCODING_UTF8) ); m_rStream.WriteCharPtr( " :\n\n" ); @@ -529,7 +531,7 @@ struct WriteDummy } void SvIdlDataBase::WriteDepFile( - SvFileStream & rStream, OUString const& rTarget) + SvFileStream & rStream, std::u16string_view rTarget) { rStream.WriteOString( OUStringToOString(rTarget, RTL_TEXTENCODING_UTF8) ); rStream.WriteCharPtr( " :" ); diff --git a/idlc/inc/idlc.hxx b/idlc/inc/idlc.hxx index 42f16836adbb..454e70511612 100644 --- a/idlc/inc/idlc.hxx +++ b/idlc/inc/idlc.hxx @@ -23,6 +23,7 @@ #include "aststack.hxx" #include "options.hxx" #include <memory> +#include <string_view> #ifdef SAL_UNX #define SEPARATOR '/' @@ -46,7 +47,7 @@ public: void init(); - bool dumpDeps(OString const& rDepFile, + bool dumpDeps(std::string_view rDepFile, OString const& rTarget); Options* getOptions() @@ -142,7 +143,7 @@ sal_Int32 compileFile(const OString * pathname); sal_Int32 produceFile(const OString& filenameBase, sPair_t const*const pDepFile); // filenameBase is filename without ".idl" -void removeIfExists(const OString& pathname); +void removeIfExists(std::string_view pathname); bool copyFile(const OString* source, const OString& target); // a null source means stdin diff --git a/idlc/source/idlc.cxx b/idlc/source/idlc.cxx index c1d09b4c1b2e..ca47b34fe0d5 100644 --- a/idlc/source/idlc.cxx +++ b/idlc/source/idlc.cxx @@ -315,7 +315,7 @@ struct WriteDummy } bool -Idlc::dumpDeps(OString const& rDepFile, OString const& rTarget) +Idlc::dumpDeps(std::string_view rDepFile, OString const& rTarget) { ::osl::File depFile( OStringToOUString(rDepFile, osl_getThreadTextEncoding())); diff --git a/idlc/source/idlccompile.cxx b/idlc/source/idlccompile.cxx index 8db6d82a026f..bf3325d6821a 100644 --- a/idlc/source/idlccompile.cxx +++ b/idlc/source/idlccompile.cxx @@ -265,7 +265,7 @@ sal_Int32 compileFile(const OString * pathname) { token = dOpt.getToken( 0, ' ', nIndex ); if (token.getLength()) - lCppArgs.push_back(OStringToOUString("-D" + token, RTL_TEXTENCODING_UTF8)); + lCppArgs.push_back("-D" + OStringToOUString(token, RTL_TEXTENCODING_UTF8)); } while( nIndex != -1 ); } @@ -277,7 +277,7 @@ sal_Int32 compileFile(const OString * pathname) { token = incOpt.getToken( 0, ' ', nIndex ); if (token.getLength()) - lCppArgs.push_back(OStringToOUString("-I" + token, RTL_TEXTENCODING_UTF8)); + lCppArgs.push_back("-I" + OStringToOUString(token, RTL_TEXTENCODING_UTF8)); } while( nIndex != -1 ); } diff --git a/idlc/source/idlcproduce.cxx b/idlc/source/idlcproduce.cxx index ff9ca2f2d47f..92e7887236d2 100644 --- a/idlc/source/idlcproduce.cxx +++ b/idlc/source/idlcproduce.cxx @@ -113,7 +113,7 @@ static bool cleanPath() return true; } -void removeIfExists(const OString& pathname) +void removeIfExists(std::string_view pathname) { osl::File::remove(OStringToOUString(pathname, RTL_TEXTENCODING_UTF8)); } diff --git a/include/codemaker/commoncpp.hxx b/include/codemaker/commoncpp.hxx index b7586e872426..dc1b61c6b32c 100644 --- a/include/codemaker/commoncpp.hxx +++ b/include/codemaker/commoncpp.hxx @@ -22,6 +22,8 @@ #include <sal/config.h> +#include <string_view> + #include <codemaker/unotype.hxx> namespace rtl { @@ -43,7 +45,7 @@ namespace codemaker::cpp { rtl::OString scopedCppName(rtl::OString const & type, bool ns_alias=true); rtl::OString translateUnoToCppType( - codemaker::UnoType::Sort sort, rtl::OUString const & nucleus); + codemaker::UnoType::Sort sort, std::u16string_view nucleus); enum class IdentifierTranslationMode { Global, diff --git a/include/codemaker/global.hxx b/include/codemaker/global.hxx index d865e5270aa4..60e0d1bf774b 100644 --- a/include/codemaker/global.hxx +++ b/include/codemaker/global.hxx @@ -23,6 +23,7 @@ #include <list> #include <vector> #include <set> +#include <string_view> #include <osl/file.hxx> #include <rtl/ustring.hxx> @@ -55,7 +56,7 @@ public: friend FileStream &operator<<(FileStream& o, const ::rtl::OString& s); friend FileStream &operator<<(FileStream& o, ::rtl::OStringBuffer const * s); friend FileStream &operator<<(FileStream& o, const ::rtl::OStringBuffer& s); - friend FileStream & operator <<(FileStream & out, rtl::OUString const & s); + friend FileStream & operator <<(FileStream & out, std::u16string_view s); private: oslFileHandle m_file; diff --git a/include/codemaker/typemanager.hxx b/include/codemaker/typemanager.hxx index 5a2d50ec0d90..f76fbb4ca7ea 100644 --- a/include/codemaker/typemanager.hxx +++ b/include/codemaker/typemanager.hxx @@ -22,6 +22,7 @@ #include <sal/config.h> +#include <string_view> #include <vector> #include <codemaker/unotype.hxx> @@ -63,11 +64,11 @@ private: }; -inline OString u2b(OUString const & s) { +inline OString u2b(std::u16string_view s) { return OUStringToOString(s, RTL_TEXTENCODING_UTF8); } -inline OUString b2u(OString const & s) { +inline OUString b2u(std::string_view s) { return OStringToOUString(s, RTL_TEXTENCODING_UTF8); } diff --git a/include/comphelper/docpasswordhelper.hxx b/include/comphelper/docpasswordhelper.hxx index fc98fd3ff34d..bf36cb9250aa 100644 --- a/include/comphelper/docpasswordhelper.hxx +++ b/include/comphelper/docpasswordhelper.hxx @@ -21,6 +21,7 @@ #define INCLUDED_COMPHELPER_DOCPASSWORDHELPER_HXX #include <comphelper/comphelperdllapi.h> +#include <string_view> #include <vector> #include <comphelper/docpasswordrequest.hxx> #include <comphelper/hash.hxx> @@ -110,7 +111,7 @@ public: */ static css::uno::Sequence< css::beans::PropertyValue > - GenerateNewModifyPasswordInfo( const OUString& aPassword ); + GenerateNewModifyPasswordInfo( std::u16string_view aPassword ); /** This helper function allows to check whether @@ -128,7 +129,7 @@ public: */ static bool IsModifyPasswordCorrect( - const OUString& aPassword, + std::u16string_view aPassword, const css::uno::Sequence< css::beans::PropertyValue >& aInfo ); @@ -162,7 +163,7 @@ public: */ static sal_uInt16 GetXLHashAsUINT16( - const OUString& aString, + std::u16string_view aString, rtl_TextEncoding nEnc = RTL_TEXTENCODING_UTF8 ); @@ -178,7 +179,7 @@ public: */ static css::uno::Sequence< sal_Int8 > GetXLHashAsSequence( - const OUString& aString ); + std::u16string_view aString ); /** Convenience function to calculate a salted hash with iterations as diff --git a/include/comphelper/stl_types.hxx b/include/comphelper/stl_types.hxx index 891463253dc5..73e16e1a6d03 100644 --- a/include/comphelper/stl_types.hxx +++ b/include/comphelper/stl_types.hxx @@ -39,7 +39,7 @@ struct UStringMixLess bool m_bCaseSensitive; public: UStringMixLess(bool bCaseSensitive = true):m_bCaseSensitive(bCaseSensitive){} - bool operator() (const OUString& x, const OUString& y) const + bool operator() (const OUString& x, std::u16string_view y) const { if (m_bCaseSensitive) return x.compareTo(y) < 0; diff --git a/include/comphelper/storagehelper.hxx b/include/comphelper/storagehelper.hxx index a4bd3605c296..839bad262db0 100644 --- a/include/comphelper/storagehelper.hxx +++ b/include/comphelper/storagehelper.hxx @@ -24,6 +24,7 @@ #include <com/sun/star/embed/ElementModes.hpp> #include <comphelper/comphelperdllapi.h> #include <memory> +#include <string_view> #define PACKAGE_STORAGE_FORMAT_STRING "PackageFormat" #define ZIP_STORAGE_FORMAT_STRING "ZipFormat" @@ -171,7 +172,7 @@ public: static css::uno::Sequence< css::beans::NamedValue > CreatePackageEncryptionData( - const OUString& aPassword ); + std::u16string_view aPassword ); static css::uno::Sequence< css::beans::NamedValue > CreateGpgPackageEncryptionData(); diff --git a/include/connectivity/CommonTools.hxx b/include/connectivity/CommonTools.hxx index 98f5a1c50f3b..a5279024e351 100644 --- a/include/connectivity/CommonTools.hxx +++ b/include/connectivity/CommonTools.hxx @@ -138,7 +138,7 @@ namespace connectivity @param _sClassName The class name to look for. */ - OOO_DLLPUBLIC_DBTOOLS bool existsJavaClassByName( const ::rtl::Reference< jvmaccess::VirtualMachine >& _pJVM,const OUString& _sClassName ); + OOO_DLLPUBLIC_DBTOOLS bool existsJavaClassByName( const ::rtl::Reference< jvmaccess::VirtualMachine >& _pJVM,std::u16string_view _sClassName ); #endif } diff --git a/include/connectivity/DriversConfig.hxx b/include/connectivity/DriversConfig.hxx index f64a5a63882c..ceb15bedd2db 100644 --- a/include/connectivity/DriversConfig.hxx +++ b/include/connectivity/DriversConfig.hxx @@ -22,6 +22,7 @@ #include <sal/config.h> #include <map> +#include <string_view> #include <com/sun/star/uno/Sequence.h> #include <connectivity/dbtoolsdllapi.hxx> @@ -57,7 +58,7 @@ namespace connectivity { typedef salhelper::SingletonRef<DriversConfigImpl> OSharedConfigNode; - const ::comphelper::NamedValueCollection& impl_get(const OUString& _sURL,sal_Int32 _nProps) const; + const ::comphelper::NamedValueCollection& impl_get(std::u16string_view _sURL,sal_Int32 _nProps) const; public: DriversConfig(const css::uno::Reference< css::uno::XComponentContext >& _rxORB); ~DriversConfig(); @@ -65,11 +66,11 @@ namespace connectivity DriversConfig( const DriversConfig& ); DriversConfig& operator=( const DriversConfig& ); - OUString getDriverFactoryName(const OUString& _sUrl) const; - OUString getDriverTypeDisplayName(const OUString& _sUrl) const; - const ::comphelper::NamedValueCollection& getProperties(const OUString& _sURL) const; - const ::comphelper::NamedValueCollection& getFeatures(const OUString& _sURL) const; - const ::comphelper::NamedValueCollection& getMetaData(const OUString& _sURL) const; + OUString getDriverFactoryName(std::u16string_view _sUrl) const; + OUString getDriverTypeDisplayName(std::u16string_view _sUrl) const; + const ::comphelper::NamedValueCollection& getProperties(std::u16string_view _sURL) const; + const ::comphelper::NamedValueCollection& getFeatures(std::u16string_view _sURL) const; + const ::comphelper::NamedValueCollection& getMetaData(std::u16string_view _sURL) const; css::uno::Sequence< OUString > getURLs() const; private: OSharedConfigNode m_aNode; diff --git a/include/connectivity/internalnode.hxx b/include/connectivity/internalnode.hxx index 13ace88dc67a..3402f8e3a447 100644 --- a/include/connectivity/internalnode.hxx +++ b/include/connectivity/internalnode.hxx @@ -18,6 +18,10 @@ */ #pragma once +#include <sal/config.h> + +#include <string_view> + #include <connectivity/sqlnode.hxx> namespace connectivity @@ -33,7 +37,7 @@ namespace connectivity OSQLInternalNode(const char* pNewValue, SQLNodeType eNodeType, sal_uInt32 nNodeID = 0); - OSQLInternalNode(const OString& _rNewValue, + OSQLInternalNode(std::string_view _rNewValue, SQLNodeType eNodeType, sal_uInt32 nNodeID = 0); OSQLInternalNode(const OUString& _rNewValue, diff --git a/include/connectivity/sqlnode.hxx b/include/connectivity/sqlnode.hxx index 7f394ef49de3..0e9ca82bec4a 100644 --- a/include/connectivity/sqlnode.hxx +++ b/include/connectivity/sqlnode.hxx @@ -24,6 +24,7 @@ #include <com/sun/star/uno/Reference.hxx> #include <memory> #include <set> +#include <string_view> #include <vector> #include <rtl/ustrbuf.hxx> @@ -230,7 +231,7 @@ namespace connectivity SQLNodeType _eNodeType, sal_uInt32 _nNodeID = 0); - OSQLParseNode(const OString& _rValue, + OSQLParseNode(std::string_view _rValue, SQLNodeType eNewNodeType, sal_uInt32 nNewNodeID=0); diff --git a/include/connectivity/sqlparse.hxx b/include/connectivity/sqlparse.hxx index 2cd85ba69fa7..b92ff3b1c7c0 100644 --- a/include/connectivity/sqlparse.hxx +++ b/include/connectivity/sqlparse.hxx @@ -20,6 +20,7 @@ #define INCLUDED_CONNECTIVITY_SQLPARSE_HXX #include <memory> +#include <string_view> #include <com/sun/star/uno/Reference.h> #include <osl/mutex.hxx> @@ -195,7 +196,7 @@ namespace connectivity // RuleId with enum, far more efficient static sal_uInt32 RuleID(OSQLParseNode::Rule eRule); // compares the _sFunctionName with all known function names and return the DataType of the return value - static sal_Int32 getFunctionReturnType(const OUString& _sFunctionName, const IParseContext* pContext); + static sal_Int32 getFunctionReturnType(std::u16string_view _sFunctionName, const IParseContext* pContext); // returns the type for a parameter in a given function name static sal_Int32 getFunctionParameterType(sal_uInt32 _nTokenId,sal_uInt32 _nPos); diff --git a/include/helpcompiler/compilehelp.hxx b/include/helpcompiler/compilehelp.hxx index 04c573a2596e..6d2d99be2a24 100644 --- a/include/helpcompiler/compilehelp.hxx +++ b/include/helpcompiler/compilehelp.hxx @@ -20,6 +20,10 @@ #ifndef INCLUDED_HELPCOMPILER_COMPILEHELP_HXX #define INCLUDED_HELPCOMPILER_COMPILEHELP_HXX +#include <sal/config.h> + +#include <string_view> + #include <sal/types.h> #if defined(HELPLINKER_DLLIMPLEMENTATION) @@ -58,10 +62,10 @@ struct HelpProcessingErrorInfo HELPLINKER_DLLPUBLIC bool compileExtensionHelp ( const OUString& aOfficeHelpPath, - const OUString& aExtensionName, + std::u16string_view aExtensionName, const OUString& aExtensionLanguageRoot, sal_Int32 nXhpFileCount, const OUString* pXhpFiles, - const OUString& aDestination, + std::u16string_view aDestination, HelpProcessingErrorInfo& o_rHelpProcessingErrorInfo ); diff --git a/include/i18nlangtag/languagetagicu.hxx b/include/i18nlangtag/languagetagicu.hxx index e2c9f7ce2b0e..3025734231ad 100644 --- a/include/i18nlangtag/languagetagicu.hxx +++ b/include/i18nlangtag/languagetagicu.hxx @@ -11,6 +11,9 @@ #define INCLUDED_I18NLANGTAG_LANGUAGETAGICU_HXX #include <sal/config.h> + +#include <string_view> + #include <i18nlangtag/i18nlangtagdllapi.h> #include <rtl/ustring.hxx> #include <unicode/locid.h> @@ -46,7 +49,7 @@ public: Always resolves an empty tag to the system locale. */ - static icu::Locale getIcuLocale( const LanguageTag & rLanguageTag, const OUString & rVariant, const OUString & rKeywords); + static icu::Locale getIcuLocale( const LanguageTag & rLanguageTag, std::u16string_view rVariant, std::u16string_view rKeywords); }; #endif // INCLUDED_I18NLANGTAG_LANGUAGETAGICU_HXX diff --git a/include/i18nlangtag/mslangid.hxx b/include/i18nlangtag/mslangid.hxx index fde9087a4f7f..9376458bdf6f 100644 --- a/include/i18nlangtag/mslangid.hxx +++ b/include/i18nlangtag/mslangid.hxx @@ -25,6 +25,8 @@ #include <i18nlangtag/i18nlangtagdllapi.h> #include <i18nlangtag/lang.h> #include <com/sun/star/lang/Locale.hpp> + +#include <string_view> #include <vector> struct IsoLanguageCountryEntry; @@ -251,7 +253,7 @@ public: /** Used by convertUnxByteStringToLanguage(OString) */ I18NLANGTAG_DLLPRIVATE static LanguageType convertIsoNamesToLanguage( - const OString& rLang, const OString& rCountry ); + std::string_view rLang, std::string_view rCountry ); /** Used by lookupFallbackLocale(Locale) */ diff --git a/include/oox/dump/dumperbase.hxx b/include/oox/dump/dumperbase.hxx index 74aa1da81213..54bbb6f6af0f 100644 --- a/include/oox/dump/dumperbase.hxx +++ b/include/oox/dump/dumperbase.hxx @@ -25,6 +25,7 @@ #include <map> #include <memory> #include <set> +#include <string_view> #include <utility> #include <vector> @@ -329,7 +330,7 @@ public: static OUString trimSpaces( const OUString& rStr ); static OUString trimTrailingNul( const OUString& rStr ); - static OString convertToUtf8( const OUString& rStr ); + static OString convertToUtf8( std::u16string_view rStr ); static DataType convertToDataType( std::u16string_view rStr ); static FormatType convertToFormatType( std::u16string_view rStr ); diff --git a/include/oox/helper/attributelist.hxx b/include/oox/helper/attributelist.hxx index 4e3210bd3919..efb3de7779cf 100644 --- a/include/oox/helper/attributelist.hxx +++ b/include/oox/helper/attributelist.hxx @@ -20,6 +20,9 @@ #ifndef INCLUDED_OOX_HELPER_ATTRIBUTELIST_HXX #define INCLUDED_OOX_HELPER_ATTRIBUTELIST_HXX +#include <sal/config.h> + +#include <string_view> #include <vector> #include <com/sun/star/uno/Reference.hxx> @@ -50,7 +53,7 @@ class OOX_DLLPUBLIC AttributeConversion { public: /** Returns the XML token identifier from the passed string. */ - static sal_Int32 decodeToken( const OUString& rValue ); + static sal_Int32 decodeToken( std::u16string_view rValue ); /** Returns the decoded string value. All characters in the format '_xHHHH_' (H being a hexadecimal digit), will be decoded. */ diff --git a/include/oox/helper/binaryoutputstream.hxx b/include/oox/helper/binaryoutputstream.hxx index 571b23aa8c80..c1dc8ebb0e7e 100644 --- a/include/oox/helper/binaryoutputstream.hxx +++ b/include/oox/helper/binaryoutputstream.hxx @@ -83,7 +83,7 @@ public: void writeCompressedUnicodeArray( const OUString& rString, bool bCompressed ); - void writeCharArrayUC( const OUString& rString, rtl_TextEncoding eTextEnc ); + void writeCharArrayUC( std::u16string_view rString, rtl_TextEncoding eTextEnc ); void writeUnicodeArray( const OUString& rString ); diff --git a/include/oox/token/tokenmap.hxx b/include/oox/token/tokenmap.hxx index 1ab9a99758cc..60dbcee9f9b1 100644 --- a/include/oox/token/tokenmap.hxx +++ b/include/oox/token/tokenmap.hxx @@ -20,6 +20,9 @@ #ifndef INCLUDED_OOX_TOKEN_TOKENMAP_HXX #define INCLUDED_OOX_TOKEN_TOKENMAP_HXX +#include <sal/config.h> + +#include <string_view> #include <vector> #include <com/sun/star/uno/Sequence.hxx> @@ -40,7 +43,7 @@ public: ~TokenMap(); /** Returns the token identifier for the passed Unicode token name. */ - static sal_Int32 getTokenFromUnicode( const OUString& rUnicodeName ); + static sal_Int32 getTokenFromUnicode( std::u16string_view rUnicodeName ); /** Returns the UTF8 name of the passed token identifier as byte sequence. */ css::uno::Sequence< sal_Int8 > const & diff --git a/include/oox/vml/vmlformatting.hxx b/include/oox/vml/vmlformatting.hxx index 3ac34a8e5369..3d6cdc5ab87b 100644 --- a/include/oox/vml/vmlformatting.hxx +++ b/include/oox/vml/vmlformatting.hxx @@ -20,6 +20,9 @@ #ifndef INCLUDED_OOX_VML_VMLFORMATTING_HXX #define INCLUDED_OOX_VML_VMLFORMATTING_HXX +#include <sal/config.h> + +#include <string_view> #include <utility> #include <vector> @@ -59,7 +62,7 @@ namespace ConversionHelper /** Returns the boolean value from the passed string of a VML attribute. Supported values: 'f', 't', 'false', 'true'. False for anything else. */ - OOX_DLLPUBLIC bool decodeBool( const OUString& rValue ); + OOX_DLLPUBLIC bool decodeBool( std::u16string_view rValue ); /** Converts the passed VML percentage measure string to a normalized floating-point value. diff --git a/include/rtl/stringutils.hxx b/include/rtl/stringutils.hxx index 7a1bc606ff5b..5208c06c3d12 100644 --- a/include/rtl/stringutils.hxx +++ b/include/rtl/stringutils.hxx @@ -45,6 +45,7 @@ namespace rtl struct SAL_WARN_UNUSED OStringChar { constexpr OStringChar(char theC): c(theC) {} template<typename T> OStringChar(T &&) = delete; + constexpr operator std::string_view() const { return {&c, 1}; } char const c; }; diff --git a/include/rtl/ustring.hxx b/include/rtl/ustring.hxx index 48aca3243383..9f8d08c8f9a5 100644 --- a/include/rtl/ustring.hxx +++ b/include/rtl/ustring.hxx @@ -800,11 +800,19 @@ public: < 0 - if this string is less than the string argument > 0 - if this string is greater than the string argument */ +#if defined LIBO_INTERNAL_ONLY + sal_Int32 compareTo( std::u16string_view str ) const + { + return rtl_ustr_compare_WithLength( pData->buffer, pData->length, + str.data(), str.length() ); + } +#else sal_Int32 compareTo( const OUString & str ) const { return rtl_ustr_compare_WithLength( pData->buffer, pData->length, str.pData->buffer, str.pData->length ); } +#endif /** Compares two strings with a maximum count of characters. @@ -821,11 +829,19 @@ public: @since UDK 3.2.7 */ +#if defined LIBO_INTERNAL_ONLY + sal_Int32 compareTo( std::u16string_view str, sal_Int32 maxLength ) const + { + return rtl_ustr_shortenedCompare_WithLength( pData->buffer, pData->length, + str.data(), str.length(), maxLength ); + } +#else sal_Int32 compareTo( const OUString & str, sal_Int32 maxLength ) const { return rtl_ustr_shortenedCompare_WithLength( pData->buffer, pData->length, str.pData->buffer, str.pData->length, maxLength ); } +#endif /** Compares two strings in reverse order. @@ -3101,6 +3117,20 @@ public: * * @since LibreOffice 4.4 */ +#if defined LIBO_INTERNAL_ONLY + static OUString fromUtf8(std::string_view rSource) + { + OUString aTarget; + bool bSuccess = rtl_convertStringToUString(&aTarget.pData, + rSource.data(), + rSource.length(), + RTL_TEXTENCODING_UTF8, + RTL_TEXTTOUNICODE_FLAGS_UNDEFINED_ERROR|RTL_TEXTTOUNICODE_FLAGS_MBUNDEFINED_ERROR|RTL_TEXTTOUNICODE_FLAGS_INVALID_ERROR); + (void) bSuccess; + assert(bSuccess); + return aTarget; + } +#else static OUString fromUtf8(const OString& rSource) { OUString aTarget; @@ -3113,6 +3143,7 @@ public: assert(bSuccess); return aTarget; } +#endif /** * Convert this string to an OString, assuming that the string can be @@ -3519,12 +3550,21 @@ struct OUStringHash <http://udk.openoffice.org/cpp/man/spec/textconversion.html> for more details. */ +#if defined LIBO_INTERNAL_ONLY +inline OUString OStringToOUString( std::string_view rStr, + rtl_TextEncoding encoding, + sal_uInt32 convertFlags = OSTRING_TO_OUSTRING_CVTFLAGS ) +{ + return OUString( rStr.data(), rStr.length(), encoding, convertFlags ); +} +#else inline OUString OStringToOUString( const OString & rStr, rtl_TextEncoding encoding, sal_uInt32 convertFlags = OSTRING_TO_OUSTRING_CVTFLAGS ) { return OUString( rStr.getStr(), rStr.getLength(), encoding, convertFlags ); } +#endif /** Convert an OUString to an OString, using a specific text encoding. @@ -3543,12 +3583,21 @@ inline OUString OStringToOUString( const OString & rStr, <http://udk.openoffice.org/cpp/man/spec/textconversion.html> for more details. */ +#if defined LIBO_INTERNAL_ONLY +inline OString OUStringToOString( std::u16string_view rUnicode, + rtl_TextEncoding encoding, + sal_uInt32 convertFlags = OUSTRING_TO_OSTRING_CVTFLAGS ) +{ + return OString( rUnicode.data(), rUnicode.length(), encoding, convertFlags ); +} +#else inline OString OUStringToOString( const OUString & rUnicode, rtl_TextEncoding encoding, sal_uInt32 convertFlags = OUSTRING_TO_OSTRING_CVTFLAGS ) { return OString( rUnicode.getStr(), rUnicode.getLength(), encoding, convertFlags ); } +#endif /* ======================================================================= */ diff --git a/include/sax/fshelper.hxx b/include/sax/fshelper.hxx index f5d92eed1c50..7a540ef6fddf 100644 --- a/include/sax/fshelper.hxx +++ b/include/sax/fshelper.hxx @@ -27,6 +27,7 @@ #include <sax/saxdllapi.h> #include <optional> #include <memory> +#include <string_view> #include <utility> namespace com::sun::star::io { class XOutputStream; } @@ -132,13 +133,13 @@ public: FastSerializerHelper* write(const char* value); FastSerializerHelper* write(const OString& value); - FastSerializerHelper* write(const OUString& value); + FastSerializerHelper* write(std::u16string_view value); FastSerializerHelper* write(sal_Int32 value); FastSerializerHelper* write(sal_Int64 value); FastSerializerHelper* write(double value); FastSerializerHelper* writeEscaped(const char* value); - FastSerializerHelper* writeEscaped(const OUString& value); + FastSerializerHelper* writeEscaped(std::u16string_view value); FastSerializerHelper* writeId(sal_Int32 tokenId); diff --git a/include/sfx2/XmlIdRegistry.hxx b/include/sfx2/XmlIdRegistry.hxx index 7cae9df1e7ca..9e08bf4bba06 100644 --- a/include/sfx2/XmlIdRegistry.hxx +++ b/include/sfx2/XmlIdRegistry.hxx @@ -22,6 +22,8 @@ #include <sal/config.h> +#include <string_view> + #include <sfx2/dllapi.h> #include <rtl/ustring.hxx> @@ -37,10 +39,10 @@ namespace sfx2 { // XML ID utilities -------------------------------------------------- /** is i_rIdref a valid NCName ? */ -bool SFX2_DLLPUBLIC isValidNCName(OUString const & i_rIdref); +bool SFX2_DLLPUBLIC isValidNCName(std::u16string_view i_rIdref); bool SFX2_DLLPUBLIC isValidXmlId(OUString const & i_rStreamName, - OUString const & i_rIdref); + std::u16string_view i_rIdref); // XML ID handling --------------------------------------------------- diff --git a/include/sfx2/docfilt.hxx b/include/sfx2/docfilt.hxx index 80bb7734d970..a3b350deebe5 100644 --- a/include/sfx2/docfilt.hxx +++ b/include/sfx2/docfilt.hxx @@ -28,6 +28,7 @@ #include <tools/wldcrd.hxx> #include <memory> +#include <string_view> namespace com::sun::star::embed { class XStorage; } namespace com::sun::star::uno { template <typename > class Reference; } @@ -63,7 +64,7 @@ public: SfxFilter( const OUString& rProvider, const OUString& rFilterName ); SfxFilter( const OUString &rName, - const OUString &rWildCard, + std::u16string_view rWildCard, SfxFilterFlags nFormatType, SotClipboardFormatId lFormat, const OUString &rTypeName, diff --git a/include/sfx2/doctempl.hxx b/include/sfx2/doctempl.hxx index 4afe91438773..dbd527eb47b5 100644 --- a/include/sfx2/doctempl.hxx +++ b/include/sfx2/doctempl.hxx @@ -19,8 +19,11 @@ #ifndef INCLUDED_SFX2_DOCTEMPL_HXX #define INCLUDED_SFX2_DOCTEMPL_HXX -#include <rtl/ustring.hxx> #include <sal/config.h> + +#include <string_view> + +#include <rtl/ustring.hxx> #include <sal/types.h> #include <sfx2/dllapi.h> #include <tools/ref.hxx> @@ -94,7 +97,8 @@ public: bool CopyTo(sal_uInt16 nRegion, sal_uInt16 nIdx, const OUString &rName) const; bool CopyFrom(sal_uInt16 nRegion, sal_uInt16 nIdx, OUString &rName); - bool GetFull( std::u16string_view rRegion, const OUString& rName, OUString& rPath ); + bool GetFull( + std::u16string_view rRegion, std::u16string_view rName, OUString& rPath ); bool GetLogicNames( const OUString& rPath, OUString& rRegion, OUString& rName ) const; /** updates the configuration where the document templates structure is stored. diff --git a/include/sfx2/lokhelper.hxx b/include/sfx2/lokhelper.hxx index 252b2d6d6e9e..6cc9c277ef53 100644 --- a/include/sfx2/lokhelper.hxx +++ b/include/sfx2/lokhelper.hxx @@ -18,6 +18,7 @@ #include <cstddef> #include <rtl/string.hxx> #include <optional> +#include <string_view> struct SFX2_DLLPUBLIC LokMouseEventData { @@ -97,7 +98,7 @@ public: /// Emits a LOK_CALLBACK_WINDOW static void notifyWindow(const SfxViewShell* pThisView, vcl::LOKWindowId nWindowId, - const OUString& rAction, + std::u16string_view rAction, const std::vector<vcl::LOKPayloadItem>& rPayload = std::vector<vcl::LOKPayloadItem>()); /// Emits a LOK_CALLBACK_DOCUMENT_SIZE_CHANGED - if @bInvalidateAll - first invalidates all parts static void notifyDocumentSizeChanged(SfxViewShell const* pThisView, const OString& rPayload, vcl::ITiledRenderable* pDoc, bool bInvalidateAll = true); diff --git a/include/sfx2/templatedlg.hxx b/include/sfx2/templatedlg.hxx index e106680c74db..35bb0620978b 100644 --- a/include/sfx2/templatedlg.hxx +++ b/include/sfx2/templatedlg.hxx @@ -14,6 +14,7 @@ #include <sfx2/dllapi.h> #include <set> +#include <string_view> #include <vcl/idle.hxx> #include <vcl/timer.hxx> @@ -68,7 +69,7 @@ protected: DECL_LINK(TVItemStateHdl, const ThumbnailViewItem*, void); DECL_LINK(MenuSelectHdl, const OString&, void); - void DefaultTemplateMenuSelectHdl(const OString& rIdent); + void DefaultTemplateMenuSelectHdl(std::string_view rIdent); DECL_LINK(OpenRegionHdl, void*, void); DECL_LINK(CreateContextMenuHdl, ThumbnailViewItem*, void); diff --git a/include/svl/PasswordHelper.hxx b/include/svl/PasswordHelper.hxx index ef3dc2c21cbc..7bc97f3fcae6 100644 --- a/include/svl/PasswordHelper.hxx +++ b/include/svl/PasswordHelper.hxx @@ -20,6 +20,10 @@ #ifndef INCLUDED_SVL_PASSWORDHELPER_HXX #define INCLUDED_SVL_PASSWORDHELPER_HXX +#include <sal/config.h> + +#include <string_view> + #include <svl/svldllapi.h> #include <sal/types.h> #include <com/sun/star/uno/Sequence.hxx> @@ -33,8 +37,8 @@ public: SVL_DLLPUBLIC static void GetHashPassword(css::uno::Sequence <sal_Int8>& rPassHash, const char* pPass, sal_uInt32 nLen); SVL_DLLPUBLIC static void GetHashPassword(css::uno::Sequence<sal_Int8>& rPassHash, const OUString& sPass); - SVL_DLLPUBLIC static void GetHashPasswordSHA1UTF8(css::uno::Sequence<sal_Int8>& rPassHash, const OUString& sPass); - SVL_DLLPUBLIC static void GetHashPasswordSHA256(css::uno::Sequence<sal_Int8>& rPassHash, const OUString& sPass); + SVL_DLLPUBLIC static void GetHashPasswordSHA1UTF8(css::uno::Sequence<sal_Int8>& rPassHash, std::u16string_view sPass); + SVL_DLLPUBLIC static void GetHashPasswordSHA256(css::uno::Sequence<sal_Int8>& rPassHash, std::u16string_view sPass); /** Use this method to compare a given string with another given Hash value. This is necessary, because in older versions exists different hashes of the same string. They were endian dependent. diff --git a/include/svtools/HtmlWriter.hxx b/include/svtools/HtmlWriter.hxx index 58b0861e9fb4..d6e0294cafce 100644 --- a/include/svtools/HtmlWriter.hxx +++ b/include/svtools/HtmlWriter.hxx @@ -12,6 +12,7 @@ #include <rtl/string.hxx> #include <rtl/ustring.hxx> +#include <string_view> #include <vector> #include <svtools/svtdllapi.h> @@ -45,7 +46,7 @@ public: void attribute(const OString& aAttribute, const char* aValue); void attribute(const OString& aAttribute, sal_Int32 aValue); void attribute(const OString& aAttribute, const OString& aValue); - void attribute(const OString& aAttribute, const OUString& aValue); + void attribute(const OString& aAttribute, std::u16string_view aValue); // boolean attribute e.g. <img ismap> void attribute(const OString& aAttribute); diff --git a/include/svtools/ctrltool.hxx b/include/svtools/ctrltool.hxx index 0bd75f0aefe0..3b622dc6ef97 100644 --- a/include/svtools/ctrltool.hxx +++ b/include/svtools/ctrltool.hxx @@ -28,7 +28,7 @@ #include <vector> #include <memory> - +#include <string_view> class ImplFontListNameInfo; class OutputDevice; @@ -205,7 +205,7 @@ public: sal_Int32 Count() const { return mnElem; } bool IsEmpty() const { return !mnElem; } - sal_Int32 Name2Size( const OUString& ) const; + sal_Int32 Name2Size( std::u16string_view ) const; OUString Size2Name( sal_Int32 ) const; OUString GetIndexName( sal_Int32 nIndex ) const; diff --git a/include/svtools/htmlout.hxx b/include/svtools/htmlout.hxx index 760cc2b3c90b..a3b3c36bd217 100644 --- a/include/svtools/htmlout.hxx +++ b/include/svtools/htmlout.hxx @@ -19,6 +19,10 @@ #pragma once +#include <sal/config.h> + +#include <string_view> + #include <svtools/svtdllapi.h> #include <tools/solar.h> #include <rtl/textenc.h> @@ -76,7 +80,7 @@ struct HTMLOutFuncs SVT_DLLPUBLIC static SvStream& OutScript( SvStream& rStrm, const OUString& rBaseURL, - const OUString& rSource, + std::u16string_view rSource, const OUString& rLanguage, ScriptType eScriptType, const OUString& rSrc, diff --git a/include/svx/EnhancedCustomShapeFunctionParser.hxx b/include/svx/EnhancedCustomShapeFunctionParser.hxx index 150c39efc0c5..28d2491c77f8 100644 --- a/include/svx/EnhancedCustomShapeFunctionParser.hxx +++ b/include/svx/EnhancedCustomShapeFunctionParser.hxx @@ -25,6 +25,7 @@ #include <com/sun/star/drawing/EnhancedCustomShapeParameter.hpp> #include <memory> #include <ostream> +#include <string_view> #include <vector> #include <svx/svxdllapi.h> @@ -233,7 +234,7 @@ public: @return the generated function object. */ - UNLESS_MERGELIBS(SVXCORE_DLLPUBLIC) static std::shared_ptr<ExpressionNode> const & parseFunction( const OUString& rFunction, const EnhancedCustomShape2d& rCustoShape ); + UNLESS_MERGELIBS(SVXCORE_DLLPUBLIC) static std::shared_ptr<ExpressionNode> const & parseFunction( std::u16string_view rFunction, const EnhancedCustomShape2d& rCustoShape ); // this is a singleton FunctionParser() = delete; diff --git a/include/svx/fmsrcimp.hxx b/include/svx/fmsrcimp.hxx index 7f5eaa21ff0b..a9b311fe522a 100644 --- a/include/svx/fmsrcimp.hxx +++ b/include/svx/fmsrcimp.hxx @@ -33,6 +33,7 @@ #include <deque> #include <memory> +#include <string_view> #include <vector> namespace com::sun::star::awt { class XCheckBox; } @@ -324,7 +325,7 @@ private: // starting the loop), not in every loop step SVX_DLLPRIVATE SearchResult SearchSpecial(bool _bSearchForNull, sal_Int32& nFieldPos, FieldCollection::iterator& iterFieldLoop, const FieldCollection::iterator& iterBegin, const FieldCollection::iterator& iterEnd); - SVX_DLLPRIVATE SearchResult SearchWildcard(const OUString& strExpression, sal_Int32& nFieldPos, FieldCollection::iterator& iterFieldLoop, + SVX_DLLPRIVATE SearchResult SearchWildcard(std::u16string_view strExpression, sal_Int32& nFieldPos, FieldCollection::iterator& iterFieldLoop, const FieldCollection::iterator& iterBegin, const FieldCollection::iterator& iterEnd); SVX_DLLPRIVATE SearchResult SearchRegularApprox(const OUString& strExpression, sal_Int32& nFieldPos, FieldCollection::iterator& iterFieldLoop, const FieldCollection::iterator& iterBegin, const FieldCollection::iterator& iterEnd); diff --git a/include/svx/signaturelinehelper.hxx b/include/svx/signaturelinehelper.hxx index b31e4c2e8483..9a10a09a29ce 100644 --- a/include/svx/signaturelinehelper.hxx +++ b/include/svx/signaturelinehelper.hxx @@ -10,6 +10,10 @@ #ifndef INCLUDED_SVX_SIGNATURELINEHELPER_HXX #define INCLUDED_SVX_SIGNATURELINEHELPER_HXX +#include <sal/config.h> + +#include <string_view> + #include <rtl/ustring.hxx> #include <svx/svxdllapi.h> @@ -51,7 +55,7 @@ SVX_DLLPUBLIC OUString getLocalizedDate(); /** * Interprets rSVG as a graphic and gives back the resulting UNO wrapper. */ -SVX_DLLPUBLIC css::uno::Reference<css::graphic::XGraphic> importSVG(const OUString& rSVG); +SVX_DLLPUBLIC css::uno::Reference<css::graphic::XGraphic> importSVG(std::u16string_view rSVG); /** * Sets xCertificate as the signing certificate of the selected shape on pView. diff --git a/include/test/screenshot_test.hxx b/include/test/screenshot_test.hxx index 9acee7a5d656..2c0bbe25eb23 100644 --- a/include/test/screenshot_test.hxx +++ b/include/test/screenshot_test.hxx @@ -18,6 +18,7 @@ #include <vcl/vclptr.hxx> #include <vcl/weld.hxx> #include <map> +#include <string_view> class VclAbstractDialog; typedef std::map<OString, sal_uInt32> mapType; @@ -70,7 +71,7 @@ public: /// This should be used with care - no active layouting will be done, only the /// VclBuilder will be activated for layouting. Result can thus vary drastically /// compared to the active dialog (can be compared with dialog previewer) - void dumpDialogToPath(const OString& rUIXMLDescription); + void dumpDialogToPath(std::string_view rUIXMLDescription); /// helper to process all known dialogs void processAllKnownDialogs(); diff --git a/include/tools/XmlWriter.hxx b/include/tools/XmlWriter.hxx index 7efe3a57353a..a541f21f4e11 100644 --- a/include/tools/XmlWriter.hxx +++ b/include/tools/XmlWriter.hxx @@ -13,6 +13,7 @@ #include <tools/toolsdllapi.h> #include <rtl/ustring.hxx> #include <memory> +#include <string_view> #include <vector> class SvStream; @@ -48,14 +49,14 @@ public: void endElement(); void attribute(const OString& sTagName, const OString& aValue); - void attribute(const OString& sTagName, const OUString& aValue); + void attribute(const OString& sTagName, std::u16string_view aValue); void attribute(const OString& sTagName, sal_Int32 aNumber); void attributeDouble(const OString& sTagName, double aNumber); void attributeBase64(const OString& sTagName, std::vector<sal_uInt8> const& rValueInBytes); void attributeBase64(const OString& sTagName, std::vector<char> const& rValueInBytes); void content(const OString& sValue); - void content(const OUString& sValue); + void content(std::u16string_view sValue); void element(const OString& sName); }; diff --git a/include/tools/inetmsg.hxx b/include/tools/inetmsg.hxx index dd8073d61937..79c7aca936b4 100644 --- a/include/tools/inetmsg.hxx +++ b/include/tools/inetmsg.hxx @@ -25,6 +25,7 @@ #include <tools/inetmime.hxx> #include <tools/stream.hxx> +#include <string_view> #include <vector> #include <map> #include <memory> @@ -142,7 +143,7 @@ public: void SetDocumentLB (SvLockBytes *pDocLB) { m_xDocLB = pDocLB; } static bool ParseDateField ( - const OUString& rDateField, DateTime& rDateTime); + std::u16string_view rDateField, DateTime& rDateTime); void SetMIMEVersion (const OUString& rVersion); void SetContentDisposition (const OUString& rDisposition); diff --git a/include/tools/stream.hxx b/include/tools/stream.hxx index 42084e6566fc..7e79516d8407 100644 --- a/include/tools/stream.hxx +++ b/include/tools/stream.hxx @@ -27,6 +27,7 @@ #include <rtl/string.hxx> #include <o3tl/typed_flags_set.hxx> #include <memory> +#include <string_view> class StreamData; @@ -309,7 +310,7 @@ public: */ bool ReadByteStringLine( OUString& rStr, rtl_TextEncoding eSrcCharSet, sal_Int32 nMaxBytesToRead = 0xFFFE ); - bool WriteByteStringLine( const OUString& rStr, rtl_TextEncoding eDestCharSet ); + bool WriteByteStringLine( std::u16string_view rStr, rtl_TextEncoding eDestCharSet ); /// Switch to no endian swapping and write 0xfeff void StartWritingUnicodeText(); @@ -560,7 +561,7 @@ TOOLS_DLLPUBLIC std::size_t write_uInt16_lenPrefixed_uInt8s_FromOString(SvStream /// of 8bit units from an OUString, returned value is number of bytes written /// (including byte-count of prefix) inline std::size_t write_uInt16_lenPrefixed_uInt8s_FromOUString(SvStream& rStrm, - const OUString &rStr, + std::u16string_view rStr, rtl_TextEncoding eEnc) { return write_uInt16_lenPrefixed_uInt8s_FromOString(rStrm, OUStringToOString(rStr, eEnc)); diff --git a/include/tools/wldcrd.hxx b/include/tools/wldcrd.hxx index 5fc3d87e4ab5..fd127a30a1af 100644 --- a/include/tools/wldcrd.hxx +++ b/include/tools/wldcrd.hxx @@ -19,6 +19,10 @@ #ifndef INCLUDED_TOOLS_WLDCRD_HXX #define INCLUDED_TOOLS_WLDCRD_HXX +#include <sal/config.h> + +#include <string_view> + #include <tools/toolsdllapi.h> #include <osl/thread.h> #include <rtl/ustring.hxx> @@ -38,7 +42,7 @@ public: { } - WildCard(const OUString& rWildCard, const char cSeparator = '\0') + WildCard(std::u16string_view rWildCard, const char cSeparator = '\0') : aWildString(OUStringToOString(rWildCard, osl_getThreadTextEncoding())) , cSepSymbol(cSeparator) { @@ -49,12 +53,12 @@ public: return OStringToOUString(aWildString, osl_getThreadTextEncoding()); } - void setGlob(const OUString& rString) + void setGlob(std::u16string_view rString) { aWildString = OUStringToOString(rString, osl_getThreadTextEncoding()); } - bool Matches( const OUString& rStr ) const; + bool Matches( std::u16string_view rStr ) const; }; #endif diff --git a/include/unotools/localedatawrapper.hxx b/include/unotools/localedatawrapper.hxx index b4e93749142d..70c62ad3073b 100644 --- a/include/unotools/localedatawrapper.hxx +++ b/include/unotools/localedatawrapper.hxx @@ -395,7 +395,7 @@ public: /** Output a message during locale data checking. The (UTF-8) string is written to stderr and in a non-product build or if DBG_UTIL is enabled also raised as an assertion message box. */ - static void outputCheckMessage( const OUString& rMsg ); + static void outputCheckMessage( std::u16string_view rMsg ); static void outputCheckMessage( const char* pStr); LocaleDataWrapper(const LocaleDataWrapper&) = delete; diff --git a/include/vcl/toolkit/dialog.hxx b/include/vcl/toolkit/dialog.hxx index efd2d2f0f6c0..922bb8e46164 100644 --- a/include/vcl/toolkit/dialog.hxx +++ b/include/vcl/toolkit/dialog.hxx @@ -25,6 +25,8 @@ #endif #include <memory> +#include <string_view> + #include <vcl/dllapi.h> #include <vcl/syswin.hxx> #include <vcl/vclptr.hxx> @@ -85,7 +87,7 @@ public: protected: explicit Dialog( WindowType nType ); - explicit Dialog( vcl::Window* pParent, const OUString& rID, const OUString& rUIXMLDescription); + explicit Dialog( vcl::Window* pParent, std::u16string_view rID, const OUString& rUIXMLDescription); virtual void Draw( OutputDevice* pDev, const Point& rPos, DrawFlags nFlags ) override; virtual void settingOptimalLayoutSize(Window *pBox) override; diff --git a/include/vcl/uitest/logger.hxx b/include/vcl/uitest/logger.hxx index 927c9cbf38ef..8a929cf578b3 100644 --- a/include/vcl/uitest/logger.hxx +++ b/include/vcl/uitest/logger.hxx @@ -10,6 +10,10 @@ #ifndef INCLUDED_VCL_UITEST_LOGGER_HXX #define INCLUDED_VCL_UITEST_LOGGER_HXX +#include <sal/config.h> + +#include <string_view> + #include <vcl/dllapi.h> #include <tools/stream.hxx> @@ -46,7 +50,7 @@ public: void logAction(vcl::Window* const& xUIWin, VclEventId nEvent); - void log(const OUString& rString); + void log(std::u16string_view rString); void logKeyInput(VclPtr<vcl::Window> const& xUIElement, const KeyEvent& rEvent); diff --git a/jvmfwk/inc/fwkbase.hxx b/jvmfwk/inc/fwkbase.hxx index be14511a4a4b..1c6ad983f47c 100644 --- a/jvmfwk/inc/fwkbase.hxx +++ b/jvmfwk/inc/fwkbase.hxx @@ -22,6 +22,7 @@ #include <sal/config.h> #include <optional> +#include <string_view> #include <vector> #include <rtl/ustring.hxx> @@ -39,7 +40,7 @@ class VendorSettings public: VendorSettings(); - std::optional<VersionInfo> getVersionInformation(const OUString& sVendor) const; + std::optional<VersionInfo> getVersionInformation(std::u16string_view sVendor) const; }; /* The class offers functions to retrieve verified bootstrap parameters. diff --git a/jvmfwk/inc/libxmlutil.hxx b/jvmfwk/inc/libxmlutil.hxx index 75cd022acd3d..2599cff50596 100644 --- a/jvmfwk/inc/libxmlutil.hxx +++ b/jvmfwk/inc/libxmlutil.hxx @@ -19,6 +19,10 @@ #ifndef INCLUDED_JVMFWK_INC_LIBXMLUTIL_HXX #define INCLUDED_JVMFWK_INC_LIBXMLUTIL_HXX +#include <sal/config.h> + +#include <string_view> + #include <libxml/parser.h> #include <libxml/xpath.h> #include <rtl/ustring.hxx> @@ -84,7 +88,7 @@ class CXmlCharPtr public: CXmlCharPtr(); CXmlCharPtr(xmlChar* aDoc); - explicit CXmlCharPtr(const OUString&); + explicit CXmlCharPtr(std::u16string_view); ~CXmlCharPtr(); CXmlCharPtr& operator=(xmlChar* pObj); operator xmlChar*() const { return _object; } diff --git a/jvmfwk/plugins/sunmajor/pluginlib/sunjavaplugin.cxx b/jvmfwk/plugins/sunmajor/pluginlib/sunjavaplugin.cxx index 35d2cd2a55a8..ee8bcbc155db 100644 --- a/jvmfwk/plugins/sunmajor/pluginlib/sunjavaplugin.cxx +++ b/jvmfwk/plugins/sunmajor/pluginlib/sunjavaplugin.cxx @@ -99,7 +99,7 @@ struct PluginMutex: public ::rtl::Static<osl::Mutex, PluginMutex> {}; OString getPluginJarPath( std::u16string_view sVendor, const OUString& sLocation, - const OUString& sVersion) + std::u16string_view sVersion) { OString ret; OUString sName1("javaplugin.jar"); diff --git a/jvmfwk/plugins/sunmajor/pluginlib/sunversion.cxx b/jvmfwk/plugins/sunmajor/pluginlib/sunversion.cxx index 2d972f1cc5ef..ded1fc5f45f5 100644 --- a/jvmfwk/plugins/sunmajor/pluginlib/sunversion.cxx +++ b/jvmfwk/plugins/sunmajor/pluginlib/sunversion.cxx @@ -37,7 +37,7 @@ public: } test; #endif -SunVersion::SunVersion(const OUString &usVer): +SunVersion::SunVersion(std::u16string_view usVer): m_nUpdateSpecial(0), m_preRelease(Rel_NONE) { OString sVersion= OUStringToOString(usVer, osl_getThreadTextEncoding()); diff --git a/jvmfwk/plugins/sunmajor/pluginlib/sunversion.hxx b/jvmfwk/plugins/sunmajor/pluginlib/sunversion.hxx index 3c181ed3b7be..0f351dfb0591 100644 --- a/jvmfwk/plugins/sunmajor/pluginlib/sunversion.hxx +++ b/jvmfwk/plugins/sunmajor/pluginlib/sunversion.hxx @@ -20,6 +20,10 @@ #ifndef INCLUDED_JVMFWK_PLUGINS_SUNMAJOR_PLUGINLIB_SUNVERSION_HXX #define INCLUDED_JVMFWK_PLUGINS_SUNMAJOR_PLUGINLIB_SUNVERSION_HXX +#include <sal/config.h> + +#include <string_view> + #include <rtl/ustring.hxx> namespace jfw_plugin @@ -83,7 +87,7 @@ class SunVersion final public: explicit SunVersion(const char* szVer); - explicit SunVersion(const OUString& usVer); + explicit SunVersion(std::u16string_view usVer); ~SunVersion(); /** diff --git a/jvmfwk/source/fwkbase.cxx b/jvmfwk/source/fwkbase.cxx index df84d7c77f9e..501595c6e857 100644 --- a/jvmfwk/source/fwkbase.cxx +++ b/jvmfwk/source/fwkbase.cxx @@ -113,9 +113,9 @@ VendorSettings::VendorSettings() "[Java framework] Error in constructor VendorSettings::VendorSettings() (fwkbase.cxx)"); } -std::optional<VersionInfo> VendorSettings::getVersionInformation(const OUString & sVendor) const +std::optional<VersionInfo> VendorSettings::getVersionInformation(std::u16string_view sVendor) const { - OSL_ASSERT(!sVendor.isEmpty()); + OSL_ASSERT(!sVendor.empty()); OString osVendor = OUStringToOString(sVendor, RTL_TEXTENCODING_UTF8); CXPathObjectPtr pathObject = xmlXPathEvalExpression( reinterpret_cast<xmlChar const *>( diff --git a/jvmfwk/source/libxmlutil.cxx b/jvmfwk/source/libxmlutil.cxx index 2619e43331c4..f83e14143ef4 100644 --- a/jvmfwk/source/libxmlutil.cxx +++ b/jvmfwk/source/libxmlutil.cxx @@ -94,7 +94,7 @@ CXmlCharPtr::CXmlCharPtr(xmlChar * aChar) { } -CXmlCharPtr::CXmlCharPtr(const OUString & s): +CXmlCharPtr::CXmlCharPtr(std::u16string_view s): _object(nullptr) { OString o = OUStringToOString(s, RTL_TEXTENCODING_UTF8); diff --git a/l10ntools/source/localize.cxx b/l10ntools/source/localize.cxx index 17ad73f3b2a4..1aa3bab4b6d8 100644 --- a/l10ntools/source/localize.cxx +++ b/l10ntools/source/localize.cxx @@ -125,7 +125,7 @@ void InitPoFile( { OUString outDir = OStringToOUString( - rPotDir.copy(0,rPotDir.lastIndexOf('/')), RTL_TEXTENCODING_UTF8); + rPotDir.subView(0,rPotDir.lastIndexOf('/')), RTL_TEXTENCODING_UTF8); OUString outDirUrl; if (osl::FileBase::getFileURLFromSystemPath(outDir, outDirUrl) != osl::FileBase::E_None) @@ -406,7 +406,7 @@ void handleDirectory( //Remove empty pot directory OUString sPoPath = OStringToOUString( - aPotDir.copy(0,aPotDir.lastIndexOf('/')), RTL_TEXTENCODING_UTF8); + aPotDir.subView(0,aPotDir.lastIndexOf('/')), RTL_TEXTENCODING_UTF8); OUString sPoUrl; if (osl::FileBase::getFileURLFromSystemPath(sPoPath, sPoUrl) != osl::FileBase::E_None) diff --git a/l10ntools/source/merge.cxx b/l10ntools/source/merge.cxx index 694e48f23f4f..22beb6f1b962 100644 --- a/l10ntools/source/merge.cxx +++ b/l10ntools/source/merge.cxx @@ -94,7 +94,7 @@ namespace { //DOUBLE VERTICAL LINE instead of || because the translations make their //way into action_names under gtk3 where || is illegal - return OUStringToOString(OUString(u'\x2016'), RTL_TEXTENCODING_UTF8); + return OUStringToOString(u"\x2016", RTL_TEXTENCODING_UTF8); } } diff --git a/l10ntools/source/propmerge.cxx b/l10ntools/source/propmerge.cxx index 42945aee316d..3922d172398e 100644 --- a/l10ntools/source/propmerge.cxx +++ b/l10ntools/source/propmerge.cxx @@ -13,6 +13,7 @@ #include <iostream> #include <fstream> #include <iomanip> +#include <string_view> #include <export.hxx> #include <common.hxx> @@ -59,7 +60,7 @@ namespace } //Escape unicode characters - void lcl_PrintJavaStyle( const OString& rText, std::ofstream &rOfstream ) + void lcl_PrintJavaStyle( std::string_view rText, std::ofstream &rOfstream ) { const OUString sTemp = OStringToOUString( rText, RTL_TEXTENCODING_UTF8 ); diff --git a/l10ntools/source/xmlparse.cxx b/l10ntools/source/xmlparse.cxx index 54b9c6bf4d8e..4bd58b1a49f6 100644 --- a/l10ntools/source/xmlparse.cxx +++ b/l10ntools/source/xmlparse.cxx @@ -22,6 +22,7 @@ #include <cassert> #include <stdio.h> +#include <string_view> #include <helper.hxx> #include <common.hxx> @@ -741,7 +742,7 @@ void XMLElement::Print(XMLNode *pCur, OStringBuffer& rBuffer, bool bRootelement namespace { -OUString lcl_pathnameToAbsoluteUrl(const OString& rPathname) +OUString lcl_pathnameToAbsoluteUrl(std::string_view rPathname) { OUString sPath = OStringToOUString(rPathname, RTL_TEXTENCODING_UTF8 ); OUString sUrl; @@ -1112,7 +1113,7 @@ OString XMLUtil::QuotHTML( const OString &rString ) sReturn.append('\0'); return OUStringToOString( - OUString(reinterpret_cast<const sal_Unicode*>(sReturn.getBuffer())), + reinterpret_cast<const sal_Unicode*>(sReturn.getBuffer()), RTL_TEXTENCODING_UTF8); } diff --git a/lingucomponent/source/languageguessing/guesslang.cxx b/lingucomponent/source/languageguessing/guesslang.cxx index 560f883e1c55..f04e0b3956d5 100644 --- a/lingucomponent/source/languageguessing/guesslang.cxx +++ b/lingucomponent/source/languageguessing/guesslang.cxx @@ -18,6 +18,7 @@ */ #include <iostream> +#include <string_view> #include <osl/file.hxx> #include <tools/debug.hxx> @@ -91,7 +92,7 @@ public: // implementation specific /// @throws RuntimeException - void SetFingerPrintsDB( const OUString &fileName ); + void SetFingerPrintsDB( std::u16string_view fileName ); }; } @@ -165,7 +166,7 @@ Locale SAL_CALL LangGuess_Impl::guessPrimaryLanguage( if (nStartPos < 0 || nLen < 0 || nStartPos + nLen > rText.getLength()) throw lang::IllegalArgumentException(); - OString o( OUStringToOString( rText.copy(nStartPos, nLen), RTL_TEXTENCODING_UTF8 ) ); + OString o( OUStringToOString( rText.subView(nStartPos, nLen), RTL_TEXTENCODING_UTF8 ) ); Guess g = m_aGuesser.GuessPrimaryLanguage(o.getStr()); lang::Locale aRes; aRes.Language = OUString::createFromAscii( g.GetLanguage().c_str() ); @@ -176,7 +177,7 @@ Locale SAL_CALL LangGuess_Impl::guessPrimaryLanguage( #define DEFAULT_CONF_FILE_NAME "fpdb.conf" void LangGuess_Impl::SetFingerPrintsDB( - const OUString &filePath ) + std::u16string_view filePath ) { //! text encoding for file name / path needs to be in the same encoding the OS uses OString path = OUStringToOString( filePath, osl_getThreadTextEncoding() ); diff --git a/linguistic/source/dicimp.cxx b/linguistic/source/dicimp.cxx index 202f79548d96..f2f0a3513b96 100644 --- a/linguistic/source/dicimp.cxx +++ b/linguistic/source/dicimp.cxx @@ -450,7 +450,7 @@ ErrCode DictionaryNeo::saveEntries(const OUString &rURL) pStream->WriteLine("type: negative"); if (aDicName.endsWith(EXTENSION_FOR_TITLE_TEXT)) { - pStream->WriteLine(OUStringToOString(OUString::Concat("title: ") + + pStream->WriteLine("title: " + OUStringToOString( // strip EXTENSION_FOR_TITLE_TEXT aDicName.subView(0, aDicName.lastIndexOf(EXTENSION_FOR_TITLE_TEXT)), eEnc)); } diff --git a/oox/source/core/xmlfilterbase.cxx b/oox/source/core/xmlfilterbase.cxx index 566e1c4a2909..42bf01bece56 100644 --- a/oox/source/core/xmlfilterbase.cxx +++ b/oox/source/core/xmlfilterbase.cxx @@ -20,6 +20,8 @@ #include <oox/core/xmlfilterbase.hxx> #include <cstdio> +#include <string_view> + #include <com/sun/star/beans/XPropertyAccess.hpp> #include <com/sun/star/beans/XPropertySet.hpp> #include <com/sun/star/beans/Pair.hpp> @@ -554,7 +556,7 @@ OUString XmlFilterBase::addRelation( const Reference< XOutputStream >& rOutputSt } static void -writeElement( const FSHelperPtr& pDoc, sal_Int32 nXmlElement, const OUString& sValue ) +writeElement( const FSHelperPtr& pDoc, sal_Int32 nXmlElement, std::u16string_view sValue ) { pDoc->startElement(nXmlElement); pDoc->writeEscaped( sValue ); @@ -761,7 +763,7 @@ writeAppProperties( XmlFilterBase& rSelf, const Reference< XDocumentProperties > // * 14: [Office 2010] // * 15: [Office 2013/2016/2019] [LO >= 7.0] // The LibreOffice is application on 2013/2016/2019 level - writeElement( pAppProps, XML_AppVersion, "15.0000" ); + writeElement( pAppProps, XML_AppVersion, u"15.0000" ); // OOXTODO Calculate DocSecurity value based on security (password, read-only etc.) it = aUserDefinedProperties.find("DocSecurity"); diff --git a/oox/source/docprop/docprophandler.cxx b/oox/source/docprop/docprophandler.cxx index 07f9b4c0dc72..ebcb87c3cdde 100644 --- a/oox/source/docprop/docprophandler.cxx +++ b/oox/source/docprop/docprophandler.cxx @@ -189,9 +189,9 @@ util::DateTime OOXMLDocPropHandler::GetDateTimeFromW3CDTF( const OUString& aChar aOslDTime.Day, aOslDTime.Month, aOslDTime.Year, false); } -uno::Sequence< OUString > OOXMLDocPropHandler::GetKeywordsSet( const OUString& aChars ) +uno::Sequence< OUString > OOXMLDocPropHandler::GetKeywordsSet( std::u16string_view aChars ) { - if ( !aChars.isEmpty() ) + if ( !aChars.empty() ) { std::string aUtf8Chars = OUStringToOString( aChars, RTL_TEXTENCODING_UTF8 ).getStr(); std::vector<std::string> aUtf8Result; diff --git a/oox/source/docprop/docprophandler.hxx b/oox/source/docprop/docprophandler.hxx index e9b86e3df4fd..c7e902634543 100644 --- a/oox/source/docprop/docprophandler.hxx +++ b/oox/source/docprop/docprophandler.hxx @@ -59,7 +59,7 @@ public: void AddCustomProperty( const css::uno::Any& aAny ); static css::util::DateTime GetDateTimeFromW3CDTF( const OUString& aChars ); - static css::uno::Sequence< OUString > GetKeywordsSet( const OUString& aChars ); + static css::uno::Sequence< OUString > GetKeywordsSet( std::u16string_view aChars ); void UpdateDocStatistic( const OUString& aChars ); // com.sun.star.xml.sax.XFastDocumentHandler diff --git a/oox/source/drawingml/customshapepresetdata.cxx b/oox/source/drawingml/customshapepresetdata.cxx index 51d5479473da..a80ddeacae21 100644 --- a/oox/source/drawingml/customshapepresetdata.cxx +++ b/oox/source/drawingml/customshapepresetdata.cxx @@ -434,8 +434,8 @@ void lcl_parseEquations(std::vector<OUString>& rEquations, const OString& rValue else if (rValue[i] == '"' && bInString) { bInString = false; - rEquations.push_back( - OUString::fromUtf8(rValue.copy(nStart + strlen("\""), i - nStart - strlen("\"")))); + rEquations.push_back(OUString::fromUtf8( + rValue.subView(nStart + strlen("\""), i - nStart - strlen("\"")))); } } } @@ -763,8 +763,8 @@ void CustomShapeProperties::initializePresetDataMap() else maPresetDataMap[TokenMap::getTokenFromUnicode(aName)] = aPropertyMap; aName = OUString::fromUtf8( - aLine.copy(strlen(aCommentPrefix), - aLine.getLength() - strlen(aCommentPrefix) - strlen(" */"))); + aLine.subView(strlen(aCommentPrefix), + aLine.getLength() - strlen(aCommentPrefix) - strlen(" */"))); } else { diff --git a/oox/source/dump/dumperbase.cxx b/oox/source/dump/dumperbase.cxx index df18516a0aef..9c36b7ed1d02 100644 --- a/oox/source/dump/dumperbase.cxx +++ b/oox/source/dump/dumperbase.cxx @@ -617,7 +617,7 @@ OUString StringHelper::trimTrailingNul( const OUString& rStr ) return rStr; } -OString StringHelper::convertToUtf8( const OUString& rStr ) +OString StringHelper::convertToUtf8( std::u16string_view rStr ) { return OUStringToOString( rStr, RTL_TEXTENCODING_UTF8 ); } @@ -2153,7 +2153,7 @@ OUString InputObjectBase::dumpCharArray( const String& rName, sal_Int32 nLen, rt ::std::vector< char > aBuffer( static_cast< std::size_t >( nLen ) + 1 ); sal_Int32 nCharsRead = mxStrm->readMemory(aBuffer.data(), nLen); aBuffer[ nCharsRead ] = 0; - aString = OStringToOUString(OString(aBuffer.data()), eTextEnc); + aString = OStringToOUString(std::string_view(aBuffer.data()), eTextEnc); } if( bHideTrailingNul ) aString = StringHelper::trimTrailingNul( aString ); diff --git a/oox/source/helper/attributelist.cxx b/oox/source/helper/attributelist.cxx index afc6ebc483c7..6ac3ea872eb4 100644 --- a/oox/source/helper/attributelist.cxx +++ b/oox/source/helper/attributelist.cxx @@ -86,7 +86,7 @@ sal_Int32 getHighlightColorTokenFromString(std::u16string_view sColorName) return XML_TOKEN_INVALID; } -sal_Int32 AttributeConversion::decodeToken( const OUString& rValue ) +sal_Int32 AttributeConversion::decodeToken( std::u16string_view rValue ) { return TokenMap::getTokenFromUnicode( rValue ); } diff --git a/oox/source/helper/binaryoutputstream.cxx b/oox/source/helper/binaryoutputstream.cxx index bac274af1857..50ce7f11ce9e 100644 --- a/oox/source/helper/binaryoutputstream.cxx +++ b/oox/source/helper/binaryoutputstream.cxx @@ -99,7 +99,7 @@ void BinaryXOutputStream::writeMemory( const void* pMem, sal_Int32 nBytes, size_ } void -BinaryOutputStream::writeCharArrayUC( const OUString& rString, rtl_TextEncoding eTextEnc ) +BinaryOutputStream::writeCharArrayUC( std::u16string_view rString, rtl_TextEncoding eTextEnc ) { OString sBuf( OUStringToOString( rString, eTextEnc ) ); sBuf = sBuf.replace( '\0', '?' ); diff --git a/oox/source/ole/vbaexport.cxx b/oox/source/ole/vbaexport.cxx index b699da60697a..9b77a84bea70 100644 --- a/oox/source/ole/vbaexport.cxx +++ b/oox/source/ole/vbaexport.cxx @@ -11,6 +11,7 @@ #include <cassert> #include <random> +#include <string_view> #include <oox/ole/vbaexport.hxx> @@ -53,7 +54,7 @@ namespace { -void exportString(SvStream& rStrm, const OUString& rString) +void exportString(SvStream& rStrm, std::u16string_view rString) { OString aStringCorrectCodepage = OUStringToOString(rString, CODEPAGE); rStrm.WriteOString(aStringCorrectCodepage); @@ -778,20 +779,20 @@ void exportModuleStream(SvStream& rStrm, const OUString& rSourceCode, const OUSt { SvMemoryStream aModuleStream(4096, 4096); - exportString(aModuleStream, "Attribute VB_Name = \"" + aElementName + "\"\r\n"); + exportString(aModuleStream, OUString("Attribute VB_Name = \"" + aElementName + "\"\r\n")); if (rInfo.ModuleType == 4) { if (isWorkbook(rInfo.ModuleObject)) - exportString(aModuleStream, "Attribute VB_Base = \"0{00020819-0000-0000-C000-000000000046}\"\r\n"); + exportString(aModuleStream, u"Attribute VB_Base = \"0{00020819-0000-0000-C000-000000000046}\"\r\n"); else - exportString(aModuleStream, "Attribute VB_Base = \"0{00020820-0000-0000-C000-000000000046}\"\r\n"); - - exportString(aModuleStream, "Attribute VB_GlobalNameSpace = False\r\n"); - exportString(aModuleStream, "Attribute VB_Creatable = False\r\n"); - exportString(aModuleStream, "Attribute VB_PredeclaredId = True\r\n"); - exportString(aModuleStream, "Attribute VB_Exposed = True\r\n"); - exportString(aModuleStream, "Attribute VB_TemplateDerived = False\r\n"); - exportString(aModuleStream, "Attribute VB_Customizable = True\r\n"); + exportString(aModuleStream, u"Attribute VB_Base = \"0{00020820-0000-0000-C000-000000000046}\"\r\n"); + + exportString(aModuleStream, u"Attribute VB_GlobalNameSpace = False\r\n"); + exportString(aModuleStream, u"Attribute VB_Creatable = False\r\n"); + exportString(aModuleStream, u"Attribute VB_PredeclaredId = True\r\n"); + exportString(aModuleStream, u"Attribute VB_Exposed = True\r\n"); + exportString(aModuleStream, u"Attribute VB_TemplateDerived = False\r\n"); + exportString(aModuleStream, u"Attribute VB_Customizable = True\r\n"); } OUString aSourceCode = rSourceCode.replaceFirst("Option VBASupport 1\n", ""); const sal_Int32 nPos = aSourceCode.indexOf("Rem Attribute VBA_ModuleType="); @@ -833,11 +834,11 @@ void exportPROJECTStream(SvStream& rStrm, const css::uno::Reference<css::contain // section 2.3.1.1ProjectProperties // section 2.3.1.2 ProjectId - exportString(rStrm, "ID=\""); + exportString(rStrm, u"ID=\""); OUString aProjectID = OStringToOUString(comphelper::xml::generateGUIDString(), RTL_TEXTENCODING_UTF8); exportString(rStrm, aProjectID); - exportString(rStrm, "\"\r\n"); + exportString(rStrm, u"\"\r\n"); // section 2.3.1.3 ProjectModule for (sal_Int32 i = 0; i < n; ++i) @@ -846,81 +847,81 @@ void exportPROJECTStream(SvStream& rStrm, const css::uno::Reference<css::contain css::script::ModuleInfo aModuleInfo = xModuleInfo->getModuleInfo(rModuleName); if(aModuleInfo.ModuleType == 1) { - exportString(rStrm, "Module=" + rModuleName + "\r\n"); + exportString(rStrm, OUString("Module=" + rModuleName + "\r\n")); } else if(aModuleInfo.ModuleType == 4) { - exportString(rStrm, "Document=" + rModuleName + "/&H00000000\r\n"); + exportString(rStrm, OUString("Document=" + rModuleName + "/&H00000000\r\n")); } } // section 2.3.1.11 ProjectName - exportString(rStrm, "Name=\"" + projectName + "\"\r\n"); + exportString(rStrm, OUString("Name=\"" + projectName + "\"\r\n")); // section 2.3.1.12 ProjectHelpId - exportString(rStrm, "HelpContextID=\"0\"\r\n"); + exportString(rStrm, u"HelpContextID=\"0\"\r\n"); // section 2.3.1.14 ProjectVersionCompat32 - exportString(rStrm, "VersionCompatible32=\"393222000\"\r\n"); + exportString(rStrm, u"VersionCompatible32=\"393222000\"\r\n"); // section 2.3.1.15 ProjectProtectionState #if VBA_ENCRYPTION - exportString(rStrm, "CMG=\""); + exportString(rStrm, u"CMG=\""); SvMemoryStream aProtectedStream(4096, 4096); aProtectedStream.WriteUInt32(0x00000000); const sal_uInt8* pData = static_cast<const sal_uInt8*>(aProtectedStream.GetData()); sal_uInt8 nProjKey = VBAEncryption::calculateProjKey(aProjectID); VBAEncryption aProtectionState(pData, 4, rStrm, nProjKey); aProtectionState.write(); - exportString(rStrm, "\"\r\n"); + exportString(rStrm, u"\"\r\n"); #else exportString(rStrm, "CMG=\"BEBC9256EEAAA8AEA8AEA8AEA8AE\"\r\n"); #endif // section 2.3.1.16 ProjectPassword #if VBA_ENCRYPTION - exportString(rStrm, "DPB=\""); + exportString(rStrm, u"DPB=\""); aProtectedStream.Seek(0); aProtectedStream.WriteUInt8(0x00); pData = static_cast<const sal_uInt8*>(aProtectedStream.GetData()); VBAEncryption aProjectPassword(pData, 1, rStrm, nProjKey); aProjectPassword.write(); - exportString(rStrm, "\"\r\n"); + exportString(rStrm, u"\"\r\n"); #else exportString(rStrm, "DPB=\"7C7E5014B0D3B1D3B1D3\"\r\n"); #endif // section 2.3.1.17 ProjectVisibilityState #if VBA_ENCRYPTION - exportString(rStrm, "GC=\""); + exportString(rStrm, u"GC=\""); aProtectedStream.Seek(0); aProtectedStream.WriteUInt8(0xFF); pData = static_cast<const sal_uInt8*>(aProtectedStream.GetData()); VBAEncryption aVisibilityState(pData, 1, rStrm, nProjKey); aVisibilityState.write(); - exportString(rStrm, "\"\r\n\r\n"); + exportString(rStrm, u"\"\r\n\r\n"); #else exportString(rStrm, "GC=\"3A3816DAD5DBD5DB2A\"\r\n\r\n"); #endif // section 2.3.1.18 HostExtenders - exportString(rStrm, "[Host Extender Info]\r\n" + exportString(rStrm, u"[Host Extender Info]\r\n" "&H00000001={3832D640-CF90-11CF-8E43-00A0C911005A};VBE;&H00000000\r\n\r\n" ); // section 2.3.1.19 ProjectWorkspace - exportString(rStrm, "[Workspace]\r\n"); + exportString(rStrm, u"[Workspace]\r\n"); for (sal_Int32 i = 0; i < n; ++i) { const OUString& rModuleName = aElementNames[rLibraryMap[i]]; css::script::ModuleInfo aModuleInfo = xModuleInfo->getModuleInfo(rModuleName); if(aModuleInfo.ModuleType == 1) { - exportString(rStrm, rModuleName + "=25, 25, 1439, 639, \r\n"); + exportString(rStrm, OUString(rModuleName + "=25, 25, 1439, 639, \r\n")); } else { - exportString(rStrm, rModuleName + "=0, 0, 0, 0, C\r\n"); + exportString(rStrm, OUString(rModuleName + "=0, 0, 0, 0, C\r\n")); } } } diff --git a/oox/source/token/tokenmap.cxx b/oox/source/token/tokenmap.cxx index 9318971226e7..7cbba35009ae 100644 --- a/oox/source/token/tokenmap.cxx +++ b/oox/source/token/tokenmap.cxx @@ -74,7 +74,7 @@ TokenMap::~TokenMap() { } -sal_Int32 TokenMap::getTokenFromUnicode( const OUString& rUnicodeName ) +sal_Int32 TokenMap::getTokenFromUnicode( std::u16string_view rUnicodeName ) { OString aUtf8Name = OUStringToOString( rUnicodeName, RTL_TEXTENCODING_UTF8 ); const struct xmltoken* pToken = Perfect_Hash::in_word_set( aUtf8Name.getStr(), aUtf8Name.getLength() ); diff --git a/oox/source/vml/vmlformatting.cxx b/oox/source/vml/vmlformatting.cxx index d89914e8c3be..62da5dedf10f 100644 --- a/oox/source/vml/vmlformatting.cxx +++ b/oox/source/vml/vmlformatting.cxx @@ -88,7 +88,7 @@ bool ConversionHelper::separatePair( OUString& orValue1, OUString& orValue2, return !orValue1.isEmpty() && !orValue2.isEmpty(); } -bool ConversionHelper::decodeBool( const OUString& rValue ) +bool ConversionHelper::decodeBool( std::u16string_view rValue ) { sal_Int32 nToken = AttributeConversion::decodeToken( rValue ); // anything else than 't' or 'true' is considered to be false, as specified @@ -276,7 +276,7 @@ Color ConversionHelper::decodeColor( const GraphicHelper& rGraphicHelper, if( (2 <= nOpenParen) && (nOpenParen + 1 < nCloseParen) && (nCloseParen + 1 == aColorIndex.getLength()) ) { sal_Int32 nModToken = XML_TOKEN_INVALID; - switch( AttributeConversion::decodeToken( aColorIndex.copy( 0, nOpenParen ) ) ) + switch( AttributeConversion::decodeToken( aColorIndex.subView( 0, nOpenParen ) ) ) { case XML_darken: nModToken = XML_shade;break; case XML_lighten: nModToken = XML_tint; diff --git a/oox/source/vml/vmlshapecontext.cxx b/oox/source/vml/vmlshapecontext.cxx index e8f1b0b1910e..e1b87a603173 100644 --- a/oox/source/vml/vmlshapecontext.cxx +++ b/oox/source/vml/vmlshapecontext.cxx @@ -17,6 +17,10 @@ * the License at http://www.apache.org/licenses/LICENSE-2.0 . */ +#include <sal/config.h> + +#include <string_view> + #include <oox/vml/vmlshapecontext.hxx> #include <oox/core/xmlfilterbase.hxx> @@ -126,9 +130,9 @@ OptValue< DoublePair > lclDecodePercentPair( const AttributeList& rAttribs, sal_ namespace (VML for spreadsheets). Supported values: f, t, False, True. @param bDefaultForEmpty Default value for the empty string. */ -bool lclDecodeVmlxBool( const OUString& rValue, bool bDefaultForEmpty ) +bool lclDecodeVmlxBool( std::u16string_view rValue, bool bDefaultForEmpty ) { - if( rValue.isEmpty() ) return bDefaultForEmpty; + if( rValue.empty() ) return bDefaultForEmpty; sal_Int32 nToken = AttributeConversion::decodeToken( rValue ); // anything else than 't' or 'True' is considered to be false, as specified return (nToken == XML_t) || (nToken == XML_True); diff --git a/opencl/source/openclwrapper.cxx b/opencl/source/openclwrapper.cxx index 29ad83ca2aae..0146d301f30e 100644 --- a/opencl/source/openclwrapper.cxx +++ b/opencl/source/openclwrapper.cxx @@ -25,6 +25,7 @@ #include <opencl/OpenCLZone.hxx> #include <memory> +#include <string_view> #include <stdlib.h> @@ -230,7 +231,7 @@ std::vector<std::shared_ptr<osl::File> > binaryGenerated( const char * clFileNam return aGeneratedFiles; } -bool writeBinaryToFile( const OString& rFileName, const char* binary, size_t numBytes ) +bool writeBinaryToFile( std::string_view rFileName, const char* binary, size_t numBytes ) { osl::File file(OStringToOUString(rFileName, RTL_TEXTENCODING_UTF8)); osl::FileBase::RC status = file.open( diff --git a/package/source/manifest/ManifestExport.cxx b/package/source/manifest/ManifestExport.cxx index 1546b7dbb3c7..2f6f1ea0d913 100644 --- a/package/source/manifest/ManifestExport.cxx +++ b/package/source/manifest/ManifestExport.cxx @@ -187,7 +187,7 @@ ManifestExport::ManifestExport( uno::Reference< xml::sax::XDocumentHandler > con sCdataAttribute, MANIFEST_OASIS_NAMESPACE ); bAcceptNonemptyVersion = true; - if ( aDocVersion.compareTo( ODFVER_012_TEXT ) >= 0 ) + if ( aDocVersion.compareTo( u"" ODFVER_012_TEXT ) >= 0 ) { // this is ODF12 or later generation, let encrypted // streams contain start-key-generation entry @@ -241,7 +241,7 @@ ManifestExport::ManifestExport( uno::Reference< xml::sax::XDocumentHandler > con xHandler->ignorableWhitespace ( sWhiteSpace ); // ==== manifest:keyinfo & children - bool const isODF13(aDocVersion.compareTo(ODFVER_013_TEXT) >= 0); + bool const isODF13(aDocVersion.compareTo(u"" ODFVER_013_TEXT) >= 0); if (!isODF13) { xHandler->startElement(sManifestKeyInfoElement, nullptr); diff --git a/package/source/zippackage/ZipPackage.cxx b/package/source/zippackage/ZipPackage.cxx index 34a55fcea869..d2b76ef12098 100644 --- a/package/source/zippackage/ZipPackage.cxx +++ b/package/source/zippackage/ZipPackage.cxx @@ -429,7 +429,7 @@ void ZipPackage::parseManifest() m_bInconsistent = m_xRootFolder->LookForUnexpectedODF12Streams( OUString() ); - bool bODF12AndNewer = ( m_xRootFolder->GetVersion().compareTo( ODFVER_012_TEXT ) >= 0 ); + bool bODF12AndNewer = ( m_xRootFolder->GetVersion().compareTo( u"" ODFVER_012_TEXT ) >= 0 ); if ( !m_bForceRecovery && bODF12AndNewer ) { if ( m_bInconsistent ) diff --git a/postprocess/qa/services.cxx b/postprocess/qa/services.cxx index 8441e92c1f00..5ff9f63f522b 100644 --- a/postprocess/qa/services.cxx +++ b/postprocess/qa/services.cxx @@ -25,6 +25,7 @@ #include <iostream> #include <map> #include <set> +#include <string_view> #include <utility> #include <vector> @@ -46,7 +47,7 @@ namespace { -OString msg(OUString const & string) { +OString msg(std::u16string_view string) { return OUStringToOString(string, osl_getThreadTextEncoding()); } diff --git a/pyuno/source/module/pyuno_impl.hxx b/pyuno/source/module/pyuno_impl.hxx index 6517884a01ef..e48dae7ce9ac 100644 --- a/pyuno/source/module/pyuno_impl.hxx +++ b/pyuno/source/module/pyuno_impl.hxx @@ -39,6 +39,7 @@ #include <pyuno.hxx> +#include <string_view> #include <unordered_map> #include <unordered_set> @@ -76,7 +77,7 @@ const sal_Int32 ARGS = 2; } bool isLog( RuntimeCargo const *cargo, sal_Int32 loglevel ); -void log( RuntimeCargo *cargo, sal_Int32 level, const OUString &logString ); +void log( RuntimeCargo *cargo, sal_Int32 level, std::u16string_view logString ); void log( RuntimeCargo *cargo, sal_Int32 level, const char *str ); void logCall( RuntimeCargo *cargo, const char *intro, void * ptr, const OUString & aFunctionName, @@ -168,7 +169,7 @@ typedef struct } PyUNO_list_iterator; PyRef ustring2PyUnicode( const OUString &source ); -PyRef ustring2PyString( const OUString & source ); +PyRef ustring2PyString( std::u16string_view source ); OUString pyString2ustring( PyObject *str ); /// @throws css::reflection::InvocationTargetException diff --git a/pyuno/source/module/pyuno_module.cxx b/pyuno/source/module/pyuno_module.cxx index cb2824d00005..4a9d1921386f 100644 --- a/pyuno/source/module/pyuno_module.cxx +++ b/pyuno/source/module/pyuno_module.cxx @@ -22,6 +22,7 @@ #include "pyuno_impl.hxx" #include <cassert> +#include <string_view> #include <unordered_map> #include <osl/module.hxx> @@ -216,7 +217,7 @@ OUString getLibDir() return sLibDir; } -void raisePySystemException( const char * exceptionType, const OUString & message ) +void raisePySystemException( const char * exceptionType, std::u16string_view message ) { OString buf = OStringLiteral("Error during bootstrapping uno (") + exceptionType + diff --git a/pyuno/source/module/pyuno_runtime.cxx b/pyuno/source/module/pyuno_runtime.cxx index 91005f1e13aa..961014ebc74b 100644 --- a/pyuno/source/module/pyuno_runtime.cxx +++ b/pyuno/source/module/pyuno_runtime.cxx @@ -474,8 +474,8 @@ PyRef Runtime::any2PyObject (const Any &a ) const { if( pEnumDesc->pEnumValues[i] == l ) { - OString v = OUStringToOString( pEnumDesc->ppEnumNames[i], RTL_TEXTENCODING_ASCII_US); - OString e = OUStringToOString( pEnumDesc->aBase.pTypeName, RTL_TEXTENCODING_ASCII_US); + OString v = OUStringToOString( OUString::unacquired(&pEnumDesc->ppEnumNames[i]), RTL_TEXTENCODING_ASCII_US); + OString e = OUStringToOString( OUString::unacquired(&pEnumDesc->aBase.pTypeName), RTL_TEXTENCODING_ASCII_US); return PyRef( PyUNO_Enum_new(e.getStr(),v.getStr(), *this ), SAL_NO_ACQUIRE ); } } diff --git a/pyuno/source/module/pyuno_util.cxx b/pyuno/source/module/pyuno_util.cxx index 77006c33acac..35b96183c739 100644 --- a/pyuno/source/module/pyuno_util.cxx +++ b/pyuno/source/module/pyuno_util.cxx @@ -48,7 +48,7 @@ PyRef ustring2PyUnicode( const OUString & str ) return ret; } -PyRef ustring2PyString( const OUString &str ) +PyRef ustring2PyString( std::u16string_view str ) { OString o = OUStringToOString( str, osl_getThreadTextEncoding() ); return PyRef( PyUnicode_FromString( o.getStr() ), SAL_NO_ACQUIRE ); @@ -95,7 +95,7 @@ bool isLog( RuntimeCargo const * cargo, sal_Int32 loglevel ) return cargo && cargo->logFile && loglevel <= cargo->logLevel; } -void log( RuntimeCargo * cargo, sal_Int32 level, const OUString &logString ) +void log( RuntimeCargo * cargo, sal_Int32 level, std::u16string_view logString ) { log( cargo, level, OUStringToOString( logString, osl_getThreadTextEncoding() ).getStr() ); } diff --git a/registry/source/regimpl.cxx b/registry/source/regimpl.cxx index 27a4592c9dc2..dc87985ab623 100644 --- a/registry/source/regimpl.cxx +++ b/registry/source/regimpl.cxx @@ -1005,7 +1005,7 @@ RegError ORegistry::loadAndSaveValue(ORegKey* pTargetKey, } RegError ORegistry::checkBlop(OStoreStream& rValue, - const OUString& sTargetPath, + std::u16string_view sTargetPath, sal_uInt32 srcValueSize, sal_uInt8 const * pSrcBuffer, bool bReport) diff --git a/registry/source/regimpl.hxx b/registry/source/regimpl.hxx index e049cf147c18..db2af7e77846 100644 --- a/registry/source/regimpl.hxx +++ b/registry/source/regimpl.hxx @@ -20,6 +20,9 @@ #ifndef INCLUDED_REGISTRY_SOURCE_REGIMPL_HXX #define INCLUDED_REGISTRY_SOURCE_REGIMPL_HXX +#include <sal/config.h> + +#include <string_view> #include <unordered_map> #include <regapi.hxx> @@ -111,7 +114,7 @@ private: bool bReport); static RegError checkBlop(store::OStoreStream& rValue, - const OUString& sTargetPath, + std::u16string_view sTargetPath, sal_uInt32 srcValueSize, sal_uInt8 const * pSrcBuffer, bool bReport); diff --git a/reportdesign/source/ui/inc/metadata.hxx b/reportdesign/source/ui/inc/metadata.hxx index 63281076dddc..c5ea24a82287 100644 --- a/reportdesign/source/ui/inc/metadata.hxx +++ b/reportdesign/source/ui/inc/metadata.hxx @@ -22,6 +22,8 @@ #include <com/sun/star/beans/Property.hpp> #include <com/sun/star/inspection/XPropertyHandler.hpp> #include <o3tl/typed_flags_set.hxx> + +#include <string_view> #include <vector> //= UI flags (for all browsable properties) @@ -82,7 +84,7 @@ namespace rptui class HelpIdUrl { public: - static OUString getHelpURL( const OString& _sHelpId ); + static OUString getHelpURL( std::string_view _sHelpId ); }; diff --git a/reportdesign/source/ui/inspection/DefaultInspection.cxx b/reportdesign/source/ui/inspection/DefaultInspection.cxx index 91b8921e08f5..4ac4dd3bbc2a 100644 --- a/reportdesign/source/ui/inspection/DefaultInspection.cxx +++ b/reportdesign/source/ui/inspection/DefaultInspection.cxx @@ -30,7 +30,7 @@ namespace rptui { - OUString HelpIdUrl::getHelpURL( const OString& sHelpId ) + OUString HelpIdUrl::getHelpURL( std::string_view sHelpId ) { OUString aTmp( OStringToOUString(sHelpId, RTL_TEXTENCODING_UTF8) ); DBG_ASSERT( INetURLObject( aTmp ).GetProtocol() == INetProtocol::NotValid, "Wrong HelpId!" ); diff --git a/sal/cppunittester/cppunittester.cxx b/sal/cppunittester/cppunittester.cxx index c6fd3b9a269e..7ab54da02106 100644 --- a/sal/cppunittester/cppunittester.cxx +++ b/sal/cppunittester/cppunittester.cxx @@ -61,6 +61,7 @@ #include <boost/algorithm/string.hpp> #include <algorithm> +#include <string_view> namespace { @@ -78,7 +79,7 @@ OUString getArgument(sal_Int32 index) { return arg; } -std::string convertLazy(OUString const & s16) { +std::string convertLazy(std::u16string_view s16) { OString s8(OUStringToOString(s16, osl_getThreadTextEncoding())); static_assert(sizeof (sal_Int32) <= sizeof (std::string::size_type), "must be at least the same size"); // ensure following cast is legitimate diff --git a/sal/osl/unx/uunxapi.cxx b/sal/osl/unx/uunxapi.cxx index e8901784c878..1f847cfd32a5 100644 --- a/sal/osl/unx/uunxapi.cxx +++ b/sal/osl/unx/uunxapi.cxx @@ -17,6 +17,10 @@ * the License at http://www.apache.org/licenses/LICENSE-2.0 . */ +#include <sal/config.h> + +#include <string_view> + #include <config_features.h> #include "uunxapi.hxx" @@ -31,9 +35,9 @@ #include <osl/detail/android-bootstrap.h> #endif -OString osl::OUStringToOString(const OUString& s) +OString osl::OUStringToOString(std::u16string_view s) { - return OUStringToOString(s, osl_getThreadTextEncoding()); + return rtl::OUStringToOString(s, osl_getThreadTextEncoding()); } #if HAVE_FEATURE_MACOSX_SANDBOX @@ -198,7 +202,7 @@ namespace { OString toOString(OString const & s) { return s; } -OString toOString(OUString const & s) { return osl::OUStringToOString(s); } +OString toOString(std::u16string_view s) { return osl::OUStringToOString(s); } template<typename T> T fromOString(OString const &) = delete; diff --git a/sal/osl/unx/uunxapi.hxx b/sal/osl/unx/uunxapi.hxx index f182b755e53b..b5c0c9ed9d41 100644 --- a/sal/osl/unx/uunxapi.hxx +++ b/sal/osl/unx/uunxapi.hxx @@ -20,6 +20,10 @@ #ifndef INCLUDED_SAL_OSL_UNX_UUNXAPI_HXX #define INCLUDED_SAL_OSL_UNX_UUNXAPI_HXX +#include <sal/config.h> + +#include <string_view> + #include <unistd.h> #include <stdlib.h> #include <sys/types.h> @@ -42,7 +46,7 @@ int ftruncate_with_name(int fd, sal_uInt64 uSize, rtl_String* path); namespace osl { - OString OUStringToOString(const OUString& s); + OString OUStringToOString(std::u16string_view s); int access(const OString& strPath, int mode); diff --git a/sax/source/fastparser/fastparser.cxx b/sax/source/fastparser/fastparser.cxx index 05288a4ef5f3..f0fe5aea2f67 100644 --- a/sax/source/fastparser/fastparser.cxx +++ b/sax/source/fastparser/fastparser.cxx @@ -41,6 +41,7 @@ #include <queue> #include <memory> #include <stack> +#include <string_view> #include <unordered_map> #include <vector> #include <cassert> @@ -228,7 +229,7 @@ public: void registerNamespace( const OUString& NamespaceURL, sal_Int32 NamespaceToken ); /// @throws css::lang::IllegalArgumentException /// @throws css::uno::RuntimeException - OUString const & getNamespaceURL( const OUString& rPrefix ); + OUString const & getNamespaceURL( std::u16string_view rPrefix ); /// @throws css::uno::RuntimeException void setErrorHandler( const css::uno::Reference< css::xml::sax::XErrorHandler >& Handler ); /// @throws css::uno::RuntimeException @@ -911,7 +912,7 @@ void FastSaxParserImpl::registerNamespace( const OUString& NamespaceURL, sal_Int throw IllegalArgumentException("namespace URL is already registered: " + NamespaceURL, css::uno::Reference<css::uno::XInterface >(), 0); } -OUString const & FastSaxParserImpl::getNamespaceURL( const OUString& rPrefix ) +OUString const & FastSaxParserImpl::getNamespaceURL( std::u16string_view rPrefix ) { try { diff --git a/sax/source/tools/fastserializer.cxx b/sax/source/tools/fastserializer.cxx index 792784eb2a9c..e6538424891c 100644 --- a/sax/source/tools/fastserializer.cxx +++ b/sax/source/tools/fastserializer.cxx @@ -91,7 +91,7 @@ namespace sax_fastparser { mnDoubleStrCapacity = RTL_STR_MAX_VALUEOFDOUBLE; } - void FastSaxSerializer::write( const OUString& sOutput, bool bEscape ) + void FastSaxSerializer::write( std::u16string_view sOutput, bool bEscape ) { write( OUStringToOString(sOutput, RTL_TEXTENCODING_UTF8), bEscape ); diff --git a/sax/source/tools/fastserializer.hxx b/sax/source/tools/fastserializer.hxx index 0b7ad72d8c0c..109ada3c726f 100644 --- a/sax/source/tools/fastserializer.hxx +++ b/sax/source/tools/fastserializer.hxx @@ -28,6 +28,7 @@ #include "CachedOutputStream.hxx" #include <stack> +#include <string_view> #include <map> #include <memory> @@ -111,7 +112,7 @@ public: OString getId( ::sal_Int32 Element ); void write( double value ); - void write( const OUString& s, bool bEscape = false ); + void write( std::u16string_view s, bool bEscape = false ); void write( const OString& s, bool bEscape = false ); void write( const char* pStr, sal_Int32 nLen, bool bEscape = false ); diff --git a/sax/source/tools/fshelper.cxx b/sax/source/tools/fshelper.cxx index 39b01f175176..b285ba9f3219 100644 --- a/sax/source/tools/fshelper.cxx +++ b/sax/source/tools/fshelper.cxx @@ -86,7 +86,7 @@ FastSerializerHelper* FastSerializerHelper::write(const OString& value) return this; } -FastSerializerHelper* FastSerializerHelper::write(const OUString& value) +FastSerializerHelper* FastSerializerHelper::write(std::u16string_view value) { mpSerializer->write(value); return this; @@ -116,9 +116,9 @@ FastSerializerHelper* FastSerializerHelper::writeEscaped(const char* value) return this; } -FastSerializerHelper* FastSerializerHelper::writeEscaped(const OUString& value) +FastSerializerHelper* FastSerializerHelper::writeEscaped(std::u16string_view value) { - if (!value.isEmpty()) + if (!value.empty()) mpSerializer->write(value, true); return this; } diff --git a/sc/inc/formulalogger.hxx b/sc/inc/formulalogger.hxx index cfc01449c2a8..75b86e9f996d 100644 --- a/sc/inc/formulalogger.hxx +++ b/sc/inc/formulalogger.hxx @@ -11,6 +11,7 @@ #include <rtl/ustring.hxx> #include <memory> +#include <string_view> #include <vector> #include <config_options_calc.h> @@ -45,7 +46,7 @@ class FormulaLogger void writeAscii( const char* s ); void writeAscii( const char* s, size_t n ); - void write( const OUString& ou ); + void write( std::u16string_view ou ); void write( sal_Int32 n ); void sync(); diff --git a/sc/qa/unit/helper/csv_handler.hxx b/sc/qa/unit/helper/csv_handler.hxx index 8d24c38edaa3..dafc8a931393 100644 --- a/sc/qa/unit/helper/csv_handler.hxx +++ b/sc/qa/unit/helper/csv_handler.hxx @@ -10,6 +10,10 @@ #ifndef INCLUDED_SC_QA_UNIT_HELPER_CSV_HANDLER_HXX #define INCLUDED_SC_QA_UNIT_HELPER_CSV_HANDLER_HXX +#include <sal/config.h> + +#include <string_view> + #include "qahelper.hxx" #include <patattr.hxx> @@ -45,7 +49,7 @@ inline OString createErrorMessage(SCCOL nCol, SCROW nRow, SCTAB nTab) OString::number(nRow); } -inline OString createErrorMessage(SCCOL nCol, SCROW nRow, SCTAB nTab, const OUString& rExpectedString, const OUString& rString) +inline OString createErrorMessage(SCCOL nCol, SCROW nRow, SCTAB nTab, std::u16string_view rExpectedString, std::u16string_view rString) { return createErrorMessage(nCol, nRow, nTab) + "; Expected: '" + OUStringToOString(rExpectedString, RTL_TEXTENCODING_UTF8) + "' Found: '" diff --git a/sc/source/core/tool/address.cxx b/sc/source/core/tool/address.cxx index e595e7003155..c7a16a8aeb49 100644 --- a/sc/source/core/tool/address.cxx +++ b/sc/source/core/tool/address.cxx @@ -2007,7 +2007,7 @@ static void lcl_string_append(OUStringBuffer &rString, const OUString &sString) rString.append(sString); } -static void lcl_string_append(OStringBuffer &rString, const OUString &sString) +static void lcl_string_append(OStringBuffer &rString, std::u16string_view sString) { rString.append(OUStringToOString( sString, RTL_TEXTENCODING_UTF8 )); } diff --git a/sc/source/core/tool/formulalogger.cxx b/sc/source/core/tool/formulalogger.cxx index f32017b4d4c3..46465b56195a 100644 --- a/sc/source/core/tool/formulalogger.cxx +++ b/sc/source/core/tool/formulalogger.cxx @@ -297,7 +297,7 @@ void FormulaLogger::writeAscii( const char* s, size_t n ) mpLogFile->write(s, n, nBytes); } -void FormulaLogger::write( const OUString& ou ) +void FormulaLogger::write( std::u16string_view ou ) { OString s = OUStringToOString(ou, RTL_TEXTENCODING_UTF8).getStr(); writeAscii(s.getStr(), s.getLength()); diff --git a/sc/source/core/tool/interpr1.cxx b/sc/source/core/tool/interpr1.cxx index 38bcc983c36e..b55f1172f704 100644 --- a/sc/source/core/tool/interpr1.cxx +++ b/sc/source/core/tool/interpr1.cxx @@ -3462,7 +3462,7 @@ void ScInterpreter::ScCode() RTL_UNICODETOTEXT_FLAGS_UNDEFINED_DEFAULT | RTL_UNICODETOTEXT_FLAGS_INVALID_DEFAULT | RTL_UNICODETOTEXT_FLAGS_UNDEFINED_REPLACE; - PushInt( static_cast<unsigned char>(OUStringToOString(OUString(aStr[0]), osl_getThreadTextEncoding(), convertFlags).toChar()) ); + PushInt( static_cast<unsigned char>(OUStringToOString(OUStringChar(aStr[0]), osl_getThreadTextEncoding(), convertFlags).toChar()) ); } } diff --git a/sc/source/core/tool/interpr7.cxx b/sc/source/core/tool/interpr7.cxx index acdea080b7b0..d50a084acb75 100644 --- a/sc/source/core/tool/interpr7.cxx +++ b/sc/source/core/tool/interpr7.cxx @@ -30,6 +30,7 @@ #include <cstring> #include <memory> +#include <string_view> using namespace com::sun::star; @@ -178,13 +179,13 @@ void ScInterpreter::ScFilterXML() xmlNsPtr ns = reinterpret_cast<xmlNsPtr>(pNodeSet->nodeTab[nNode]); xmlNodePtr cur = reinterpret_cast<xmlNodePtr>(ns->next); std::shared_ptr<xmlChar> pChar2(xmlNodeGetContent(cur), xmlFree); - aResult = OStringToOUString(OString(reinterpret_cast<char*>(pChar2.get())), RTL_TEXTENCODING_UTF8); + aResult = OStringToOUString(std::string_view(reinterpret_cast<char*>(pChar2.get())), RTL_TEXTENCODING_UTF8); } else { xmlNodePtr cur = pNodeSet->nodeTab[nNode]; std::shared_ptr<xmlChar> pChar2(xmlNodeGetContent(cur), xmlFree); - aResult = OStringToOUString(OString(reinterpret_cast<char*>(pChar2.get())), RTL_TEXTENCODING_UTF8); + aResult = OStringToOUString(std::string_view(reinterpret_cast<char*>(pChar2.get())), RTL_TEXTENCODING_UTF8); } if (xResMat) xResMat->PutString( mrStrPool.intern( aResult), 0, nNode); diff --git a/sc/source/filter/excel/xelink.cxx b/sc/source/filter/excel/xelink.cxx index 85afc7d6e307..c84cd6364dc4 100644 --- a/sc/source/filter/excel/xelink.cxx +++ b/sc/source/filter/excel/xelink.cxx @@ -38,6 +38,7 @@ #include <vector> #include <memory> +#include <string_view> using ::std::unique_ptr; using ::std::vector; @@ -274,7 +275,7 @@ public: private: /** Initializes the record data with the passed encoded URL. */ - void Init( const OUString& rEncUrl ); + void Init( std::u16string_view rEncUrl ); /** Writes the contents of the EXTERNSHEET record. */ virtual void WriteBody( XclExpStream& rStrm ) override; @@ -1457,14 +1458,14 @@ void XclExpExternSheetBase::WriteExtNameBufferXml( XclExpXmlStream& rStrm ) XclExpExternSheet::XclExpExternSheet( const XclExpRoot& rRoot, sal_Unicode cCode ) : XclExpExternSheetBase( rRoot, EXC_ID_EXTERNSHEET ) { - Init( OUString(cCode) ); + Init( OUStringChar(cCode) ); } XclExpExternSheet::XclExpExternSheet( const XclExpRoot& rRoot, const OUString& rTabName ) : XclExpExternSheetBase( rRoot, EXC_ID_EXTERNSHEET ) { // reference to own sheet: \03<sheetname> - Init(OUStringChar(EXC_EXTSH_TABNAME) + rTabName); + Init(OUString(OUStringChar(EXC_EXTSH_TABNAME) + rTabName)); } void XclExpExternSheet::Save( XclExpStream& rStrm ) @@ -1475,7 +1476,7 @@ void XclExpExternSheet::Save( XclExpStream& rStrm ) WriteExtNameBuffer( rStrm ); } -void XclExpExternSheet::Init( const OUString& rEncUrl ) +void XclExpExternSheet::Init( std::u16string_view rEncUrl ) { OSL_ENSURE_BIFF( GetBiff() <= EXC_BIFF5 ); maTabName.AssignByte( rEncUrl, GetTextEncoding(), XclStrFlags::EightBitLength ); diff --git a/sc/source/filter/excel/xestream.cxx b/sc/source/filter/excel/xestream.cxx index c0a2646461bf..f7b0c77f1381 100644 --- a/sc/source/filter/excel/xestream.cxx +++ b/sc/source/filter/excel/xestream.cxx @@ -932,7 +932,7 @@ sax_fastparser::FSHelperPtr XclExpXmlStream::GetStreamForPath( const OUString& s return maOpenedStreamMap[ sPath ].second; } -void XclExpXmlStream::WriteAttribute(sal_Int32 nAttr, const OUString& sVal) +void XclExpXmlStream::WriteAttribute(sal_Int32 nAttr, std::u16string_view sVal) { GetCurrentStream()->write(" ")->writeId(nAttr)->write("=\"")->writeEscaped(sVal)->write("\""); } diff --git a/sc/source/filter/excel/xestring.cxx b/sc/source/filter/excel/xestring.cxx index ff5abf3c6a51..db85728ef7ef 100644 --- a/sc/source/filter/excel/xestring.cxx +++ b/sc/source/filter/excel/xestring.cxx @@ -119,7 +119,8 @@ void XclExpString::Assign( sal_Unicode cChar ) } void XclExpString::AssignByte( - const OUString& rString, rtl_TextEncoding eTextEnc, XclStrFlags nFlags, sal_uInt16 nMaxLen ) + std::u16string_view rString, rtl_TextEncoding eTextEnc, XclStrFlags nFlags, + sal_uInt16 nMaxLen ) { // length may differ from length of rString OString aByteStr(OUStringToOString(rString, eTextEnc)); @@ -133,9 +134,9 @@ void XclExpString::Append( const OUString& rString ) BuildAppend( rString.getStr(), rString.getLength() ); } -void XclExpString::AppendByte( const OUString& rString, rtl_TextEncoding eTextEnc ) +void XclExpString::AppendByte( std::u16string_view rString, rtl_TextEncoding eTextEnc ) { - if (!rString.isEmpty()) + if (!rString.empty()) { // length may differ from length of rString OString aByteStr(OUStringToOString(rString, eTextEnc)); diff --git a/sc/source/filter/html/htmlpars.cxx b/sc/source/filter/html/htmlpars.cxx index 0fa8aa59caac..13b00a60bb30 100644 --- a/sc/source/filter/html/htmlpars.cxx +++ b/sc/source/filter/html/htmlpars.cxx @@ -3091,7 +3091,7 @@ public: } -void ScHTMLQueryParser::ParseStyle(const OUString& rStrm) +void ScHTMLQueryParser::ParseStyle(std::u16string_view rStrm) { OString aStr = OUStringToOString(rStrm, RTL_TEXTENCODING_UTF8); CSSHandler aHdl; diff --git a/sc/source/filter/inc/htmlpars.hxx b/sc/source/filter/inc/htmlpars.hxx index 95243021d6d4..9e1c071a3238 100644 --- a/sc/source/filter/inc/htmlpars.hxx +++ b/sc/source/filter/inc/htmlpars.hxx @@ -23,6 +23,7 @@ #include <memory> #include <map> #include <stack> +#include <string_view> #include <unordered_map> #include <vector> #include <o3tl/sorted_vector.hxx> @@ -600,7 +601,7 @@ private: /** Closes the current table, regardless on opening tag. */ void CloseTable( const HtmlImportInfo& rInfo ); - static void ParseStyle(const OUString& rStrm); + static void ParseStyle(std::u16string_view rStrm); DECL_LINK( HTMLImportHdl, HtmlImportInfo&, void ); diff --git a/sc/source/filter/inc/xestream.hxx b/sc/source/filter/inc/xestream.hxx index bbcdf7740f4f..65245db83d77 100644 --- a/sc/source/filter/inc/xestream.hxx +++ b/sc/source/filter/inc/xestream.hxx @@ -22,6 +22,8 @@ #include <map> #include <stack> +#include <string_view> + #include <rtl/strbuf.hxx> #include <oox/core/xmlfilterbase.hxx> @@ -328,8 +330,8 @@ private: virtual ::oox::ole::VbaProject* implCreateVbaProject() const override; virtual OUString SAL_CALL getImplementationName() override; ScDocShell *getDocShell(); - void WriteAttribute(sal_Int32 nAttr, const OUString& sVal); - void WriteAttribute(sal_Int32 nAttr, const OString& sVal) + void WriteAttribute(sal_Int32 nAttr, std::u16string_view sVal); + void WriteAttribute(sal_Int32 nAttr, std::string_view sVal) { WriteAttribute(nAttr, OStringToOUString(sVal, RTL_TEXTENCODING_UTF8)); } diff --git a/sc/source/filter/inc/xestring.hxx b/sc/source/filter/inc/xestring.hxx index 9dfbe4be2b90..196ac4a83600 100644 --- a/sc/source/filter/inc/xestring.hxx +++ b/sc/source/filter/inc/xestring.hxx @@ -20,6 +20,10 @@ #ifndef INCLUDED_SC_SOURCE_FILTER_INC_XESTRING_HXX #define INCLUDED_SC_SOURCE_FILTER_INC_XESTRING_HXX +#include <sal/config.h> + +#include <string_view> + #include "xlstring.hxx" #include "ftools.hxx" @@ -78,7 +82,7 @@ public: @param nFlags Modifiers for string export. @param nMaxLen The maximum number of characters to store in this string. */ void AssignByte( - const OUString& rString, + std::u16string_view rString, rtl_TextEncoding eTextEnc, XclStrFlags nFlags = XclStrFlags::NONE, sal_uInt16 nMaxLen = EXC_STR_MAXLEN ); @@ -91,7 +95,7 @@ public: /** Appends a string. Uses the string flags used in constructor or last Assign(). @descr This object must be a BIFF2-BIFF7 byte string. */ - void AppendByte( const OUString& rString, rtl_TextEncoding eTextEnc ); + void AppendByte( std::u16string_view rString, rtl_TextEncoding eTextEnc ); /** Appends a character. Uses the string flags used in constructor or last Assign(). @descr This object must be a BIFF2-BIFF7 byte string. */ void AppendByte( sal_Unicode cChar, rtl_TextEncoding eTextEnc ); diff --git a/sc/source/filter/oox/numberformatsbuffer.cxx b/sc/source/filter/oox/numberformatsbuffer.cxx index 922b0ccb93a1..70146cd0747c 100644 --- a/sc/source/filter/oox/numberformatsbuffer.cxx +++ b/sc/source/filter/oox/numberformatsbuffer.cxx @@ -1934,7 +1934,7 @@ void NumberFormat::setFormatCode( const OUString& rFmtCode ) void NumberFormat::setFormatCode( const Locale& rLocale, const char* pcFmtCode ) { maModel.maLocale = rLocale; - maModel.maFmtCode = OStringToOUString( OString( pcFmtCode ), RTL_TEXTENCODING_UTF8 ); + maModel.maFmtCode = OStringToOUString( std::string_view( pcFmtCode ), RTL_TEXTENCODING_UTF8 ); maModel.mnPredefId = -1; } diff --git a/sc/source/ui/miscdlgs/mtrindlg.cxx b/sc/source/ui/miscdlgs/mtrindlg.cxx index 4226be64eee7..b7b3a43beb59 100644 --- a/sc/source/ui/miscdlgs/mtrindlg.cxx +++ b/sc/source/ui/miscdlgs/mtrindlg.cxx @@ -30,8 +30,8 @@ ScMetricInputDlg::ScMetricInputDlg( weld::Window* pParent, tools::Long nMaximum, tools::Long nMinimum) - : GenericDialogController(pParent, OStringToOUString("modules/scalc/ui/" + - sDialogName.toAsciiLowerCase() + ".ui", RTL_TEXTENCODING_UTF8), sDialogName) + : GenericDialogController(pParent, "modules/scalc/ui/" + OStringToOUString( + sDialogName.toAsciiLowerCase(), RTL_TEXTENCODING_UTF8) + ".ui", sDialogName) , m_xEdValue(m_xBuilder->weld_metric_spin_button("value", FieldUnit::CM)) , m_xBtnDefVal(m_xBuilder->weld_check_button("default")) { diff --git a/scripting/source/provider/BrowseNodeFactoryImpl.cxx b/scripting/source/provider/BrowseNodeFactoryImpl.cxx index eeb5cd0977b7..854dd312bd86 100644 --- a/scripting/source/provider/BrowseNodeFactoryImpl.cxx +++ b/scripting/source/provider/BrowseNodeFactoryImpl.cxx @@ -38,6 +38,7 @@ #include <vector> #include <algorithm> #include <memory> +#include <string_view> using namespace ::com::sun::star; using namespace ::com::sun::star::uno; @@ -141,7 +142,7 @@ public: struct alphaSort { - bool operator()( const OUString& a, const OUString& b ) + bool operator()( const OUString& a, std::u16string_view b ) { return a.compareTo( b ) < 0; } diff --git a/sd/qa/unit/export-tests-ooxml1.cxx b/sd/qa/unit/export-tests-ooxml1.cxx index 75222f267a58..ca100c003967 100644 --- a/sd/qa/unit/export-tests-ooxml1.cxx +++ b/sd/qa/unit/export-tests-ooxml1.cxx @@ -6,6 +6,11 @@ * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ + +#include <sal/config.h> + +#include <string_view> + #include <officecfg/Office/Common.hxx> #include "sdmodeltestbase.hxx" #include <Outliner.hxx> @@ -537,7 +542,7 @@ void SdOOXMLExportTest1::testTableCellFillProperties() uno::Reference< lang::XComponent > xComponent = xDocShRef->GetModel(); uno::Reference<frame::XStorable> xStorable(xComponent, uno::UNO_QUERY); utl::MediaDescriptor aMediaDescriptor; - aMediaDescriptor["FilterName"] <<= OStringToOUString(OString(aFileFormats[PPTX].pFilterName), RTL_TEXTENCODING_UTF8); + aMediaDescriptor["FilterName"] <<= OStringToOUString(std::string_view(aFileFormats[PPTX].pFilterName), RTL_TEXTENCODING_UTF8); utl::TempFile aTempFile; aTempFile.EnableKillingFile(); diff --git a/sd/qa/unit/export-tests.cxx b/sd/qa/unit/export-tests.cxx index 69eb33240764..39700d4ab7cf 100644 --- a/sd/qa/unit/export-tests.cxx +++ b/sd/qa/unit/export-tests.cxx @@ -6,6 +6,11 @@ * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ + +#include <sal/config.h> + +#include <string_view> + #include <officecfg/Office/Common.hxx> #include "sdmodeltestbase.hxx" #include <sdpage.hxx> @@ -416,7 +421,7 @@ void SdExportTest::testSwappedOutImageExport() uno::Reference< lang::XComponent > xComponent = xDocShRef->GetModel(); uno::Reference<frame::XStorable> xStorable(xComponent, uno::UNO_QUERY); utl::MediaDescriptor aMediaDescriptor; - aMediaDescriptor["FilterName"] <<= OStringToOUString(OString(aFileFormats[vFormats[nExportFormat]].pFilterName), RTL_TEXTENCODING_UTF8); + aMediaDescriptor["FilterName"] <<= OStringToOUString(std::string_view(aFileFormats[vFormats[nExportFormat]].pFilterName), RTL_TEXTENCODING_UTF8); utl::TempFile aTempFile; aTempFile.EnableKillingFile(); @@ -472,7 +477,7 @@ void SdExportTest::testOOoXMLAnimations() uno::Reference<lang::XComponent> xComponent = xDocShRef->GetModel(); uno::Reference<frame::XStorable> xStorable(xComponent, uno::UNO_QUERY); utl::MediaDescriptor aMediaDescriptor; - aMediaDescriptor["FilterName"] <<= OStringToOUString(OString(getFormat(ODP)->pFilterName), RTL_TEXTENCODING_UTF8); + aMediaDescriptor["FilterName"] <<= OStringToOUString(std::string_view(getFormat(ODP)->pFilterName), RTL_TEXTENCODING_UTF8); utl::TempFile aTempFile; aTempFile.EnableKillingFile(); xStorable->storeToURL(aTempFile.GetURL(), aMediaDescriptor.getAsConstPropertyValueList()); @@ -548,7 +553,7 @@ void SdExportTest::testUnknownAttributes() uno::Reference<lang::XComponent> xComponent = xDocShRef->GetModel(); uno::Reference<frame::XStorable> xStorable(xComponent, uno::UNO_QUERY); utl::MediaDescriptor aMediaDescriptor; - aMediaDescriptor["FilterName"] <<= OStringToOUString(OString(getFormat(ODP)->pFilterName), RTL_TEXTENCODING_UTF8); + aMediaDescriptor["FilterName"] <<= OStringToOUString(std::string_view(getFormat(ODP)->pFilterName), RTL_TEXTENCODING_UTF8); utl::TempFile aTempFile; aTempFile.EnableKillingFile(); xStorable->storeToURL(aTempFile.GetURL(), aMediaDescriptor.getAsConstPropertyValueList()); @@ -601,7 +606,7 @@ void SdExportTest::testLinkedGraphicRT() uno::Reference< lang::XComponent > xComponent = xDocShRef->GetModel(); uno::Reference<frame::XStorable> xStorable(xComponent, uno::UNO_QUERY); utl::MediaDescriptor aMediaDescriptor; - aMediaDescriptor["FilterName"] <<= OStringToOUString(OString(aFileFormats[vFormats[nExportFormat]].pFilterName), RTL_TEXTENCODING_UTF8); + aMediaDescriptor["FilterName"] <<= OStringToOUString(std::string_view(aFileFormats[vFormats[nExportFormat]].pFilterName), RTL_TEXTENCODING_UTF8); // Check if the graphic has been imported correctly (before doing the export/import run) { @@ -713,7 +718,7 @@ void SdExportTest::testImageWithSpecialID() uno::Reference< lang::XComponent > xComponent = xDocShRef->GetModel(); uno::Reference<frame::XStorable> xStorable(xComponent, uno::UNO_QUERY); utl::MediaDescriptor aMediaDescriptor; - aMediaDescriptor["FilterName"] <<= OStringToOUString(OString(aFileFormats[vFormats[nExportFormat]].pFilterName), RTL_TEXTENCODING_UTF8); + aMediaDescriptor["FilterName"] <<= OStringToOUString(std::string_view(aFileFormats[vFormats[nExportFormat]].pFilterName), RTL_TEXTENCODING_UTF8); utl::TempFile aTempFile; aTempFile.EnableKillingFile(); @@ -1014,7 +1019,7 @@ void SdExportTest::testTdf115394PPT() uno::Reference< lang::XComponent > xComponent = xDocShRef->GetModel(); uno::Reference<frame::XStorable> xStorable(xComponent, uno::UNO_QUERY); utl::MediaDescriptor aMediaDescriptor; - aMediaDescriptor["FilterName"] <<= OStringToOUString(OString(aFileFormats[PPT].pFilterName), RTL_TEXTENCODING_UTF8); + aMediaDescriptor["FilterName"] <<= OStringToOUString(std::string_view(aFileFormats[PPT].pFilterName), RTL_TEXTENCODING_UTF8); utl::TempFile aTempFile; aTempFile.EnableKillingFile(); @@ -1053,7 +1058,7 @@ void SdExportTest::testBulletsAsImage() uno::Reference< lang::XComponent > xComponent = xDocShRef->GetModel(); uno::Reference<frame::XStorable> xStorable(xComponent, uno::UNO_QUERY); utl::MediaDescriptor aMediaDescriptor; - aMediaDescriptor["FilterName"] <<= OStringToOUString(OString(aFileFormats[nExportFormat].pFilterName), RTL_TEXTENCODING_UTF8); + aMediaDescriptor["FilterName"] <<= OStringToOUString(std::string_view(aFileFormats[nExportFormat].pFilterName), RTL_TEXTENCODING_UTF8); utl::TempFile aTempFile; aTempFile.EnableKillingFile(); diff --git a/sd/qa/unit/import-tests.cxx b/sd/qa/unit/import-tests.cxx index 8906d780c4bf..12b340ccf3fa 100644 --- a/sd/qa/unit/import-tests.cxx +++ b/sd/qa/unit/import-tests.cxx @@ -415,7 +415,7 @@ void SdImportTest::testDocumentLayout() if( aFilesToCompare[i].nExportType >= 0 ) xDocShRef = saveAndReload( xDocShRef.get(), aFilesToCompare[i].nExportType ); compareWithShapesDump( xDocShRef, - m_directories.getPathFromSrc( "/sd/qa/unit/data/" ) + OUString::createFromAscii( aFilesToCompare[i].pDump ), + OUString(m_directories.getPathFromSrc( "/sd/qa/unit/data/" ) + OUString::createFromAscii( aFilesToCompare[i].pDump )), i == nUpdateMe ); } } diff --git a/sd/qa/unit/sdmodeltestbase.hxx b/sd/qa/unit/sdmodeltestbase.hxx index de163fbc38ef..f2dd51b58b20 100644 --- a/sd/qa/unit/sdmodeltestbase.hxx +++ b/sd/qa/unit/sdmodeltestbase.hxx @@ -11,6 +11,8 @@ #define INCLUDED_SD_QA_UNIT_SDMODELTESTBASE_HXX #include <memory> +#include <string_view> + #include <test/bootstrapfixture.hxx> #include <test/xmldiff.hxx> #include <test/xmltesttools.hxx> @@ -305,7 +307,7 @@ protected: @param bCreate Instead of comparing to the reference file(s), create it/them. */ - void compareWithShapesDump( ::sd::DrawDocShellRef xDocShRef, const OUString &rShapesDumpFileNameBase, bool bCreate ) + void compareWithShapesDump( ::sd::DrawDocShellRef xDocShRef, std::u16string_view rShapesDumpFileNameBase, bool bCreate ) { CPPUNIT_ASSERT_MESSAGE( "failed to load", xDocShRef.is() ); CPPUNIT_ASSERT_MESSAGE( "not in destruction", !xDocShRef->IsInDestruction() ); diff --git a/sd/source/filter/html/htmlex.cxx b/sd/source/filter/html/htmlex.cxx index 7b1efa7e14b5..bcd21c6e8074 100644 --- a/sd/source/filter/html/htmlex.cxx +++ b/sd/source/filter/html/htmlex.cxx @@ -1144,7 +1144,7 @@ bool HtmlExport::CreateHtmlTextForPresPages() /** exports the given html data into a non unicode file in the current export path with the given filename */ -bool HtmlExport::WriteHtml( const OUString& rFileName, bool bAddExtension, const OUString& rHtmlData ) +bool HtmlExport::WriteHtml( const OUString& rFileName, bool bAddExtension, std::u16string_view rHtmlData ) { ErrCode nErr = ERRCODE_NONE; diff --git a/sd/source/filter/html/htmlex.hxx b/sd/source/filter/html/htmlex.hxx index 1622bc4a0e0c..2c07ab2358b8 100644 --- a/sd/source/filter/html/htmlex.hxx +++ b/sd/source/filter/html/htmlex.hxx @@ -29,6 +29,7 @@ #include "htmlpublishmode.hxx" #include <memory> +#include <string_view> #include <vector> namespace basegfx { class B2DPolyPolygon; } @@ -207,7 +208,7 @@ class HtmlExport final void ExportWebCast(); void ExportSingleDocument(); - bool WriteHtml( const OUString& rFileName, bool bAddExtension, const OUString& rHtmlData ); + bool WriteHtml( const OUString& rFileName, bool bAddExtension, std::u16string_view rHtmlData ); static OUString GetButtonName( int nButton ); void WriteOutlinerParagraph(OUStringBuffer& aStr, SdrOutliner* pOutliner, diff --git a/sdext/source/pdfimport/test/pdfunzip.cxx b/sdext/source/pdfimport/test/pdfunzip.cxx index 7c857e884bd6..a4d93c611d7d 100644 --- a/sdext/source/pdfimport/test/pdfunzip.cxx +++ b/sdext/source/pdfimport/test/pdfunzip.cxx @@ -19,6 +19,8 @@ #include <stdio.h> +#include <string_view> + #include <sal/main.h> #include <osl/file.h> #include <osl/thread.h> @@ -80,7 +82,8 @@ FileEmitContext::FileEmitContext( const char* pFileName, const char* pOrigName, m_aReadHandle( nullptr ), m_nReadLen( 0 ) { - OUString aSysFile( OStringToOUString( OString( pFileName ), osl_getThreadTextEncoding() ) ); + OUString aSysFile( + OStringToOUString( std::string_view( pFileName ), osl_getThreadTextEncoding() ) ); OUString aURL; if( osl_getFileURLFromSystemPath( aSysFile.pData, &aURL.pData ) != osl_File_E_None ) { @@ -118,7 +121,8 @@ FileEmitContext::~FileEmitContext() void FileEmitContext::openReadFile( const char* pInFile ) { - OUString aSysFile( OStringToOUString( OString( pInFile ), osl_getThreadTextEncoding() ) ); + OUString aSysFile( + OStringToOUString( std::string_view( pInFile ), osl_getThreadTextEncoding() ) ); OUString aURL; if( osl_getFileURLFromSystemPath( aSysFile.pData, &aURL.pData ) != osl_File_E_None ) { diff --git a/sdext/source/pdfimport/tree/style.cxx b/sdext/source/pdfimport/tree/style.cxx index 8d6f7d3753cd..68f36379e172 100644 --- a/sdext/source/pdfimport/tree/style.cxx +++ b/sdext/source/pdfimport/tree/style.cxx @@ -73,7 +73,7 @@ sal_Int32 StyleContainer::impl_getStyleId( const Style& rStyle, bool bSubStyle ) return nRet; } -sal_Int32 StyleContainer::getStandardStyleId( const OString& rName ) +sal_Int32 StyleContainer::getStandardStyleId( std::string_view rName ) { PropertyMap aProps; aProps[ "style:family" ] = OStringToOUString( rName, RTL_TEXTENCODING_UTF8 ); diff --git a/sdext/source/pdfimport/tree/style.hxx b/sdext/source/pdfimport/tree/style.hxx index ee7cafeabc93..784249a114c4 100644 --- a/sdext/source/pdfimport/tree/style.hxx +++ b/sdext/source/pdfimport/tree/style.hxx @@ -22,6 +22,7 @@ #include <pdfihelper.hxx> #include <numeric> +#include <string_view> #include <unordered_map> #include <vector> #include <rtl/ustring.hxx> @@ -151,7 +152,7 @@ namespace pdfi sal_Int32 impl_getStyleId( const Style& rStyle, bool bSubStyle ); sal_Int32 getStyleId( const Style& rStyle ) { return impl_getStyleId( rStyle, false ); } - sal_Int32 getStandardStyleId( const OString& rFamily ); + sal_Int32 getStandardStyleId( std::string_view rFamily ); // returns NULL for an invalid style id const PropertyMap* getProperties( sal_Int32 nStyleId ) const; diff --git a/sdext/source/pdfimport/wrapper/wrapper.cxx b/sdext/source/pdfimport/wrapper/wrapper.cxx index aba48b11a053..1b9a6c18af97 100644 --- a/sdext/source/pdfimport/wrapper/wrapper.cxx +++ b/sdext/source/pdfimport/wrapper/wrapper.cxx @@ -59,6 +59,7 @@ #include <vcl/virdev.hxx> #include <memory> +#include <string_view> #include <unordered_map> #include <string.h> #include <stdlib.h> @@ -890,7 +891,7 @@ void Parser::parseLine( const OString& rLine ) } // namespace -static bool checkEncryption( const OUString& i_rPath, +static bool checkEncryption( std::u16string_view i_rPath, const uno::Reference< task::XInteractionHandler >& i_xIHdl, OUString& io_rPwd, bool& o_rIsEncrypted, diff --git a/sfx2/source/bastyp/fltfnc.cxx b/sfx2/source/bastyp/fltfnc.cxx index 39a4d8ff48a6..7d45c06ba176 100644 --- a/sfx2/source/bastyp/fltfnc.cxx +++ b/sfx2/source/bastyp/fltfnc.cxx @@ -788,9 +788,9 @@ IMPL_LINK( SfxFilterMatcher, MaybeFileHdl_Impl, OUString*, pString, bool ) { std::shared_ptr<const SfxFilter> pFilter = GetFilter4Extension( *pString ); return pFilter && - !pFilter->GetWildcard().Matches("") && - !pFilter->GetWildcard().Matches("*.*") && - !pFilter->GetWildcard().Matches("*"); + !pFilter->GetWildcard().Matches(u"") && + !pFilter->GetWildcard().Matches(u"*.*") && + !pFilter->GetWildcard().Matches(u"*"); } diff --git a/sfx2/source/bastyp/mieclip.cxx b/sfx2/source/bastyp/mieclip.cxx index 83920a1752ad..ae3a2d5e5684 100644 --- a/sfx2/source/bastyp/mieclip.cxx +++ b/sfx2/source/bastyp/mieclip.cxx @@ -56,7 +56,7 @@ SvStream* MSE40HTMLClipFormatObj::IsValid( SvStream& rStream ) else if (sTmp == "EndFragment") nFragEnd = sLine.copy(nIndex).toInt32(); else if (sTmp == "SourceURL") - sBaseURL = OStringToOUString( sLine.copy(nIndex), RTL_TEXTENCODING_UTF8 ); + sBaseURL = OStringToOUString( sLine.subView(nIndex), RTL_TEXTENCODING_UTF8 ); if (nEnd >= 0 && nStt >= 0 && (!sBaseURL.isEmpty() || rStream.Tell() >= o3tl::make_unsigned(nStt))) diff --git a/sfx2/source/control/emojiview.cxx b/sfx2/source/control/emojiview.cxx index 63aa9ac602c9..78b7dc96c19f 100644 --- a/sfx2/source/control/emojiview.cxx +++ b/sfx2/source/control/emojiview.cxx @@ -21,6 +21,7 @@ #include <orcus/config.hpp> #include <orcus/pstring.hpp> #include <string> +#include <string_view> #include <fstream> using namespace ::com::sun::star; @@ -66,7 +67,7 @@ EmojiView::EmojiView(std::unique_ptr<weld::ScrolledWindow> xWindow) // locate json data file OUString sPath("$BRAND_BASE_DIR/" LIBO_SHARE_FOLDER "/emojiconfig/emoji.json"); rtl::Bootstrap::expandMacros(sPath); - std::string strPath = OUStringToOString(sPath.copy(strlen("file://")), RTL_TEXTENCODING_UTF8).getStr(); + std::string strPath = OUStringToOString(sPath.subView(strlen("file://")), RTL_TEXTENCODING_UTF8).getStr(); std::ifstream file(strPath); if(!file.is_open()) @@ -139,15 +140,15 @@ void EmojiView::Populate() // get values of parameters in AppendItem() function if(emojiParam == "unicode") { - sTitle = OStringToOUString(OString( prop.string_value().get(), prop.string_value().size() ), RTL_TEXTENCODING_UTF8); + sTitle = OStringToOUString(std::string_view( prop.string_value().get(), prop.string_value().size() ), RTL_TEXTENCODING_UTF8); } else if(emojiParam == "category") { - sCategory = OStringToOUString(OString( prop.string_value().get(), prop.string_value().size() ), RTL_TEXTENCODING_UTF8); + sCategory = OStringToOUString(std::string_view( prop.string_value().get(), prop.string_value().size() ), RTL_TEXTENCODING_UTF8); } else if(emojiParam == "name") { - sName = OStringToOUString(OString( prop.string_value().get(), prop.string_value().size() ), RTL_TEXTENCODING_UTF8); + sName = OStringToOUString(std::string_view( prop.string_value().get(), prop.string_value().size() ), RTL_TEXTENCODING_UTF8); } else if(emojiParam == "duplicate") { diff --git a/sfx2/source/doc/DocumentMetadataAccess.cxx b/sfx2/source/doc/DocumentMetadataAccess.cxx index 730c64e28cb0..0a931f4088ef 100644 --- a/sfx2/source/doc/DocumentMetadataAccess.cxx +++ b/sfx2/source/doc/DocumentMetadataAccess.cxx @@ -75,7 +75,7 @@ using namespace ::com::sun::star; namespace sfx2 { -bool isValidNCName(OUString const & i_rIdref) +bool isValidNCName(std::u16string_view i_rIdref) { const OString id( OUStringToOString(i_rIdref, RTL_TEXTENCODING_UTF8) ); @@ -101,7 +101,7 @@ static bool isStylesFile (OUString const & i_rPath) } bool isValidXmlId(OUString const & i_rStreamName, - OUString const & i_rIdref) + std::u16string_view i_rIdref) { return isValidNCName(i_rIdref) && (isContentFile(i_rStreamName) || isStylesFile(i_rStreamName)); diff --git a/sfx2/source/doc/docfilt.cxx b/sfx2/source/doc/docfilt.cxx index 18f38d422ffe..696792ff8ece 100644 --- a/sfx2/source/doc/docfilt.cxx +++ b/sfx2/source/doc/docfilt.cxx @@ -43,7 +43,7 @@ SfxFilter::SfxFilter( const OUString& rProvider, const OUString &rFilterName ) : } SfxFilter::SfxFilter( const OUString &rName, - const OUString &rWildCard, + std::u16string_view rWildCard, SfxFilterFlags nType, SotClipboardFormatId lFmt, const OUString &rTypNm, @@ -71,7 +71,7 @@ SfxFilter::SfxFilter( const OUString &rName, // truncate to first empty extension if (aExts[0]==';') { - aWildCard.setGlob(""); + aWildCard.setGlob(u""); return; } const sal_Int32 nIdx{ aExts.indexOf(";;") }; @@ -80,7 +80,7 @@ SfxFilter::SfxFilter( const OUString &rName, else if (aExts[nLen-1]==';') --nLen; if (nLen<aExts.getLength()) - aWildCard.setGlob(aExts.copy(0, nLen)); + aWildCard.setGlob(aExts.subView(0, nLen)); } SfxFilter::~SfxFilter() diff --git a/sfx2/source/doc/doctempl.cxx b/sfx2/source/doc/doctempl.cxx index b57c11d98847..31aac23c905e 100644 --- a/sfx2/source/doc/doctempl.cxx +++ b/sfx2/source/doc/doctempl.cxx @@ -119,7 +119,7 @@ public: void SetTargetURL( const OUString& rURL ) { maTargetURL = rURL; } void SetHierarchyURL( const OUString& rURL) { maOwnURL = rURL; } - int Compare( const OUString& rTitle ) const; + int Compare( std::u16string_view rTitle ) const; }; } @@ -138,7 +138,7 @@ class RegionData_Impl OUString maOwnURL; private: - size_t GetEntryPos( const OUString& rTitle, + size_t GetEntryPos( std::u16string_view rTitle, bool& rFound ) const; public: @@ -148,7 +148,7 @@ public: void SetHierarchyURL( const OUString& rURL) { maOwnURL = rURL; } DocTempl_EntryData_Impl* GetEntry( size_t nIndex ) const; - DocTempl_EntryData_Impl* GetEntry( const OUString& rName ) const; + DocTempl_EntryData_Impl* GetEntry( std::u16string_view rName ) const; const OUString& GetTitle() const { return maTitle; } const OUString& GetHierarchyURL(); @@ -1090,7 +1090,7 @@ bool SfxDocumentTemplates::SetName( const OUString& rName, sal_uInt16 nRegion, s bool SfxDocumentTemplates::GetFull ( std::u16string_view rRegion, // Region Name - const OUString &rName, // Template Name + std::u16string_view rName, // Template Name OUString &rPath // Out: Path + File name ) @@ -1112,7 +1112,7 @@ bool SfxDocumentTemplates::GetFull DocTemplLocker_Impl aLocker( *pImp ); // We don't search for empty names! - if ( rName.isEmpty() ) + if ( rName.empty() ) return false; if ( ! pImp->Construct() ) @@ -1249,7 +1249,7 @@ DocTempl_EntryData_Impl::DocTempl_EntryData_Impl( RegionData_Impl* pParent, } -int DocTempl_EntryData_Impl::Compare( const OUString& rTitle ) const +int DocTempl_EntryData_Impl::Compare( std::u16string_view rTitle ) const { return maTitle.compareTo( rTitle ); } @@ -1301,7 +1301,7 @@ RegionData_Impl::RegionData_Impl( const SfxDocTemplate_Impl* pParent, } -size_t RegionData_Impl::GetEntryPos( const OUString& rTitle, bool& rFound ) const +size_t RegionData_Impl::GetEntryPos( std::u16string_view rTitle, bool& rFound ) const { const size_t nCount = maEntries.size(); @@ -1378,7 +1378,7 @@ const OUString& RegionData_Impl::GetHierarchyURL() } -DocTempl_EntryData_Impl* RegionData_Impl::GetEntry( const OUString& rName ) const +DocTempl_EntryData_Impl* RegionData_Impl::GetEntry( std::u16string_view rName ) const { bool bFound = false; tools::Long nPos = GetEntryPos( rName, bFound ); diff --git a/sfx2/source/doc/objmisc.cxx b/sfx2/source/doc/objmisc.cxx index f94b66df540f..8e5fbd4df93d 100644 --- a/sfx2/source/doc/objmisc.cxx +++ b/sfx2/source/doc/objmisc.cxx @@ -963,7 +963,7 @@ void SfxObjectShell::CheckEncryption_Impl( const uno::Reference< task::XInteract { } - if ( aVersion.compareTo( ODFVER_012_TEXT ) < 0 ) + if ( aVersion.compareTo( u"" ODFVER_012_TEXT ) < 0 ) return; // this is ODF1.2 or later diff --git a/sfx2/source/doc/objserv.cxx b/sfx2/source/doc/objserv.cxx index 226321744a26..d0af3586b80f 100644 --- a/sfx2/source/doc/objserv.cxx +++ b/sfx2/source/doc/objserv.cxx @@ -1769,7 +1769,7 @@ bool SfxObjectShell::PrepareForSigning(weld::Window* pDialogParent) OUString aODFVersion(comphelper::OStorageHelper::GetODFVersionFromStorage(GetStorage())); if ( IsModified() || !GetMedium() || GetMedium()->GetName().isEmpty() - || (GetMedium()->GetFilter()->IsOwnFormat() && aODFVersion.compareTo(ODFVER_012_TEXT) < 0 && !bHasSign)) + || (GetMedium()->GetFilter()->IsOwnFormat() && aODFVersion.compareTo(u"" ODFVER_012_TEXT) < 0 && !bHasSign)) { // the document might need saving ( new, modified or in ODF1.1 format without signature ) @@ -1951,7 +1951,7 @@ bool SfxObjectShell::SignDocumentContentUsingCertificate(const Reference<XCertif OUString aODFVersion(comphelper::OStorageHelper::GetODFVersionFromStorage(GetStorage())); if (IsModified() || !GetMedium() || GetMedium()->GetName().isEmpty() - || (GetMedium()->GetFilter()->IsOwnFormat() && aODFVersion.compareTo(ODFVER_012_TEXT) < 0 && !bHasSign)) + || (GetMedium()->GetFilter()->IsOwnFormat() && aODFVersion.compareTo(u"" ODFVER_012_TEXT) < 0 && !bHasSign)) { if (nVersion >= SvtSaveOptions::ODFSVER_012) { diff --git a/sfx2/source/doc/objstor.cxx b/sfx2/source/doc/objstor.cxx index d5803e1b0029..9bc9c17e4628 100644 --- a/sfx2/source/doc/objstor.cxx +++ b/sfx2/source/doc/objstor.cxx @@ -1198,7 +1198,7 @@ bool SfxObjectShell::SaveTo_Impl // document, but technically this is not correct, so this prevents old // signatures to be copied over to a version 1.2 document bNoPreserveForOasis = ( - (0 <= aODFVersion.compareTo(ODFVER_012_TEXT) && nVersion < SvtSaveOptions::ODFSVER_012) || + (0 <= aODFVersion.compareTo(u"" ODFVER_012_TEXT) && nVersion < SvtSaveOptions::ODFSVER_012) || (aODFVersion.isEmpty() && nVersion >= SvtSaveOptions::ODFSVER_012) ); } diff --git a/sfx2/source/doc/oleprops.cxx b/sfx2/source/doc/oleprops.cxx index 65145a21a96d..796ce0d5227a 100644 --- a/sfx2/source/doc/oleprops.cxx +++ b/sfx2/source/doc/oleprops.cxx @@ -303,7 +303,7 @@ OUString SfxOleStringHelper::ImplLoadString16( SvStream& rStrm ) return aValue; } -void SfxOleStringHelper::ImplSaveString8( SvStream& rStrm, const OUString& rValue ) const +void SfxOleStringHelper::ImplSaveString8( SvStream& rStrm, std::u16string_view rValue ) const { // encode to byte string OString aEncoded(OUStringToOString(rValue, GetTextEncoding())); diff --git a/sfx2/source/doc/oleprops.hxx b/sfx2/source/doc/oleprops.hxx index 66b4e1c7d1aa..81eb744eab89 100644 --- a/sfx2/source/doc/oleprops.hxx +++ b/sfx2/source/doc/oleprops.hxx @@ -22,6 +22,8 @@ #include <map> #include <memory> +#include <string_view> + #include <osl/thread.h> #include <rtl/ustring.hxx> #include <sot/storage.hxx> @@ -152,7 +154,7 @@ public: private: OUString ImplLoadString8( SvStream& rStrm ) const; static OUString ImplLoadString16( SvStream& rStrm ); - void ImplSaveString8( SvStream& rStrm, const OUString& rValue ) const; + void ImplSaveString8( SvStream& rStrm, std::u16string_view rValue ) const; static void ImplSaveString16( SvStream& rStrm, const OUString& rValue ); }; diff --git a/sfx2/source/doc/templatedlg.cxx b/sfx2/source/doc/templatedlg.cxx index 0bfbe7ba2484..fcf651bafb05 100644 --- a/sfx2/source/doc/templatedlg.cxx +++ b/sfx2/source/doc/templatedlg.cxx @@ -538,7 +538,7 @@ IMPL_LINK(SfxTemplateManagerDlg, MenuSelectHdl, const OString&, rIdent, void) DefaultTemplateMenuSelectHdl(rIdent); } -void SfxTemplateManagerDlg::DefaultTemplateMenuSelectHdl(const OString& rIdent) +void SfxTemplateManagerDlg::DefaultTemplateMenuSelectHdl(std::string_view rIdent) { OUString aServiceName = SfxObjectShell::GetServiceNameFromFactory(OUString::fromUtf8(rIdent)); diff --git a/sfx2/source/view/lokhelper.cxx b/sfx2/source/view/lokhelper.cxx index 38bd2445e747..44af64e02016 100644 --- a/sfx2/source/view/lokhelper.cxx +++ b/sfx2/source/view/lokhelper.cxx @@ -456,7 +456,7 @@ void SfxLokHelper::sendUnoStatus(const SfxViewShell* pShell, const SfxPoolItem* void SfxLokHelper::notifyWindow(const SfxViewShell* pThisView, vcl::LOKWindowId nLOKWindowId, - const OUString& rAction, + std::u16string_view rAction, const std::vector<vcl::LOKPayloadItem>& rPayload) { assert(pThisView != nullptr && "pThisView must be valid"); diff --git a/shell/source/sessioninstall/SyncDbusSessionHelper.cxx b/shell/source/sessioninstall/SyncDbusSessionHelper.cxx index 9b11b2f6f498..df2ef3529145 100644 --- a/shell/source/sessioninstall/SyncDbusSessionHelper.cxx +++ b/shell/source/sessioninstall/SyncDbusSessionHelper.cxx @@ -12,6 +12,7 @@ #include <cppuhelper/supportsservice.hxx> #include <gio/gio.h> #include <memory> +#include <string_view> #include <vector> using namespace ::com::sun::star::lang; @@ -37,7 +38,7 @@ namespace } GError*& getRef() { return m_pError; } }; - GDBusProxy* lcl_GetPackageKitProxy(const OUString& sInterface) + GDBusProxy* lcl_GetPackageKitProxy(std::u16string_view sInterface) { const OString sFullInterface = "org.freedesktop.PackageKit." + OUStringToOString(sInterface, RTL_TEXTENCODING_ASCII_US); GDBusProxy* proxy = nullptr; @@ -66,7 +67,7 @@ namespace void request( char const * method, css::uno::Sequence<OUString> const & resources, - OUString const & interaction) + std::u16string_view interaction) { // Keep strings alive until after call to g_dbus_proxy_call_sync std::vector<OString> resUtf8; @@ -79,7 +80,7 @@ void request( } auto iactUtf8(OUStringToOString(interaction, RTL_TEXTENCODING_UTF8)); std::shared_ptr<GDBusProxy> proxy( - lcl_GetPackageKitProxy("Modify2"), GObjectDeleter<GDBusProxy>()); + lcl_GetPackageKitProxy(u"Modify2"), GObjectDeleter<GDBusProxy>()); GErrorWrapper error; std::shared_ptr<GVariant> result(g_dbus_proxy_call_sync( proxy.get(), method, @@ -182,7 +183,7 @@ void SAL_CALL SyncDbusSessionHelper::IsInstalled( const OUString& sPackagename, { const OString sPackagenameAscii = OUStringToOString(sPackagename, RTL_TEXTENCODING_ASCII_US); const OString sInteractionAscii = OUStringToOString(sInteraction, RTL_TEXTENCODING_ASCII_US); - std::shared_ptr<GDBusProxy> proxy(lcl_GetPackageKitProxy("Query"), GObjectDeleter<GDBusProxy>()); + std::shared_ptr<GDBusProxy> proxy(lcl_GetPackageKitProxy(u"Query"), GObjectDeleter<GDBusProxy>()); GErrorWrapper error; std::shared_ptr<GVariant> result(g_dbus_proxy_call_sync (proxy.get(), "IsInstalled", diff --git a/shell/source/tools/lngconvex/lngconvex.cxx b/shell/source/tools/lngconvex/lngconvex.cxx index 7385ad25b531..fc81964494f0 100644 --- a/shell/source/tools/lngconvex/lngconvex.cxx +++ b/shell/source/tools/lngconvex/lngconvex.cxx @@ -51,6 +51,7 @@ typedef unsigned short WORD; #include <map> #include <iterator> #include <string> +#include <string_view> #ifndef _WIN32 #include <cstring> @@ -70,11 +71,11 @@ void ShowUsage() std::cout << "-rcf Name of the resource file footer" << std::endl; } -OUString OStringToOUString(const OString& str) -{ return OStringToOUString(str, osl_getThreadTextEncoding()); } +OUString OStringToOUString(std::string_view str) +{ return rtl::OStringToOUString(str, osl_getThreadTextEncoding()); } -OString OUStringToOString(const OUString& str) -{ return OUStringToOString(str, osl_getThreadTextEncoding()); } +OString OUStringToOString(std::u16string_view str) +{ return rtl::OUStringToOString(str, osl_getThreadTextEncoding()); } /** Get the directory where the module is located as system directory, the diff --git a/starmath/source/ooxmlexport.cxx b/starmath/source/ooxmlexport.cxx index a915596b67a2..d7698e2c5aba 100644 --- a/starmath/source/ooxmlexport.cxx +++ b/starmath/source/ooxmlexport.cxx @@ -217,7 +217,7 @@ void SmOoxmlExport::HandleAttribute( const SmAttributNode* pNode, int nLevel ) m_pSerializer->startElementNS(XML_m, XML_acc); m_pSerializer->startElementNS(XML_m, XML_accPr); OString value = OUStringToOString( - OUString( pNode->Attribute()->GetToken().cMathChar ), RTL_TEXTENCODING_UTF8 ); + OUStringChar( pNode->Attribute()->GetToken().cMathChar ), RTL_TEXTENCODING_UTF8 ); m_pSerializer->singleElementNS(XML_m, XML_chr, FSNS(XML_m, XML_val), value); m_pSerializer->endElementNS( XML_m, XML_accPr ); m_pSerializer->startElementNS(XML_m, XML_e); @@ -286,7 +286,7 @@ static OString mathSymbolToString( const SmNode* node ) const SmTextNode* txtnode = static_cast< const SmTextNode* >( node ); assert( txtnode->GetText().getLength() == 1 ); sal_Unicode chr = SmTextNode::ConvertSymbolToUnicode( txtnode->GetText()[0] ); - return OUStringToOString( OUString( chr ), RTL_TEXTENCODING_UTF8 ); + return OUStringToOString( OUStringChar( chr ), RTL_TEXTENCODING_UTF8 ); } void SmOoxmlExport::HandleOperator( const SmOperNode* pNode, int nLevel ) diff --git a/svl/source/misc/PasswordHelper.cxx b/svl/source/misc/PasswordHelper.cxx index 5f2e286e1ef5..617aeafdae1b 100644 --- a/svl/source/misc/PasswordHelper.cxx +++ b/svl/source/misc/PasswordHelper.cxx @@ -25,7 +25,7 @@ using namespace com::sun::star; -void SvPasswordHelper::GetHashPasswordSHA256(uno::Sequence<sal_Int8>& rPassHash, OUString const& rPassword) +void SvPasswordHelper::GetHashPasswordSHA256(uno::Sequence<sal_Int8>& rPassHash, std::u16string_view rPassword) { OString const tmp(OUStringToOString(rPassword, RTL_TEXTENCODING_UTF8)); ::std::vector<unsigned char> const hash(::comphelper::Hash::calculateHash( @@ -36,7 +36,7 @@ void SvPasswordHelper::GetHashPasswordSHA256(uno::Sequence<sal_Int8>& rPassHash, rtl_secureZeroMemory(const_cast<char *>(tmp.getStr()), tmp.getLength()); } -void SvPasswordHelper::GetHashPasswordSHA1UTF8(uno::Sequence<sal_Int8>& rPassHash, OUString const& rPassword) +void SvPasswordHelper::GetHashPasswordSHA1UTF8(uno::Sequence<sal_Int8>& rPassHash, std::u16string_view rPassword) { OString const tmp(OUStringToOString(rPassword, RTL_TEXTENCODING_UTF8)); ::std::vector<unsigned char> const hash(::comphelper::Hash::calculateHash( diff --git a/svl/source/misc/inettype.cxx b/svl/source/misc/inettype.cxx index 8b2ef3c3d7cc..fb98646a2aef 100644 --- a/svl/source/misc/inettype.cxx +++ b/svl/source/misc/inettype.cxx @@ -318,7 +318,7 @@ INetContentType INetContentTypes::GetContentTypeFromURL(OUString const & rURL) if (aToken.equalsIgnoreAsciiCase(INETTYPE_URL_PROT_FILE)) if (rURL[ rURL.getLength() - 1 ] == '/') // folder if (rURL.getLength() > RTL_CONSTASCII_LENGTH("file:///")) - if (WildCard("*/{*}/").Matches(rURL)) // special folder + if (WildCard(u"*/{*}/").Matches(rURL)) // special folder eTypeID = CONTENT_TYPE_X_CNT_FSYSSPECIALFOLDER; else // drive? -> "file:///?|/" diff --git a/svl/source/passwordcontainer/passwordcontainer.cxx b/svl/source/passwordcontainer/passwordcontainer.cxx index bf38dce64904..c5ad78d65106 100644 --- a/svl/source/passwordcontainer/passwordcontainer.cxx +++ b/svl/source/passwordcontainer/passwordcontainer.cxx @@ -17,6 +17,9 @@ * the License at http://www.apache.org/licenses/LICENSE-2.0 . */ +#include <sal/config.h> + +#include <string_view> #include "passwordcontainer.hxx" @@ -76,7 +79,7 @@ static OUString createIndex(const std::vector< OUString >& lines) } -static std::vector< OUString > getInfoFromInd( const OUString& aInd ) +static std::vector< OUString > getInfoFromInd( std::u16string_view aInd ) { std::vector< OUString > aResult; bool aStart = true; diff --git a/svtools/qa/unit/testHtmlWriter.cxx b/svtools/qa/unit/testHtmlWriter.cxx index a041c24b8567..601287342c4b 100644 --- a/svtools/qa/unit/testHtmlWriter.cxx +++ b/svtools/qa/unit/testHtmlWriter.cxx @@ -157,7 +157,7 @@ CPPUNIT_TEST_FIXTURE(Test, testAttributeValues) aHtml.prettyPrint(false); aHtml.start("abc"); aHtml.attribute("one", OString("one")); - aHtml.attribute("two", OUString("two")); + aHtml.attribute("two", u"two"); aHtml.attribute("three", sal_Int32(12)); aHtml.end(); diff --git a/svtools/source/control/ctrltool.cxx b/svtools/source/control/ctrltool.cxx index 8f07a60091c3..ac2332e3e1ec 100644 --- a/svtools/source/control/ctrltool.cxx +++ b/svtools/source/control/ctrltool.cxx @@ -832,7 +832,7 @@ FontSizeNames::FontSizeNames( LanguageType eLanguage ) } } -sal_Int32 FontSizeNames::Name2Size( const OUString& rName ) const +sal_Int32 FontSizeNames::Name2Size( std::u16string_view rName ) const { if ( mnElem ) { diff --git a/svtools/source/control/inettbc.cxx b/svtools/source/control/inettbc.cxx index 4990b07654f1..8637ba8d9b33 100644 --- a/svtools/source/control/inettbc.cxx +++ b/svtools/source/control/inettbc.cxx @@ -1131,7 +1131,7 @@ void FilterMatch::createWildCardFilterList(const OUString& _rFilterList,::std::v else { // no filter is given -> match all - _rFilters.emplace_back("*" ); + _rFilters.emplace_back(u"*" ); } } diff --git a/svtools/source/svhtml/HtmlWriter.cxx b/svtools/source/svhtml/HtmlWriter.cxx index 7414b40b15b5..ce398757b0d2 100644 --- a/svtools/source/svhtml/HtmlWriter.cxx +++ b/svtools/source/svhtml/HtmlWriter.cxx @@ -131,7 +131,7 @@ void HtmlWriter::attribute(const OString& aAttribute, const char* pValue) attribute(aAttribute, OString(pValue)); } -void HtmlWriter::attribute(const OString& aAttribute, const OUString& aValue) +void HtmlWriter::attribute(const OString& aAttribute, std::u16string_view aValue) { attribute(aAttribute, OUStringToOString(aValue, RTL_TEXTENCODING_UTF8)); } diff --git a/svtools/source/svhtml/htmlout.cxx b/svtools/source/svhtml/htmlout.cxx index 24ce5b50b98e..c148f49dc92f 100644 --- a/svtools/source/svhtml/htmlout.cxx +++ b/svtools/source/svhtml/htmlout.cxx @@ -789,7 +789,7 @@ SvStream& HTMLOutFuncs::Out_ImageMap( SvStream& rStream, SvStream& HTMLOutFuncs::OutScript( SvStream& rStrm, const OUString& rBaseURL, - const OUString& rSource, + std::u16string_view rSource, const OUString& rLanguage, ScriptType eScriptType, const OUString& rSrc, @@ -846,7 +846,7 @@ SvStream& HTMLOutFuncs::OutScript( SvStream& rStrm, rStrm.WriteOString( sOut.makeStringAndClear() ); - if( !rSource.isEmpty() || pSBLibrary || pSBModule ) + if( !rSource.empty() || pSBLibrary || pSBModule ) { rStrm.WriteCharPtr( SAL_NEWLINE_STRING ); @@ -877,7 +877,7 @@ SvStream& HTMLOutFuncs::OutScript( SvStream& rStrm, } } - if( !rSource.isEmpty() ) + if( !rSource.empty() ) { // we write the module in ANSI-charset, but with // the system new line. diff --git a/svtools/source/uno/wizard/unowizard.cxx b/svtools/source/uno/wizard/unowizard.cxx index b92c4afafdae..ea028304737a 100644 --- a/svtools/source/uno/wizard/unowizard.cxx +++ b/svtools/source/uno/wizard/unowizard.cxx @@ -17,6 +17,9 @@ * the License at http://www.apache.org/licenses/LICENSE-2.0 . */ +#include <sal/config.h> + +#include <string_view> #include "wizardshell.hxx" @@ -138,7 +141,7 @@ namespace { { } - OUString lcl_getHelpURL( const OString& sHelpId ) + OUString lcl_getHelpURL( std::string_view sHelpId ) { OUStringBuffer aBuffer; OUString aTmp( diff --git a/svx/source/customshapes/EnhancedCustomShapeFunctionParser.cxx b/svx/source/customshapes/EnhancedCustomShapeFunctionParser.cxx index 2ef6b040e6ce..acbcd00d5f73 100644 --- a/svx/source/customshapes/EnhancedCustomShapeFunctionParser.cxx +++ b/svx/source/customshapes/EnhancedCustomShapeFunctionParser.cxx @@ -1119,7 +1119,7 @@ const ParserContextSharedPtr& getParserContext() namespace EnhancedCustomShape { -std::shared_ptr<ExpressionNode> const & FunctionParser::parseFunction( const OUString& rFunction, const EnhancedCustomShape2d& rCustoShape ) +std::shared_ptr<ExpressionNode> const & FunctionParser::parseFunction( std::u16string_view rFunction, const EnhancedCustomShape2d& rCustoShape ) { // TODO(Q1): Check if a combination of the RTL_UNICODETOTEXT_FLAGS_* // gives better conversion robustness here (we might want to map space diff --git a/svx/source/dialog/signaturelinehelper.cxx b/svx/source/dialog/signaturelinehelper.cxx index 8890e142f35d..4728fc36f1fa 100644 --- a/svx/source/dialog/signaturelinehelper.cxx +++ b/svx/source/dialog/signaturelinehelper.cxx @@ -108,7 +108,7 @@ OUString getLocalizedDate() return rLocaleData.getDate(aDateTime); } -uno::Reference<graphic::XGraphic> importSVG(const OUString& rSVG) +uno::Reference<graphic::XGraphic> importSVG(std::u16string_view rSVG) { SvMemoryStream aSvgStream(4096, 4096); aSvgStream.WriteOString(OUStringToOString(rSVG, RTL_TEXTENCODING_UTF8)); diff --git a/svx/source/form/fmsrcimp.cxx b/svx/source/form/fmsrcimp.cxx index 56ca4c141a3e..b868e5069cb4 100644 --- a/svx/source/form/fmsrcimp.cxx +++ b/svx/source/form/fmsrcimp.cxx @@ -348,7 +348,7 @@ FmSearchEngine::SearchResult FmSearchEngine::SearchSpecial(bool _bSearchForNull, } -FmSearchEngine::SearchResult FmSearchEngine::SearchWildcard(const OUString& strExpression, sal_Int32& nFieldPos, +FmSearchEngine::SearchResult FmSearchEngine::SearchWildcard(std::u16string_view strExpression, sal_Int32& nFieldPos, FieldCollection::iterator& iterFieldLoop, const FieldCollection::iterator& iterBegin, const FieldCollection::iterator& iterEnd) { // memorize the start position diff --git a/svx/source/xml/xmlgrhlp.cxx b/svx/source/xml/xmlgrhlp.cxx index b9082b6325c2..7adb1981a738 100644 --- a/svx/source/xml/xmlgrhlp.cxx +++ b/svx/source/xml/xmlgrhlp.cxx @@ -467,7 +467,7 @@ OUString SvXMLGraphicHelper::ImplGetGraphicMimeType( const OUString& rFileName ) { if( ( rFileName.getLength() >= 4 ) && ( rFileName[ rFileName.getLength() - 4 ] == '.' ) ) { - const OString aExt(OUStringToOString(rFileName.copy(rFileName.getLength() - 3), + const OString aExt(OUStringToOString(rFileName.subView(rFileName.getLength() - 3), RTL_TEXTENCODING_ASCII_US)); return comphelper::GraphicMimeTypeHelper::GetMimeTypeForExtension( aExt ); } diff --git a/sw/inc/dbgoutsw.hxx b/sw/inc/dbgoutsw.hxx index ad78223c3f85..2d8af9972e21 100644 --- a/sw/inc/dbgoutsw.hxx +++ b/sw/inc/dbgoutsw.hxx @@ -25,6 +25,7 @@ #include <rtl/ustrbuf.hxx> #include "tox.hxx" #include <cstdio> +#include <string_view> #include <unordered_map> class SwContentNode; @@ -51,7 +52,7 @@ extern bool bDbgOutStdErr; extern bool bDbgOutPrintAttrSet; const char* dbg_out(const void* pVoid); -const char* dbg_out(const OUString& aStr); +const char* dbg_out(std::u16string_view aStr); const char* dbg_out(const SwRect& rRect); const char* dbg_out(const SwFrameFormat& rFrameFormat); SW_DLLPUBLIC const char* dbg_out(const SwNode& rNode); diff --git a/sw/source/core/doc/dbgoutsw.cxx b/sw/source/core/doc/dbgoutsw.cxx index a742754f6010..227ebbb82a36 100644 --- a/sw/source/core/doc/dbgoutsw.cxx +++ b/sw/source/core/doc/dbgoutsw.cxx @@ -82,7 +82,7 @@ const char * dbg_out(const void * pVoid) return dbg_out(aTmpStr); } -const char * dbg_out(const OUString & aStr) +const char * dbg_out(std::u16string_view aStr) { aDbgOutResult = OUStringToOString(aStr, RTL_TEXTENCODING_ASCII_US); diff --git a/sw/source/core/inc/SwXMLTextBlocks.hxx b/sw/source/core/inc/SwXMLTextBlocks.hxx index 17a6a5aa3869..456a4454941d 100644 --- a/sw/source/core/inc/SwXMLTextBlocks.hxx +++ b/sw/source/core/inc/SwXMLTextBlocks.hxx @@ -19,6 +19,10 @@ #pragma once +#include <sal/config.h> + +#include <string_view> + #include <sfx2/objsh.hxx> #include "swblocks.hxx" #include <o3tl/typed_flags_set.hxx> @@ -53,7 +57,7 @@ public: SwXMLTextBlocks( const css::uno::Reference < css::embed::XStorage >&, const OUString& rFile ); void AddName( const OUString&, const OUString&, const OUString&, bool bOnlyText ); virtual void AddName( const OUString&, const OUString&, bool bOnlyText = false ) override; - static OUString GeneratePackageName ( const OUString& rShort ); + static OUString GeneratePackageName ( std::u16string_view rShort ); virtual ~SwXMLTextBlocks() override; virtual ErrCode Delete( sal_uInt16 ) override; virtual ErrCode Rename( sal_uInt16, const OUString& ) override; @@ -70,7 +74,7 @@ public: static bool IsFileUCBStorage( const OUString & rFileName); // Methods for the new Autocorrecter - ErrCode GetText( const OUString& rShort, OUString& ); + ErrCode GetText( std::u16string_view rShort, OUString& ); virtual bool IsOnlyTextBlock( const OUString& rShort ) const override; bool IsOnlyTextBlock( sal_uInt16 nIdx ) const; @@ -85,7 +89,7 @@ public: //void SetDoc( SwDoc * pNewDoc); ErrCode StartPutBlock( const OUString& rShort, const OUString& rPackageName ); ErrCode PutBlock(); - ErrCode GetBlockText( const OUString& rShort, OUString& rText ); + ErrCode GetBlockText( std::u16string_view rShort, OUString& rText ); ErrCode PutBlockText( const OUString& rShort, const OUString& rText, const OUString& rPackageName ); void MakeBlockText( const OUString& rText ); }; diff --git a/sw/source/core/swg/SwXMLTextBlocks.cxx b/sw/source/core/swg/SwXMLTextBlocks.cxx index e5b95c13d091..a3b79e275535 100644 --- a/sw/source/core/swg/SwXMLTextBlocks.cxx +++ b/sw/source/core/swg/SwXMLTextBlocks.cxx @@ -341,7 +341,7 @@ ErrCode SwXMLTextBlocks::PutDoc() return nErr; } -ErrCode SwXMLTextBlocks::GetText( const OUString& rShort, OUString& rText ) +ErrCode SwXMLTextBlocks::GetText( std::u16string_view rShort, OUString& rText ) { return GetBlockText( rShort, rText ); } @@ -459,7 +459,7 @@ bool SwXMLTextBlocks::IsFileUCBStorage( const OUString & rFileName) return bRet; } -OUString SwXMLTextBlocks::GeneratePackageName ( const OUString& rShort ) +OUString SwXMLTextBlocks::GeneratePackageName ( std::u16string_view rShort ) { OString sByte(OUStringToOString(rShort, RTL_TEXTENCODING_UTF7)); OUStringBuffer aBuf(OStringToOUString(sByte, RTL_TEXTENCODING_ASCII_US)); diff --git a/sw/source/core/swg/SwXMLTextBlocks1.cxx b/sw/source/core/swg/SwXMLTextBlocks1.cxx index 638ecb60c7ce..122a0fbe6ffb 100644 --- a/sw/source/core/swg/SwXMLTextBlocks1.cxx +++ b/sw/source/core/swg/SwXMLTextBlocks1.cxx @@ -246,7 +246,7 @@ ErrCode SwXMLTextBlocks::GetMacroTable( sal_uInt16 nIdx, return ERRCODE_NONE; } -ErrCode SwXMLTextBlocks::GetBlockText( const OUString& rShort, OUString& rText ) +ErrCode SwXMLTextBlocks::GetBlockText( std::u16string_view rShort, OUString& rText ) { OUString aFolderName = GeneratePackageName ( rShort ); OUString aStreamName = aFolderName + ".xml"; diff --git a/sw/source/filter/html/htmlatr.cxx b/sw/source/filter/html/htmlatr.cxx index 2fab7232e5e0..cdbfae284ff8 100644 --- a/sw/source/filter/html/htmlatr.cxx +++ b/sw/source/filter/html/htmlatr.cxx @@ -2573,7 +2573,7 @@ Writer& OutHTML_SwTextNode( Writer& rWrt, const SwContentNode& rNode ) // dot leaders: print the skipped page number in a different span element if (nIndexTab > -1) { - OString sOut = OUStringToOString(rStr.copy(nIndexTab + 1), RTL_TEXTENCODING_ASCII_US); + OString sOut = OUStringToOString(rStr.subView(nIndexTab + 1), RTL_TEXTENCODING_ASCII_US); rWrt.Strm().WriteOString( "</span><span>" + sOut + "</span>" ); } diff --git a/sw/source/filter/html/htmlflywriter.cxx b/sw/source/filter/html/htmlflywriter.cxx index c382e116d4d3..e6cf6316474f 100644 --- a/sw/source/filter/html/htmlflywriter.cxx +++ b/sw/source/filter/html/htmlflywriter.cxx @@ -799,7 +799,7 @@ OString SwHTMLWriter::OutFrameFormatOptions( const SwFrameFormat &rFrameFormat, return sRetEndTags; } -void SwHTMLWriter::writeFrameFormatOptions(HtmlWriter& aHtml, const SwFrameFormat& rFrameFormat, const OUString& rAlternateText, HtmlFrmOpts nFrameOptions) +void SwHTMLWriter::writeFrameFormatOptions(HtmlWriter& aHtml, const SwFrameFormat& rFrameFormat, std::u16string_view rAlternateText, HtmlFrmOpts nFrameOptions) { bool bReplacement = (nFrameOptions & HtmlFrmOpts::Replacement) || mbReqIF; const SfxPoolItem* pItem; @@ -822,7 +822,7 @@ void SwHTMLWriter::writeFrameFormatOptions(HtmlWriter& aHtml, const SwFrameForma } // alt - if( (nFrameOptions & HtmlFrmOpts::Alt) && !rAlternateText.isEmpty() && !bReplacement ) + if( (nFrameOptions & HtmlFrmOpts::Alt) && !rAlternateText.empty() && !bReplacement ) { aHtml.attribute(OOO_STRING_SVTOOLS_HTML_O_alt, rAlternateText); } @@ -1420,7 +1420,7 @@ Writer& OutHTML_Image( Writer& rWrt, const SwFrameFormat &rFrameFormat, if( !aIMapName.isEmpty() ) { - aHtml.attribute(OOO_STRING_SVTOOLS_HTML_O_usemap, "#" + aIMapName); + aHtml.attribute(OOO_STRING_SVTOOLS_HTML_O_usemap, OUString("#" + aIMapName)); } if (bReplacement) diff --git a/sw/source/filter/html/wrthtml.cxx b/sw/source/filter/html/wrthtml.cxx index 2071271e580c..7d95066ef5b4 100644 --- a/sw/source/filter/html/wrthtml.cxx +++ b/sw/source/filter/html/wrthtml.cxx @@ -1470,7 +1470,7 @@ sal_Int32 SwHTMLWriter::indexOfDotLeaders( sal_uInt16 nPoolId, const OUString& r (nPoolId >= RES_POOLCOLL_TOX_AUTHORITIES1 && nPoolId <= RES_POOLCOLL_TOX_USER10))) { sal_Int32 i = rStr.lastIndexOf('\t'); // there are only ASCII (Latin-1) characters after the tabulator - if (i > -1 && OUStringToOString(rStr.copy(i + 1), RTL_TEXTENCODING_ASCII_US).indexOf('?') == -1) + if (i > -1 && OUStringToOString(rStr.subView(i + 1), RTL_TEXTENCODING_ASCII_US).indexOf('?') == -1) return i; } return -1; diff --git a/sw/source/filter/html/wrthtml.hxx b/sw/source/filter/html/wrthtml.hxx index e2a1c1d30c85..e5806da8fc97 100644 --- a/sw/source/filter/html/wrthtml.hxx +++ b/sw/source/filter/html/wrthtml.hxx @@ -22,6 +22,7 @@ #include <memory> #include <vector> #include <set> +#include <string_view> #include <map> #include <com/sun/star/container/XIndexContainer.hpp> @@ -481,7 +482,7 @@ public: OString OutFrameFormatOptions( const SwFrameFormat& rFrameFormat, const OUString& rAltText, HtmlFrmOpts nFrameOpts ); - void writeFrameFormatOptions(HtmlWriter& aHtml, const SwFrameFormat& rFrameFormat, const OUString& rAltText, HtmlFrmOpts nFrameOpts); + void writeFrameFormatOptions(HtmlWriter& aHtml, const SwFrameFormat& rFrameFormat, std::u16string_view rAltText, HtmlFrmOpts nFrameOpts); void OutCSS1_TableFrameFormatOptions( const SwFrameFormat& rFrameFormat ); void OutCSS1_TableCellBorderHack(const SwFrameFormat& rFrameFormat); diff --git a/sw/source/filter/ww8/docxattributeoutput.cxx b/sw/source/filter/ww8/docxattributeoutput.cxx index e047d6ec54d8..cd2af8bc8859 100644 --- a/sw/source/filter/ww8/docxattributeoutput.cxx +++ b/sw/source/filter/ww8/docxattributeoutput.cxx @@ -1976,7 +1976,7 @@ void DocxAttributeOutput::WriteSdtEnd() } void DocxAttributeOutput::WriteSdtDropDownStart( - OUString const& rName, + std::u16string_view rName, OUString const& rSelected, uno::Sequence<OUString> const& rListItems) { @@ -2856,7 +2856,7 @@ static bool impl_WriteRunText( FSHelperPtr const & pSerializer, sal_Int32 nTextT else pSerializer->startElementNS(XML_w, nTextToken); - pSerializer->writeEscaped( OUString( pBegin, pEnd - pBegin ) ); + pSerializer->writeEscaped( std::u16string_view( pBegin, pEnd - pBegin ) ); pSerializer->endElementNS( XML_w, nTextToken ); @@ -4520,7 +4520,7 @@ void DocxAttributeOutput::StartStyles() LatentStyles(); } -sal_Int32 DocxStringGetToken(DocxStringTokenMap const * pMap, const OUString& rName) +sal_Int32 DocxStringGetToken(DocxStringTokenMap const * pMap, std::u16string_view rName) { OString sName = OUStringToOString(rName, RTL_TEXTENCODING_UTF8); while (pMap->pToken) diff --git a/sw/source/filter/ww8/docxattributeoutput.hxx b/sw/source/filter/ww8/docxattributeoutput.hxx index cfc6eae89f12..9a219d56cc16 100644 --- a/sw/source/filter/ww8/docxattributeoutput.hxx +++ b/sw/source/filter/ww8/docxattributeoutput.hxx @@ -21,6 +21,7 @@ #define INCLUDED_SW_SOURCE_FILTER_WW8_DOCXATTRIBUTEOUTPUT_HXX #include <memory> +#include <string_view> #include "attributeoutputbase.hxx" #include "fields.hxx" @@ -723,7 +724,7 @@ private: void EndSdtBlock(); void WriteFormDateStart(const OUString& sFullDate, const OUString& sDateFormat, const OUString& sLang); - void WriteSdtDropDownStart(OUString const& rName, OUString const& rSelected, uno::Sequence<OUString> const& rListItems); + void WriteSdtDropDownStart(std::u16string_view rName, OUString const& rSelected, uno::Sequence<OUString> const& rListItems); void WriteSdtDropDownEnd(OUString const& rSelected, uno::Sequence<OUString> const& rListItems); void WriteSdtEnd(); diff --git a/sw/source/filter/ww8/docxhelper.hxx b/sw/source/filter/ww8/docxhelper.hxx index 6133c6dfb8e0..e3f3609c615b 100644 --- a/sw/source/filter/ww8/docxhelper.hxx +++ b/sw/source/filter/ww8/docxhelper.hxx @@ -10,6 +10,10 @@ #ifndef INCLUDED_SW_SOURCE_FILTER_WW8_DOCXHELPER_HXX #define INCLUDED_SW_SOURCE_FILTER_WW8_DOCXHELPER_HXX +#include <sal/config.h> + +#include <string_view> + #include <rtl/ustring.hxx> struct DocxStringTokenMap @@ -18,7 +22,7 @@ struct DocxStringTokenMap sal_Int32 nToken; }; -sal_Int32 DocxStringGetToken(DocxStringTokenMap const* pMap, const OUString& rName); +sal_Int32 DocxStringGetToken(DocxStringTokenMap const* pMap, std::u16string_view rName); #endif // INCLUDED_SW_SOURCE_FILTER_WW8_DOCXHELPER_HXX diff --git a/sw/source/filter/ww8/wrtww8.cxx b/sw/source/filter/ww8/wrtww8.cxx index 5e54f9443c84..e325f331f6f0 100644 --- a/sw/source/filter/ww8/wrtww8.cxx +++ b/sw/source/filter/ww8/wrtww8.cxx @@ -1723,7 +1723,7 @@ void SwWW8Writer::InsAsString16(ww::bytes &rO, const OUString& rStr) SwWW8Writer::InsUInt16( rO, *pStr ); } -void SwWW8Writer::InsAsString8(ww::bytes &rO, const OUString& rStr, +void SwWW8Writer::InsAsString8(ww::bytes &rO, std::u16string_view rStr, rtl_TextEncoding eCodeSet) { OString sTmp(OUStringToOString(rStr, eCodeSet)); @@ -1756,7 +1756,7 @@ void SwWW8Writer::WriteString_xstz(SvStream& rStrm, const OUString& rStr, bool b rStrm.WriteBytes(aBytes.data(), aBytes.size()); } -void SwWW8Writer::WriteString8(SvStream& rStrm, const OUString& rStr, +void SwWW8Writer::WriteString8(SvStream& rStrm, std::u16string_view rStr, bool bAddZero, rtl_TextEncoding eCodeSet) { ww::bytes aBytes; diff --git a/sw/source/filter/ww8/wrtww8.hxx b/sw/source/filter/ww8/wrtww8.hxx index b72abe6aca2d..ebff8c9db442 100644 --- a/sw/source/filter/ww8/wrtww8.hxx +++ b/sw/source/filter/ww8/wrtww8.hxx @@ -47,6 +47,7 @@ #include <cstddef> #include <memory> #include <map> +#include <string_view> #include <vector> @@ -946,7 +947,7 @@ public: static void InsUInt16(ww::bytes &rO, sal_uInt16 n); static void InsUInt32(ww::bytes &rO, sal_uInt32 n); static void InsAsString16(ww::bytes &rO, const OUString& rStr); - static void InsAsString8(ww::bytes & O, const OUString& rStr, + static void InsAsString8(ww::bytes & O, std::u16string_view rStr, rtl_TextEncoding eCodeSet); static sal_uLong FillUntil( SvStream& rStrm, sal_uLong nEndPos = 0 ); @@ -960,7 +961,7 @@ public: static void WriteString16(SvStream& rStrm, const OUString& rStr, bool bAddZero); - static void WriteString8(SvStream& rStrm, const OUString& rStr, + static void WriteString8(SvStream& rStrm, std::u16string_view rStr, bool bAddZero, rtl_TextEncoding eCodeSet); static void WriteString_xstz(SvStream& rStrm, const OUString& rStr, bool bAddZero); diff --git a/sw/source/ui/index/cnttab.cxx b/sw/source/ui/index/cnttab.cxx index 9dd318322d01..7174fac03651 100644 --- a/sw/source/ui/index/cnttab.cxx +++ b/sw/source/ui/index/cnttab.cxx @@ -3841,7 +3841,7 @@ void SwEntryBrowseBox::WriteEntries(SvStream& rOutStr) AutoMarkEntry* pEntry = rpEntry.get(); if(!pEntry->sComment.isEmpty()) { - rOutStr.WriteByteStringLine( "#" + pEntry->sComment, eTEnc ); + rOutStr.WriteByteStringLine( OUString("#" + pEntry->sComment), eTEnc ); } OUString sWrite( pEntry->sSearch + ";" + diff --git a/test/source/screenshot_test.cxx b/test/source/screenshot_test.cxx index 82b9cccbb8e6..a99b01d37c2f 100644 --- a/test/source/screenshot_test.cxx +++ b/test/source/screenshot_test.cxx @@ -29,10 +29,10 @@ namespace { sal_Int32 nIndex = rHelpId.lastIndexOf( '/' ); if( nIndex > 0 ) - rDirname = OStringToOUString( rHelpId.copy( 0, nIndex ), RTL_TEXTENCODING_UTF8 ); + rDirname = OStringToOUString( rHelpId.subView( 0, nIndex ), RTL_TEXTENCODING_UTF8 ); if( rHelpId.getLength() > nIndex+1 ) - rBasename= OStringToOUString( rHelpId.copy( nIndex+1 ), RTL_TEXTENCODING_UTF8 ); + rBasename= OStringToOUString( rHelpId.subView( nIndex+1 ), RTL_TEXTENCODING_UTF8 ); } } @@ -197,9 +197,9 @@ void ScreenshotTest::dumpDialogToPath(weld::Builder& rBuilder) } } -void ScreenshotTest::dumpDialogToPath(const OString& rUIXMLDescription) +void ScreenshotTest::dumpDialogToPath(std::string_view rUIXMLDescription) { - if (rUIXMLDescription.isEmpty()) + if (rUIXMLDescription.empty()) return; bool bNonConforming = rUIXMLDescription == "modules/swriter/ui/sidebarstylepresets.ui" || diff --git a/testtools/source/bridgetest/bridgetest.cxx b/testtools/source/bridgetest/bridgetest.cxx index f02a6c99f4b9..16f9bd199b24 100644 --- a/testtools/source/bridgetest/bridgetest.cxx +++ b/testtools/source/bridgetest/bridgetest.cxx @@ -20,6 +20,8 @@ #include <stdio.h> #include <string.h> +#include <string_view> + #include <o3tl/any.hxx> #include <osl/diagnose.h> #include <osl/diagnose.hxx> @@ -89,8 +91,8 @@ static bool check( bool b , char const * message ) namespace { -bool checkEmpty(OUString const & string, char const * message) { - bool ok = string.isEmpty(); +bool checkEmpty(std::u16string_view string, char const * message) { + bool ok = string.empty(); if (!ok) { fprintf( stderr, "%s failed: %s\n", message, diff --git a/testtools/source/bridgetest/multi.cxx b/testtools/source/bridgetest/multi.cxx index ce149f154df4..4b98f92cdf22 100644 --- a/testtools/source/bridgetest/multi.cxx +++ b/testtools/source/bridgetest/multi.cxx @@ -27,6 +27,7 @@ #include <rtl/ustring.hxx> #include <sstream> +#include <string_view> namespace { @@ -43,7 +44,7 @@ template< typename T > void checkEqual(T const & value, T const & argument) { s << value << " != " << argument; throw CheckFailed( OStringToOUString( - OString(s.str().c_str()), RTL_TEXTENCODING_UTF8)); + std::string_view(s.str()), RTL_TEXTENCODING_UTF8)); } } diff --git a/toolkit/source/helper/property.cxx b/toolkit/source/helper/property.cxx index c3b67df41ac4..cdcba6f2dde0 100644 --- a/toolkit/source/helper/property.cxx +++ b/toolkit/source/helper/property.cxx @@ -34,6 +34,7 @@ #include <com/sun/star/graphic/XGraphic.hpp> #include <com/sun/star/container/XNameContainer.hpp> #include <algorithm> +#include <string_view> using ::com::sun::star::uno::Any; using ::com::sun::star::uno::Sequence; @@ -280,7 +281,7 @@ struct ImplPropertyInfoCompareFunctor { return lhs.aName.compareTo(rhs.aName) < 0; } - bool operator()(const ImplPropertyInfo& lhs,const OUString& rhs) const + bool operator()(const ImplPropertyInfo& lhs,std::u16string_view rhs) const { return lhs.aName.compareTo(rhs) < 0; } diff --git a/tools/source/fsys/wldcrd.cxx b/tools/source/fsys/wldcrd.cxx index bf5155dee88b..7608549665ca 100644 --- a/tools/source/fsys/wldcrd.cxx +++ b/tools/source/fsys/wldcrd.cxx @@ -86,7 +86,7 @@ bool WildCard::ImpMatch( const char *pWild, const char *pStr ) return ( *pStr == '\0' ) && ( *pWild == '\0' ); } -bool WildCard::Matches( const OUString& rString ) const +bool WildCard::Matches( std::u16string_view rString ) const { OString aTmpWild = aWildString; OString aString(OUStringToOString(rString, osl_getThreadTextEncoding())); diff --git a/tools/source/inet/inetmsg.cxx b/tools/source/inet/inetmsg.cxx index 3adf1ebd4487..bb8a700d16f1 100644 --- a/tools/source/inet/inetmsg.cxx +++ b/tools/source/inet/inetmsg.cxx @@ -82,7 +82,7 @@ static sal_uInt16 ParseMonth(const OString& rStr, sal_Int32& nIndex) } bool INetMIMEMessage::ParseDateField ( - const OUString& rDateFieldW, DateTime& rDateTime) + std::u16string_view rDateFieldW, DateTime& rDateTime) { OString aDateField(OUStringToOString(rDateFieldW, RTL_TEXTENCODING_ASCII_US)); @@ -272,7 +272,7 @@ void INetMIMEMessage::EnableAttachMultipartFormDataChild() // Set header fields. SetMIMEVersion("1.0"); SetContentType( - OUString::fromUtf8("multipart/form-data; boundary=" + m_aBoundary)); + "multipart/form-data; boundary=" + OUString::fromUtf8(m_aBoundary)); SetContentTransferEncoding("7bit"); } diff --git a/tools/source/stream/stream.cxx b/tools/source/stream/stream.cxx index 84dcef93bcd5..8448f5144af9 100644 --- a/tools/source/stream/stream.cxx +++ b/tools/source/stream/stream.cxx @@ -706,7 +706,7 @@ bool SvStream::WriteUnicodeOrByteText( const OUString& rStr, rtl_TextEncoding eD } } -bool SvStream::WriteByteStringLine( const OUString& rStr, rtl_TextEncoding eDestCharSet ) +bool SvStream::WriteByteStringLine( std::u16string_view rStr, rtl_TextEncoding eDestCharSet ) { return WriteLine(OUStringToOString(rStr, eDestCharSet)); } diff --git a/tools/source/xml/XmlWriter.cxx b/tools/source/xml/XmlWriter.cxx index eaea3d9c15e4..d05ec2203bc6 100644 --- a/tools/source/xml/XmlWriter.cxx +++ b/tools/source/xml/XmlWriter.cxx @@ -131,7 +131,7 @@ void XmlWriter::attribute(const OString& name, const OString& value) xmlFree(xmlName); } -void XmlWriter::attribute(const OString& name, const OUString& value) +void XmlWriter::attribute(const OString& name, std::u16string_view value) { attribute(name, OUStringToOString(value, RTL_TEXTENCODING_UTF8).getStr()); } @@ -153,7 +153,7 @@ void XmlWriter::content(const OString& sValue) xmlFree(xmlValue); } -void XmlWriter::content(const OUString& sValue) +void XmlWriter::content(std::u16string_view sValue) { content(OUStringToOString(sValue, RTL_TEXTENCODING_UTF8)); } diff --git a/ucb/source/ucp/cmis/cmis_content.cxx b/ucb/source/ucp/cmis/cmis_content.cxx index cf12bdd8409f..14cdb1bbddc7 100644 --- a/ucb/source/ucp/cmis/cmis_content.cxx +++ b/ucb/source/ucp/cmis/cmis_content.cxx @@ -1249,7 +1249,7 @@ namespace cmis } void Content::insert( const uno::Reference< io::XInputStream > & xInputStream, - bool bReplaceExisting, const OUString& rMimeType, + bool bReplaceExisting, std::u16string_view rMimeType, const uno::Reference< ucb::XCommandEnvironment >& xEnv ) { if ( !xInputStream.is() ) diff --git a/ucb/source/ucp/cmis/cmis_content.hxx b/ucb/source/ucp/cmis/cmis_content.hxx index 20f4bfe21a98..a0a301305473 100644 --- a/ucb/source/ucp/cmis/cmis_content.hxx +++ b/ucb/source/ucp/cmis/cmis_content.hxx @@ -10,6 +10,10 @@ #ifndef INCLUDED_UCB_SOURCE_UCP_CMIS_CMIS_CONTENT_HXX #define INCLUDED_UCB_SOURCE_UCP_CMIS_CMIS_CONTENT_HXX +#include <sal/config.h> + +#include <string_view> + #include "cmis_url.hxx" #include "children_provider.hxx" @@ -104,7 +108,7 @@ private: /// @throws css::uno::Exception void insert( const css::uno::Reference< css::io::XInputStream > & xInputStream, - bool bReplaceExisting, const OUString & rMimeType, + bool bReplaceExisting, std::u16string_view rMimeType, const css::uno::Reference< css::ucb::XCommandEnvironment >& xEnv ); /// @throws css::uno::Exception diff --git a/ucb/source/ucp/webdav-neon/DAVProperties.cxx b/ucb/source/ucp/webdav-neon/DAVProperties.cxx index d3ed70cbe94a..575385f5d2d8 100644 --- a/ucb/source/ucp/webdav-neon/DAVProperties.cxx +++ b/ucb/source/ucp/webdav-neon/DAVProperties.cxx @@ -43,7 +43,7 @@ void DAVProperties::createNeonPropName( const OUString & rFullName, rName.nspace = "DAV:"; rName.name = strdup( OUStringToOString( - rFullName.copy( RTL_CONSTASCII_LENGTH( "DAV:" ) ), + rFullName.subView( RTL_CONSTASCII_LENGTH( "DAV:" ) ), RTL_TEXTENCODING_UTF8 ).getStr() ); } else if ( rFullName.startsWith( "http://apache.org/dav/props/" ) ) @@ -51,7 +51,7 @@ void DAVProperties::createNeonPropName( const OUString & rFullName, rName.nspace = "http://apache.org/dav/props/"; rName.name = strdup( OUStringToOString( - rFullName.copy( + rFullName.subView( RTL_CONSTASCII_LENGTH( "http://apache.org/dav/props/" ) ), RTL_TEXTENCODING_UTF8 ).getStr() ); @@ -61,7 +61,7 @@ void DAVProperties::createNeonPropName( const OUString & rFullName, rName.nspace = "http://ucb.openoffice.org/dav/props/"; rName.name = strdup( OUStringToOString( - rFullName.copy( + rFullName.subView( RTL_CONSTASCII_LENGTH( "http://ucb.openoffice.org/dav/props/" ) ), RTL_TEXTENCODING_UTF8 ).getStr() ); diff --git a/ucb/source/ucp/webdav-neon/NeonLockStore.cxx b/ucb/source/ucp/webdav-neon/NeonLockStore.cxx index a4d25b4b1e31..c00f18627fa0 100644 --- a/ucb/source/ucp/webdav-neon/NeonLockStore.cxx +++ b/ucb/source/ucp/webdav-neon/NeonLockStore.cxx @@ -159,7 +159,7 @@ void NeonLockStore::registerSession( HttpSession * pHttpSession ) ne_lockstore_register( m_pNeonLockStore, pHttpSession ); } -NeonLock * NeonLockStore::findByUri( OUString const & rUri ) +NeonLock * NeonLockStore::findByUri( std::u16string_view rUri ) { osl::MutexGuard aGuard( m_aMutex ); diff --git a/ucb/source/ucp/webdav-neon/NeonLockStore.hxx b/ucb/source/ucp/webdav-neon/NeonLockStore.hxx index fa64cb320374..323a71ab1e6f 100644 --- a/ucb/source/ucp/webdav-neon/NeonLockStore.hxx +++ b/ucb/source/ucp/webdav-neon/NeonLockStore.hxx @@ -30,6 +30,7 @@ #include <config_lgpl.h> #include <map> +#include <string_view> #include <ne_locks.h> @@ -74,7 +75,7 @@ public: void registerSession( HttpSession * pHttpSession ); - NeonLock * findByUri( OUString const & rUri ); + NeonLock * findByUri( std::u16string_view rUri ); void addLock( NeonLock * pLock, rtl::Reference< NeonSession > const & xSession, diff --git a/ucbhelper/source/client/proxydecider.cxx b/ucbhelper/source/client/proxydecider.cxx index 3052cd34003e..2c24e3d232ad 100644 --- a/ucbhelper/source/client/proxydecider.cxx +++ b/ucbhelper/source/client/proxydecider.cxx @@ -17,6 +17,9 @@ * the License at http://www.apache.org/licenses/LICENSE-2.0 . */ +#include <sal/config.h> + +#include <string_view> #include <utility> #include <vector> #include <deque> @@ -71,12 +74,12 @@ private: OString m_aWildString; public: - explicit WildCard( const OUString& rWildCard ) + explicit WildCard( std::u16string_view rWildCard ) : m_aWildString( OUStringToOString( rWildCard, RTL_TEXTENCODING_UTF8 ).toAsciiLowerCase() ) {} - bool Matches( const OUString & rStr ) const; + bool Matches( std::u16string_view rStr ) const; }; } @@ -161,7 +164,7 @@ private: // WildCard Implementation. -bool WildCard::Matches( const OUString& rString ) const +bool WildCard::Matches( std::u16string_view rString ) const { OString aString = OUStringToOString( rString, RTL_TEXTENCODING_UTF8 ).toAsciiLowerCase(); diff --git a/unodevtools/source/skeletonmaker/javatypemaker.cxx b/unodevtools/source/skeletonmaker/javatypemaker.cxx index be65870b56ad..a82a1fd1b610 100644 --- a/unodevtools/source/skeletonmaker/javatypemaker.cxx +++ b/unodevtools/source/skeletonmaker/javatypemaker.cxx @@ -21,6 +21,7 @@ #include <algorithm> #include <cstring> +#include <string_view> #include <codemaker/codemaker.hxx> #include <codemaker/commonjava.hxx> @@ -34,7 +35,7 @@ namespace skeletonmaker::java { static void printType( std::ostream & o, ProgramOptions const & options, rtl::Reference< TypeManager > const & manager, - codemaker::UnoType::Sort sort, OUString const & nucleus, sal_Int32 rank, + codemaker::UnoType::Sort sort, std::u16string_view nucleus, sal_Int32 rank, std::vector< OUString > const & arguments, bool referenceType, bool defaultvalue) { @@ -623,7 +624,7 @@ static void printServiceMembers( static void printMapsToJavaType( std::ostream & o, ProgramOptions const & options, rtl::Reference< TypeManager > const & manager, - codemaker::UnoType::Sort sort, OUString const & nucleus, sal_Int32 rank, + codemaker::UnoType::Sort sort, std::u16string_view nucleus, sal_Int32 rank, std::vector< OUString > const & arguments, const char * javaTypeSort) { o << "maps to Java 1.5 "; @@ -631,7 +632,7 @@ static void printMapsToJavaType( o << javaTypeSort << ' '; } o << "type \""; - if (rank == 0 && nucleus == "com.sun.star.uno.XInterface") { + if (rank == 0 && nucleus == u"com.sun.star.uno.XInterface") { o << "com.sun.star.uno.XInterface"; } else { printType( diff --git a/unotest/source/cpp/unoexceptionprotector/unoexceptionprotector.cxx b/unotest/source/cpp/unoexceptionprotector/unoexceptionprotector.cxx index 36da0debf56d..7a5b17b750c9 100644 --- a/unotest/source/cpp/unoexceptionprotector/unoexceptionprotector.cxx +++ b/unotest/source/cpp/unoexceptionprotector/unoexceptionprotector.cxx @@ -18,6 +18,7 @@ */ #include <string> +#include <string_view> #include <com/sun/star/uno/Any.hxx> #include <com/sun/star/uno/Exception.hpp> @@ -33,7 +34,7 @@ namespace { // Best effort conversion: -std::string convert(OUString const & s16) { +std::string convert(std::u16string_view s16) { OString s8(OUStringToOString(s16, osl_getThreadTextEncoding())); static_assert(sizeof (sal_Int32) <= sizeof (std::string::size_type), "got to be at least equal"); // ensure following cast is legitimate @@ -64,8 +65,7 @@ bool Prot::protect( reportError( context, CppUnit::Message( - convert( - "An uncaught exception of type " + a.getValueTypeName()), + "An uncaught exception of type " + convert(a.getValueTypeName()), convert(e.Message))); } return false; diff --git a/unotools/source/i18n/localedatawrapper.cxx b/unotools/source/i18n/localedatawrapper.cxx index 3d3bee0d4892..0565e7f291a2 100644 --- a/unotools/source/i18n/localedatawrapper.cxx +++ b/unotools/source/i18n/localedatawrapper.cxx @@ -619,7 +619,7 @@ void LocaleDataWrapper::getCurrSymbolsImpl() if ( !aCurrSeq.hasElements() ) { if (areChecksEnabled()) - outputCheckMessage(OUString("LocaleDataWrapper::getCurrSymbolsImpl: no currency at all, using ShellsAndPebbles")); + outputCheckMessage("LocaleDataWrapper::getCurrSymbolsImpl: no currency at all, using ShellsAndPebbles"); aCurrSymbol = "ShellsAndPebbles"; aCurrBankSymbol = aCurrSymbol; nCurrPositiveFormat = nCurrNegativeFormat = nCurrFormatDefault; @@ -1699,7 +1699,7 @@ OUString LocaleDataWrapper::appendLocaleInfo(const OUString& rDebugMsg) const } // static -void LocaleDataWrapper::outputCheckMessage( const OUString& rMsg ) +void LocaleDataWrapper::outputCheckMessage( std::u16string_view rMsg ) { outputCheckMessage(OUStringToOString(rMsg, RTL_TEXTENCODING_UTF8).getStr()); } diff --git a/unoxml/source/dom/document.cxx b/unoxml/source/dom/document.cxx index c753f37c6054..8d56510da81f 100644 --- a/unoxml/source/dom/document.cxx +++ b/unoxml/source/dom/document.cxx @@ -440,8 +440,8 @@ namespace DOM OString oPrefix, oName, oUri; if (i != -1) { - oPrefix = OUStringToOString(qname.copy(0, i), RTL_TEXTENCODING_UTF8); - oName = OUStringToOString(qname.copy(i+1), RTL_TEXTENCODING_UTF8); + oPrefix = OUStringToOString(qname.subView(0, i), RTL_TEXTENCODING_UTF8); + oName = OUStringToOString(qname.subView(i+1), RTL_TEXTENCODING_UTF8); } else { @@ -530,9 +530,9 @@ namespace DOM xmlChar const *pName; OString o1, o2, o3; if ( i != -1) { - o1 = OUStringToOString(qname.copy(0, i), RTL_TEXTENCODING_UTF8); + o1 = OUStringToOString(qname.subView(0, i), RTL_TEXTENCODING_UTF8); pPrefix = reinterpret_cast<xmlChar const *>(o1.getStr()); - o2 = OUStringToOString(qname.copy(i+1), RTL_TEXTENCODING_UTF8); + o2 = OUStringToOString(qname.subView(i+1), RTL_TEXTENCODING_UTF8); pName = reinterpret_cast<xmlChar const *>(o2.getStr()); } else { // default prefix diff --git a/unoxml/source/dom/element.cxx b/unoxml/source/dom/element.cxx index afef8b313b29..f5dd67304d6b 100644 --- a/unoxml/source/dom/element.cxx +++ b/unoxml/source/dom/element.cxx @@ -659,11 +659,11 @@ namespace DOM if (idx != -1) { o2 = OUStringToOString( - qualifiedName.copy(0,idx), + qualifiedName.subView(0,idx), RTL_TEXTENCODING_UTF8); pPrefix = reinterpret_cast<xmlChar const *>(o2.getStr()); o3 = OUStringToOString( - qualifiedName.copy(idx+1), + qualifiedName.subView(idx+1), RTL_TEXTENCODING_UTF8); pLName = reinterpret_cast<xmlChar const *>(o3.getStr()); } else { diff --git a/unoxml/source/dom/elementlist.cxx b/unoxml/source/dom/elementlist.cxx index 7379ebe1104b..290438b2ca28 100644 --- a/unoxml/source/dom/elementlist.cxx +++ b/unoxml/source/dom/elementlist.cxx @@ -20,6 +20,7 @@ #include "elementlist.hxx" #include <string.h> +#include <string_view> #include <cppuhelper/implbase.hxx> #include <o3tl/safeint.hxx> @@ -58,7 +59,7 @@ namespace namespace DOM { - static xmlChar* lcl_initXmlString(OUString const& rString) + static xmlChar* lcl_initXmlString(std::u16string_view rString) { OString const os = OUStringToOString(rString, RTL_TEXTENCODING_UTF8); @@ -69,7 +70,7 @@ namespace DOM CElementList::CElementList(::rtl::Reference<CElement> const& pElement, ::osl::Mutex & rMutex, - OUString const& rName, OUString const*const pURI) + std::u16string_view rName, OUString const*const pURI) : m_xImpl(new CElementListImpl(pElement, rMutex, rName, pURI)) { if (pElement.is()) { @@ -79,7 +80,7 @@ namespace DOM CElementListImpl::CElementListImpl(::rtl::Reference<CElement> const& pElement, ::osl::Mutex & rMutex, - OUString const& rName, OUString const*const pURI) + std::u16string_view rName, OUString const*const pURI) : m_pElement(pElement) , m_rMutex(rMutex) , m_pName(lcl_initXmlString(rName)) diff --git a/unoxml/source/dom/elementlist.hxx b/unoxml/source/dom/elementlist.hxx index b3157900c04b..16a3eff8c5d2 100644 --- a/unoxml/source/dom/elementlist.hxx +++ b/unoxml/source/dom/elementlist.hxx @@ -21,7 +21,7 @@ #define INCLUDED_UNOXML_SOURCE_DOM_ELEMENTLIST_HXX #include <vector> - +#include <string_view> #include <memory> #include <libxml/tree.h> @@ -63,7 +63,7 @@ namespace DOM public: CElementListImpl(::rtl::Reference<CElement> const& pElement, ::osl::Mutex & rMutex, - OUString const& rName, OUString const*const pURI); + std::u16string_view rName, OUString const*const pURI); void registerListener(CElement & rElement); @@ -91,7 +91,7 @@ namespace DOM public: CElementList(::rtl::Reference<CElement> const& pElement, ::osl::Mutex & rMutex, - OUString const& rName, OUString const*const pURI = nullptr); + std::u16string_view rName, OUString const*const pURI = nullptr); /** The number of nodes in the list. diff --git a/unoxml/source/rdf/librdf_repository.cxx b/unoxml/source/rdf/librdf_repository.cxx index 9ebd7217b24f..13a10b4edb41 100644 --- a/unoxml/source/rdf/librdf_repository.cxx +++ b/unoxml/source/rdf/librdf_repository.cxx @@ -22,6 +22,7 @@ #include <map> #include <memory> #include <set> +#include <string_view> #include <iterator> #include <algorithm> #include <atomic> @@ -2346,7 +2347,7 @@ librdf_TypeConverter::convertToXURI(librdf_uri* i_pURI) const "librdf_uri_as_string failed", m_rRep); } OUString uriU( OStringToOUString( - OString(reinterpret_cast<const char*>(uri)), + std::string_view(reinterpret_cast<const char*>(uri)), RTL_TEXTENCODING_UTF8) ); try { return rdf::URI::create(m_xContext, uriU); @@ -2388,7 +2389,7 @@ librdf_TypeConverter::convertToXResource(librdf_node* i_pNode) const "blank node has no label", m_rRep); } OUString labelU( OStringToOUString( - OString(reinterpret_cast<const char*>(label)), + std::string_view(reinterpret_cast<const char*>(label)), RTL_TEXTENCODING_UTF8) ); try { return rdf::BlankNode::create(m_xContext, labelU); @@ -2421,11 +2422,11 @@ librdf_TypeConverter::convertToXNode(librdf_node* i_pNode) const librdf_node_get_literal_value_datatype_uri(i_pNode) ); OSL_ENSURE(!lang || !pType, "convertToXNode: invalid literal"); const OUString valueU( OStringToOUString( - OString(reinterpret_cast<const char*>(value)), + std::string_view(reinterpret_cast<const char*>(value)), RTL_TEXTENCODING_UTF8) ); if (lang) { const OUString langU( OStringToOUString( - OString(reinterpret_cast<const char*>(lang)), + std::string_view(reinterpret_cast<const char*>(lang)), RTL_TEXTENCODING_UTF8) ); return rdf::Literal::createWithLanguage(m_xContext, valueU, langU); } else if (pType) { diff --git a/vcl/headless/svpprn.cxx b/vcl/headless/svpprn.cxx index 36c9d5398739..c50a01023824 100644 --- a/vcl/headless/svpprn.cxx +++ b/vcl/headless/svpprn.cxx @@ -17,6 +17,10 @@ * the License at http://www.apache.org/licenses/LICENSE-2.0 . */ +#include <sal/config.h> + +#include <string_view> + #include <vcl/svapp.hxx> #include <vcl/timer.hxx> #include <vcl/QueueInfo.hxx> @@ -51,7 +55,8 @@ static OUString getPdfDir( const PrinterInfo& rInfo ) aDir = aToken.getToken( 1, '=', nPos ); if( aDir.isEmpty() ) if (auto const env = getenv( "HOME" )) { - aDir = OStringToOUString( OString( env ), osl_getThreadTextEncoding() ); + aDir = OStringToOUString( + std::string_view( env ), osl_getThreadTextEncoding() ); } break; } diff --git a/vcl/inc/driverblocklist.hxx b/vcl/inc/driverblocklist.hxx index c63fc14acd61..542677aa3454 100644 --- a/vcl/inc/driverblocklist.hxx +++ b/vcl/inc/driverblocklist.hxx @@ -26,7 +26,7 @@ enum class VersionType }; VCL_DLLPUBLIC bool IsDeviceBlocked(const OUString& blocklistURL, VersionType versionType, - const OUString& driverVersion, std::u16string_view vendorId, + std::u16string_view driverVersion, std::u16string_view vendorId, const OUString& deviceId); #ifdef _WIN32 @@ -125,7 +125,7 @@ private: void handleList(xmlreader::XmlReader& rReader); void handleContent(xmlreader::XmlReader& rReader); static void handleDevices(DriverInfo& rDriver, xmlreader::XmlReader& rReader); - uint64_t getVersion(const OString& rString); + uint64_t getVersion(std::string_view rString); enum class BlockType { @@ -142,10 +142,13 @@ private: OUString VCL_DLLPUBLIC GetVendorId(DeviceVendor id); -bool VCL_DLLPUBLIC FindBlocklistedDeviceInList( - std::vector<DriverInfo>& aDeviceInfos, VersionType versionType, OUString const& sDriverVersion, - std::u16string_view sAdapterVendorID, OUString const& sAdapterDeviceID, OperatingSystem system, - const OUString& blocklistURL = OUString()); +bool VCL_DLLPUBLIC FindBlocklistedDeviceInList(std::vector<DriverInfo>& aDeviceInfos, + VersionType versionType, + std::u16string_view sDriverVersion, + std::u16string_view sAdapterVendorID, + OUString const& sAdapterDeviceID, + OperatingSystem system, + const OUString& blocklistURL = OUString()); #define GFX_DRIVER_VERSION(a, b, c, d) \ ((uint64_t(a) << 48) | (uint64_t(b) << 32) | (uint64_t(c) << 16) | uint64_t(d)) diff --git a/vcl/inc/ppdparser.hxx b/vcl/inc/ppdparser.hxx index fdcc0a68c186..48e47e3fbc13 100644 --- a/vcl/inc/ppdparser.hxx +++ b/vcl/inc/ppdparser.hxx @@ -23,6 +23,7 @@ #include <cstddef> #include <memory> +#include <string_view> #include <unordered_map> #include <vector> @@ -166,7 +167,7 @@ private: PPDParser(const OUString& rFile, const std::vector<PPDKey*>& keys); void parseOrderDependency(const OString& rLine); - void parseOpenUI(const OString& rLine, const OString& rPPDGroup); + void parseOpenUI(const OString& rLine, std::string_view rPPDGroup); void parseConstraint(const OString& rLine); void parse( std::vector< OString >& rLines ); diff --git a/vcl/inc/unx/fontmanager.hxx b/vcl/inc/unx/fontmanager.hxx index 7d625555d833..0ef3aa3655e6 100644 --- a/vcl/inc/unx/fontmanager.hxx +++ b/vcl/inc/unx/fontmanager.hxx @@ -31,6 +31,7 @@ #include <map> #include <set> #include <memory> +#include <string_view> #include <vector> #include <unordered_map> @@ -157,7 +158,7 @@ class VCL_PLUGIN_PUBLIC PrintFontManager // There may be multiple font ids for font collections std::vector<fontID> findFontFileIDs( int nDirID, const OString& rFile ) const; - static FontFamily matchFamilyName( const OUString& rFamily ); + static FontFamily matchFamilyName( std::u16string_view rFamily ); PrintFont* getFont( fontID nID ) const { diff --git a/vcl/inc/unx/screensaverinhibitor.hxx b/vcl/inc/unx/screensaverinhibitor.hxx index f9de1c8530ce..f57d78b9758a 100644 --- a/vcl/inc/unx/screensaverinhibitor.hxx +++ b/vcl/inc/unx/screensaverinhibitor.hxx @@ -17,11 +17,12 @@ #include <vcl/dllapi.h> #include <optional> +#include <string_view> class VCL_PLUGIN_PUBLIC ScreenSaverInhibitor { public: - void inhibit(bool bInhibit, const OUString& sReason, bool bIsX11, + void inhibit(bool bInhibit, std::u16string_view sReason, bool bIsX11, const std::optional<unsigned int>& xid, std::optional<Display*> pDisplay); private: diff --git a/vcl/qa/cppunit/blocklistparsertest.cxx b/vcl/qa/cppunit/blocklistparsertest.cxx index 96c93b44326a..0c221ba776a8 100644 --- a/vcl/qa/cppunit/blocklistparsertest.cxx +++ b/vcl/qa/cppunit/blocklistparsertest.cxx @@ -109,39 +109,39 @@ void BlocklistParserTest::testEvaluate() // Check OS CPPUNIT_ASSERT_EQUAL(false, FindBlocklistedDeviceInList( - aDriveInfos, VersionType::OpenGL, "10.20.30.40", vendorNVIDIA, "all", DRIVER_OS_WINDOWS_7)); + aDriveInfos, VersionType::OpenGL, u"10.20.30.40", vendorNVIDIA, "all", DRIVER_OS_WINDOWS_7)); CPPUNIT_ASSERT_EQUAL(false, FindBlocklistedDeviceInList( - aDriveInfos, VersionType::OpenGL, "10.20.30.40", vendorNVIDIA, "all", DRIVER_OS_WINDOWS_8)); + aDriveInfos, VersionType::OpenGL, u"10.20.30.40", vendorNVIDIA, "all", DRIVER_OS_WINDOWS_8)); CPPUNIT_ASSERT_EQUAL(false, FindBlocklistedDeviceInList( - aDriveInfos, VersionType::OpenGL, "10.20.30.40", vendorNVIDIA, "all", DRIVER_OS_WINDOWS_10)); + aDriveInfos, VersionType::OpenGL, u"10.20.30.40", vendorNVIDIA, "all", DRIVER_OS_WINDOWS_10)); // Check generic OS CPPUNIT_ASSERT_EQUAL(false, FindBlocklistedDeviceInList( - aDriveInfos, VersionType::OpenGL, "10.20.30.50", vendorMicrosoft, "all", DRIVER_OS_WINDOWS_10)); + aDriveInfos, VersionType::OpenGL, u"10.20.30.50", vendorMicrosoft, "all", DRIVER_OS_WINDOWS_10)); CPPUNIT_ASSERT_EQUAL(true, FindBlocklistedDeviceInList( - aDriveInfos, VersionType::OpenGL, "10.20.30.50", vendorMicrosoft, "all", DRIVER_OS_LINUX)); + aDriveInfos, VersionType::OpenGL, u"10.20.30.50", vendorMicrosoft, "all", DRIVER_OS_LINUX)); CPPUNIT_ASSERT_EQUAL(true, FindBlocklistedDeviceInList( - aDriveInfos, VersionType::OpenGL, "10.20.30.50", vendorMicrosoft, "all", DRIVER_OS_OSX_10_7)); + aDriveInfos, VersionType::OpenGL, u"10.20.30.50", vendorMicrosoft, "all", DRIVER_OS_OSX_10_7)); CPPUNIT_ASSERT_EQUAL(true, FindBlocklistedDeviceInList( - aDriveInfos, VersionType::OpenGL, "10.20.30.50", vendorMicrosoft, "all", DRIVER_OS_OSX_10_8)); + aDriveInfos, VersionType::OpenGL, u"10.20.30.50", vendorMicrosoft, "all", DRIVER_OS_OSX_10_8)); // Check Vendors CPPUNIT_ASSERT_EQUAL(true, FindBlocklistedDeviceInList( - aDriveInfos, VersionType::OpenGL, "10.20.30.40", vendorMicrosoft, "all", DRIVER_OS_WINDOWS_7)); + aDriveInfos, VersionType::OpenGL, u"10.20.30.40", vendorMicrosoft, "all", DRIVER_OS_WINDOWS_7)); CPPUNIT_ASSERT_EQUAL(true, FindBlocklistedDeviceInList( - aDriveInfos, VersionType::OpenGL, "10.20.30.40", vendorMicrosoft, "all", DRIVER_OS_WINDOWS_10)); + aDriveInfos, VersionType::OpenGL, u"10.20.30.40", vendorMicrosoft, "all", DRIVER_OS_WINDOWS_10)); // Check Versions CPPUNIT_ASSERT_EQUAL(true, FindBlocklistedDeviceInList( - aDriveInfos, VersionType::OpenGL, "10.20.30.39", vendorAMD, "all", DRIVER_OS_WINDOWS_7)); + aDriveInfos, VersionType::OpenGL, u"10.20.30.39", vendorAMD, "all", DRIVER_OS_WINDOWS_7)); CPPUNIT_ASSERT_EQUAL(false, FindBlocklistedDeviceInList( - aDriveInfos, VersionType::OpenGL, "10.20.30.40", vendorAMD, "all", DRIVER_OS_WINDOWS_7)); + aDriveInfos, VersionType::OpenGL, u"10.20.30.40", vendorAMD, "all", DRIVER_OS_WINDOWS_7)); CPPUNIT_ASSERT_EQUAL(false, FindBlocklistedDeviceInList( - aDriveInfos, VersionType::OpenGL, "10.20.30.41", vendorAMD, "all", DRIVER_OS_WINDOWS_7)); + aDriveInfos, VersionType::OpenGL, u"10.20.30.41", vendorAMD, "all", DRIVER_OS_WINDOWS_7)); // Check CPPUNIT_ASSERT_EQUAL(true, FindBlocklistedDeviceInList( - aDriveInfos, VersionType::OpenGL, "9.17.10.4229", vendorIntel, "all", DRIVER_OS_WINDOWS_7)); + aDriveInfos, VersionType::OpenGL, u"9.17.10.4229", vendorIntel, "all", DRIVER_OS_WINDOWS_7)); } @@ -158,11 +158,11 @@ void BlocklistParserTest::testVulkan() // Check Versions CPPUNIT_ASSERT_EQUAL(false, FindBlocklistedDeviceInList( - aDriveInfos, VersionType::Vulkan, "1.2.3", vendorAMD, "all", DRIVER_OS_ALL)); + aDriveInfos, VersionType::Vulkan, u"1.2.3", vendorAMD, "all", DRIVER_OS_ALL)); CPPUNIT_ASSERT_EQUAL(true, FindBlocklistedDeviceInList( - aDriveInfos, VersionType::Vulkan, "1.2.2", vendorAMD, "all", DRIVER_OS_ALL)); + aDriveInfos, VersionType::Vulkan, u"1.2.2", vendorAMD, "all", DRIVER_OS_ALL)); CPPUNIT_ASSERT_EQUAL(false, FindBlocklistedDeviceInList( - aDriveInfos, VersionType::Vulkan, "1.2.20", vendorAMD, "all", DRIVER_OS_ALL)); + aDriveInfos, VersionType::Vulkan, u"1.2.20", vendorAMD, "all", DRIVER_OS_ALL)); } } // namespace diff --git a/vcl/qa/cppunit/lifecycle.cxx b/vcl/qa/cppunit/lifecycle.cxx index f77df28af70f..2c9967e8bb0c 100644 --- a/vcl/qa/cppunit/lifecycle.cxx +++ b/vcl/qa/cppunit/lifecycle.cxx @@ -309,7 +309,7 @@ void LifecycleTest::testLeakage() aObjects.push_back(LeakTestObject::Create<VclVButtonBox>(xVBox)); } - aObjects.push_back(LeakTestObject::Create<Dialog>(xParent, "PrintProgressDialog", "vcl/ui/printprogressdialog.ui")); + aObjects.push_back(LeakTestObject::Create<Dialog>(xParent, u"PrintProgressDialog", "vcl/ui/printprogressdialog.ui")); xParent.clear(); for (auto i = aObjects.rbegin(); i != aObjects.rend(); ++i) diff --git a/vcl/qt5/Qt5Frame.cxx b/vcl/qt5/Qt5Frame.cxx index ad541db4f70c..beff0a472786 100644 --- a/vcl/qt5/Qt5Frame.cxx +++ b/vcl/qt5/Qt5Frame.cxx @@ -742,7 +742,7 @@ void Qt5Frame::StartPresentation(bool bStart) aDisplay = QX11Info::display(); } - m_ScreenSaverInhibitor.inhibit(bStart, "presentation", QX11Info::isPlatformX11(), aRootWindow, + m_ScreenSaverInhibitor.inhibit(bStart, u"presentation", QX11Info::isPlatformX11(), aRootWindow, aDisplay); #else (void)bStart; diff --git a/vcl/qt5/Qt5Instance_Print.cxx b/vcl/qt5/Qt5Instance_Print.cxx index 1052907ba1ac..99083ae84697 100644 --- a/vcl/qt5/Qt5Instance_Print.cxx +++ b/vcl/qt5/Qt5Instance_Print.cxx @@ -17,6 +17,10 @@ * the License at http://www.apache.org/licenses/LICENSE-2.0 . */ +#include <sal/config.h> + +#include <string_view> + #include <Qt5Instance.hxx> #include <Qt5Printer.hxx> @@ -52,7 +56,7 @@ static OUString getPdfDir(const PrinterInfo& rInfo) if (aDir.isEmpty()) if (auto const env = getenv("HOME")) { - aDir = OStringToOUString(OString(env), osl_getThreadTextEncoding()); + aDir = OStringToOUString(std::string_view(env), osl_getThreadTextEncoding()); } break; } diff --git a/vcl/skia/SkiaHelper.cxx b/vcl/skia/SkiaHelper.cxx index d545cc670bb5..fdbf3eef21b9 100644 --- a/vcl/skia/SkiaHelper.cxx +++ b/vcl/skia/SkiaHelper.cxx @@ -7,6 +7,10 @@ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ +#include <sal/config.h> + +#include <string_view> + #include <vcl/skia/SkiaHelper.hxx> #if !HAVE_FEATURE_SKIA @@ -87,7 +91,7 @@ static void writeToLog(SvStream& stream, const char* key, const char* value) stream.WriteChar('\n'); } -static void writeToLog(SvStream& stream, const char* key, const OUString& value) +static void writeToLog(SvStream& stream, const char* key, std::u16string_view value) { writeToLog(stream, key, OUStringToOString(value, RTL_TEXTENCODING_UTF8).getStr()); } diff --git a/vcl/source/app/salvtables.cxx b/vcl/source/app/salvtables.cxx index 2855d2a010cb..167ff5766084 100644 --- a/vcl/source/app/salvtables.cxx +++ b/vcl/source/app/salvtables.cxx @@ -689,7 +689,7 @@ Image createImage(const VirtualDevice& rDevice) return Image(rDevice.GetBitmapEx(Point(), rDevice.GetOutputSizePixel())); } -sal_uInt16 insert_to_menu(sal_uInt16 nLastId, PopupMenu* pMenu, int pos, const OUString& rId, +sal_uInt16 insert_to_menu(sal_uInt16 nLastId, PopupMenu* pMenu, int pos, std::u16string_view rId, const OUString& rStr, const OUString* pIconName, const VirtualDevice* pImageSurface, TriState eCheckRadioFalse) { diff --git a/vcl/source/filter/wmf/wmfwr.cxx b/vcl/source/filter/wmf/wmfwr.cxx index 515468386488..6b3d2c248baa 100644 --- a/vcl/source/filter/wmf/wmfwr.cxx +++ b/vcl/source/filter/wmf/wmfwr.cxx @@ -823,7 +823,7 @@ void WMFWriter::WMFRecord_StretchDIB( const Point & rPoint, const Size & rSize, nActBitmapPercent=0; } -void WMFWriter::WMFRecord_TextOut(const Point & rPoint, const OUString & rStr) +void WMFWriter::WMFRecord_TextOut(const Point & rPoint, std::u16string_view rStr) { rtl_TextEncoding eChrSet = aSrcFont.GetCharSet(); OString aString(OUStringToOString(rStr, eChrSet)); diff --git a/vcl/source/filter/wmf/wmfwr.hxx b/vcl/source/filter/wmf/wmfwr.hxx index ac0e0db66237..725872aa97dd 100644 --- a/vcl/source/filter/wmf/wmfwr.hxx +++ b/vcl/source/filter/wmf/wmfwr.hxx @@ -168,7 +168,7 @@ private: void WMFRecord_SetWindowExt(const Size & rSize); void WMFRecord_SetWindowOrg(const Point & rPoint); void WMFRecord_StretchDIB(const Point & rPoint, const Size & rSize, const Bitmap & rBitmap, sal_uInt32 nROP = 0 ); - void WMFRecord_TextOut(const Point & rPoint, const OUString & rString); + void WMFRecord_TextOut(const Point & rPoint, std::u16string_view rString); void WMFRecord_IntersectClipRect( const tools::Rectangle& rRect); sal_uInt16 AllocHandle(); diff --git a/vcl/source/font/font.cxx b/vcl/source/font/font.cxx index 2818e71e00ea..e3fced8fc158 100644 --- a/vcl/source/font/font.cxx +++ b/vcl/source/font/font.cxx @@ -30,6 +30,7 @@ #include <sft.hxx> #include <algorithm> +#include <string_view> #include <rtl/instance.hxx> #include <TypeSerializer.hxx> @@ -581,7 +582,7 @@ namespace pClose++; if( pClose - pOpen > 1 ) { - o_rResult.SetFamilyName( OStringToOUString( OString( pOpen+1, pClose-pOpen-1 ), RTL_TEXTENCODING_ASCII_US ) ); + o_rResult.SetFamilyName( OStringToOUString( std::string_view( pOpen+1, pClose-pOpen-1 ), RTL_TEXTENCODING_ASCII_US ) ); } } diff --git a/vcl/source/gdi/mtfxmldump.cxx b/vcl/source/gdi/mtfxmldump.cxx index 5e80e3f229f5..01b973ba60af 100644 --- a/vcl/source/gdi/mtfxmldump.cxx +++ b/vcl/source/gdi/mtfxmldump.cxx @@ -1101,7 +1101,7 @@ void MetafileXmlDump::writeXml(const GDIMetaFile& rMetaFile, tools::XmlWriter& r rWriter.attribute("color", convertColorToString(pMetaTextFillColorAction->GetColor())); if (pMetaTextFillColorAction->IsSetting()) - rWriter.attribute("setting", OUString("true")); + rWriter.attribute("setting", u"true"); rWriter.endElement(); } diff --git a/vcl/source/gdi/pdfwriter_impl.cxx b/vcl/source/gdi/pdfwriter_impl.cxx index 11de3436e531..ea8273592989 100644 --- a/vcl/source/gdi/pdfwriter_impl.cxx +++ b/vcl/source/gdi/pdfwriter_impl.cxx @@ -141,7 +141,7 @@ void appendHex(sal_Int8 nInt, OStringBuffer& rBuffer) rBuffer.append( pHexDigits[ nInt & 15 ] ); } -void appendName( const OUString& rStr, OStringBuffer& rBuffer ) +void appendName( std::u16string_view rStr, OStringBuffer& rBuffer ) { // FIXME i59651 add a check for max length of 127 chars? Per PDF spec 1.4, appendix C.1 // I guess than when reading the #xx sequence it will count for a single character. @@ -1541,7 +1541,7 @@ inline void PDFWriterImpl::appendLiteralStringEncrypt( std::string_view rInStrin rOutBuffer.append( ")" ); } -void PDFWriterImpl::appendLiteralStringEncrypt( const OUString& rInString, const sal_Int32 nInObjectNumber, OStringBuffer& rOutBuffer, rtl_TextEncoding nEnc ) +void PDFWriterImpl::appendLiteralStringEncrypt( std::u16string_view rInString, const sal_Int32 nInObjectNumber, OStringBuffer& rOutBuffer, rtl_TextEncoding nEnc ) { OString aBufferString( OUStringToOString( rInString, nEnc ) ); sal_Int32 nLen = aBufferString.getLength(); @@ -2435,7 +2435,7 @@ static bool getPfbSegmentLengths( const unsigned char* pFontBytes, int nByteLen, return true; } -static void appendSubsetName( int nSubsetID, const OUString& rPSName, OStringBuffer& rBuffer ) +static void appendSubsetName( int nSubsetID, std::u16string_view rPSName, OStringBuffer& rBuffer ) { if( nSubsetID ) { diff --git a/vcl/source/gdi/pdfwriter_impl.hxx b/vcl/source/gdi/pdfwriter_impl.hxx index dc96454609f9..00d016ace285 100644 --- a/vcl/source/gdi/pdfwriter_impl.hxx +++ b/vcl/source/gdi/pdfwriter_impl.hxx @@ -804,7 +804,7 @@ i12626 // test if the encryption is active, if yes than encrypt the unicode string and add to the OStringBuffer parameter void appendUnicodeTextStringEncrypt( const OUString& rInString, const sal_Int32 nInObjectNumber, OStringBuffer& rOutBuffer ); - void appendLiteralStringEncrypt( const OUString& rInString, const sal_Int32 nInObjectNumber, OStringBuffer& rOutBuffer, rtl_TextEncoding nEnc = RTL_TEXTENCODING_ASCII_US ); + void appendLiteralStringEncrypt( std::u16string_view rInString, const sal_Int32 nInObjectNumber, OStringBuffer& rOutBuffer, rtl_TextEncoding nEnc = RTL_TEXTENCODING_ASCII_US ); void appendLiteralStringEncrypt( std::string_view rInString, const sal_Int32 nInObjectNumber, OStringBuffer& rOutBuffer ); /* creates fonts and subsets that will be emitted later */ @@ -1011,7 +1011,7 @@ i12626 methods for PDF security pad a password according algorithm 3.2, step 1 */ - static void padPassword( const OUString& i_rPassword, sal_uInt8* o_pPaddedPW ); + static void padPassword( std::u16string_view i_rPassword, sal_uInt8* o_pPaddedPW ); /* algorithm 3.2: compute an encryption key */ static bool computeEncryptionKey( EncHashTransporter*, vcl::PDFWriter::PDFEncryptionProperties& io_rProperties, diff --git a/vcl/source/gdi/pdfwriter_impl2.cxx b/vcl/source/gdi/pdfwriter_impl2.cxx index a95c9500934f..a9c2e0b1282b 100644 --- a/vcl/source/gdi/pdfwriter_impl2.cxx +++ b/vcl/source/gdi/pdfwriter_impl2.cxx @@ -1212,7 +1212,7 @@ begin i12626 methods Implements Algorithm 3.2, step 1 only */ -void PDFWriterImpl::padPassword( const OUString& i_rPassword, sal_uInt8* o_pPaddedPW ) +void PDFWriterImpl::padPassword( std::u16string_view i_rPassword, sal_uInt8* o_pPaddedPW ) { // get ansi-1252 version of the password string CHECKIT ! i12626 OString aString( OUStringToOString( i_rPassword, RTL_TEXTENCODING_MS_1252 ) ); diff --git a/vcl/source/helper/driverblocklist.cxx b/vcl/source/helper/driverblocklist.cxx index 3adf57d118a1..7fb20da6ab94 100644 --- a/vcl/source/helper/driverblocklist.cxx +++ b/vcl/source/helper/driverblocklist.cxx @@ -96,7 +96,7 @@ static VersionComparisonOp getComparison(std::string_view rString) throw InvalidFileException(); } -static OUString GetVendorId(const OString& rString) +static OUString GetVendorId(std::string_view rString) { if (rString == "all") { @@ -271,7 +271,7 @@ static bool SplitDriverVersion(const char* aSource, char* aAStr, char* aBStr, ch return true; } -static bool ParseDriverVersion(const OUString& aVersion, uint64_t& rNumericVersion, +static bool ParseDriverVersion(std::u16string_view aVersion, uint64_t& rNumericVersion, VersionType versionType) { rNumericVersion = 0; @@ -311,7 +311,7 @@ static bool ParseDriverVersion(const OUString& aVersion, uint64_t& rNumericVersi return true; } -uint64_t Parser::getVersion(const OString& rString) +uint64_t Parser::getVersion(std::string_view rString) { OUString aString = OStringToOUString(rString, RTL_TEXTENCODING_UTF8); uint64_t nVersion; @@ -596,11 +596,12 @@ DriverInfo::DriverInfo(OperatingSystem os, const OUString& vendor, VersionCompar , mnDriverVersionMax(0) { if (suggestedVersion) - maSuggestedVersion = OStringToOUString(OString(suggestedVersion), RTL_TEXTENCODING_UTF8); + maSuggestedVersion + = OStringToOUString(std::string_view(suggestedVersion), RTL_TEXTENCODING_UTF8); } bool FindBlocklistedDeviceInList(std::vector<DriverInfo>& aDeviceInfos, VersionType versionType, - OUString const& sDriverVersion, + std::u16string_view sDriverVersion, std::u16string_view sAdapterVendorID, OUString const& sAdapterDeviceID, OperatingSystem system, const OUString& blocklistURL) @@ -705,7 +706,7 @@ bool FindBlocklistedDeviceInList(std::vector<DriverInfo>& aDeviceInfos, VersionT } bool IsDeviceBlocked(const OUString& blocklistURL, VersionType versionType, - const OUString& driverVersion, std::u16string_view vendorId, + std::u16string_view driverVersion, std::u16string_view vendorId, const OUString& deviceId) { std::vector<DriverInfo> driverList; diff --git a/vcl/source/opengl/OpenGLHelper.cxx b/vcl/source/opengl/OpenGLHelper.cxx index 90786adfd5ec..25c2912c620d 100644 --- a/vcl/source/opengl/OpenGLHelper.cxx +++ b/vcl/source/opengl/OpenGLHelper.cxx @@ -25,6 +25,7 @@ #include <com/sun/star/configuration/theDefaultProvider.hpp> #include <stdarg.h> +#include <string_view> #include <vector> #include <unordered_map> @@ -301,15 +302,15 @@ namespace return false; } - OString createFileName( const OUString& rVertexShaderName, - const OUString& rFragmentShaderName, - const OUString& rGeometryShaderName, + OString createFileName( std::u16string_view rVertexShaderName, + std::u16string_view rFragmentShaderName, + std::u16string_view rGeometryShaderName, const OString& rDigest ) { OString aFileName = getCacheFolder() + OUStringToOString( rVertexShaderName, RTL_TEXTENCODING_UTF8 ) + "-" + OUStringToOString( rFragmentShaderName, RTL_TEXTENCODING_UTF8 ) + "-"; - if (!rGeometryShaderName.isEmpty()) + if (!rGeometryShaderName.empty()) aFileName += OUStringToOString( rGeometryShaderName, RTL_TEXTENCODING_UTF8 ) + "-"; aFileName += rDigest + ".bin"; return aFileName; diff --git a/vcl/source/pdf/XmpMetadata.cxx b/vcl/source/pdf/XmpMetadata.cxx index 180a8d037b46..e1a6ecf02ce5 100644 --- a/vcl/source/pdf/XmpMetadata.cxx +++ b/vcl/source/pdf/XmpMetadata.cxx @@ -36,7 +36,7 @@ void XmpMetadata::write() // Header mpMemoryStream->WriteOString("<?xpacket begin=\""); - mpMemoryStream->WriteOString(OUStringToOString(OUString(u'\xFEFF'), RTL_TEXTENCODING_UTF8)); + mpMemoryStream->WriteOString(OUStringToOString(u"\xFEFF", RTL_TEXTENCODING_UTF8)); mpMemoryStream->WriteOString("\" id=\"W5M0MpCehiHzreSzNTczkc9d\"?>\n"); { diff --git a/vcl/source/uitest/logger.cxx b/vcl/source/uitest/logger.cxx index 9262302e8493..0193bf76074e 100644 --- a/vcl/source/uitest/logger.cxx +++ b/vcl/source/uitest/logger.cxx @@ -181,12 +181,12 @@ void UITestLogger::logAction(vcl::Window* const& xUIWin, VclEventId nEvent) maStream.WriteLine(OUStringToOString(aAction, RTL_TEXTENCODING_UTF8)); } -void UITestLogger::log(const OUString& rString) +void UITestLogger::log(std::u16string_view rString) { if (!mbValid) return; - if (rString.isEmpty()) + if (rString.empty()) return; maStream.WriteLine(OUStringToOString(rString, RTL_TEXTENCODING_UTF8)); diff --git a/vcl/source/window/builder.cxx b/vcl/source/window/builder.cxx index 0cb215614c82..0fbcb066ed3f 100644 --- a/vcl/source/window/builder.cxx +++ b/vcl/source/window/builder.cxx @@ -1654,7 +1654,7 @@ VclBuilder::customMakeWidget GetCustomMakeWidget(const OString& rName) #ifndef DISABLE_DYNLOADING const OUString sModule = SAL_DLLPREFIX - + OStringToOUString(name.copy(0, nDelim), RTL_TEXTENCODING_UTF8) + + OStringToOUString(name.subView(0, nDelim), RTL_TEXTENCODING_UTF8) + SAL_DLLEXTENSION; ModuleMap::iterator aI = g_aModuleMap.find(sModule); if (aI == g_aModuleMap.end()) @@ -3429,7 +3429,7 @@ void VclBuilder::handleMenuObject(Menu *pParent, xmlreader::XmlReader &reader) sal_Int32 nDelim = sID.indexOf(':'); if (nDelim != -1) { - sCustomProperty = OUString::fromUtf8(sID.copy(nDelim+1)); + sCustomProperty = OUString::fromUtf8(sID.subView(nDelim+1)); sID = sID.copy(0, nDelim); } } @@ -3722,7 +3722,7 @@ VclPtr<vcl::Window> VclBuilder::handleObject(vcl::Window *pParent, stringmap *pA sal_Int32 nDelim = sID.indexOf(':'); if (nDelim != -1) { - sCustomProperty = OUString::fromUtf8(sID.copy(nDelim+1)); + sCustomProperty = OUString::fromUtf8(sID.subView(nDelim+1)); sID = sID.copy(0, nDelim); } } diff --git a/vcl/source/window/dialog.cxx b/vcl/source/window/dialog.cxx index 9a237ba5df9f..cf240167d588 100644 --- a/vcl/source/window/dialog.cxx +++ b/vcl/source/window/dialog.cxx @@ -562,7 +562,7 @@ void Dialog::doDeferredInit(WinBits nBits) mbIsDeferredInit = false; } -Dialog::Dialog(vcl::Window* pParent, const OUString& rID, const OUString& rUIXMLDescription) +Dialog::Dialog(vcl::Window* pParent, std::u16string_view rID, const OUString& rUIXMLDescription) : SystemWindow(WindowType::DIALOG) , mnInitFlag(InitFlag::Default) { @@ -624,7 +624,7 @@ void Dialog::dispose() css::document::DocumentEvent aObject; aObject.EventName = "DialogClosed"; xEventBroadcaster->documentEventOccured(aObject); - UITestLogger::getInstance().log("Close Dialog"); + UITestLogger::getInstance().log(u"Close Dialog"); if (comphelper::LibreOfficeKit::isActive()) { @@ -995,9 +995,9 @@ bool Dialog::ImplStartExecute() aObject.EventName = "DialogExecute"; xEventBroadcaster->documentEventOccured(aObject); if (bModal) - UITestLogger::getInstance().log("Open Modal " + get_id()); + UITestLogger::getInstance().log(OUString("Open Modal " + get_id())); else - UITestLogger::getInstance().log("Open Modeless " + get_id()); + UITestLogger::getInstance().log(OUString("Open Modeless " + get_id())); bool bTunnelingEnabled = mpDialogImpl->m_bLOKTunneling; if (comphelper::LibreOfficeKit::isActive() && bTunnelingEnabled) diff --git a/vcl/unx/generic/app/sm.cxx b/vcl/unx/generic/app/sm.cxx index 7827f01eec35..136cf0d2559b 100644 --- a/vcl/unx/generic/app/sm.cxx +++ b/vcl/unx/generic/app/sm.cxx @@ -626,7 +626,7 @@ OString SessionManagerClient::getPreviousSessionID() if(aArg.match("--session=")) { aPrevId = OUStringToOString( - aArg.copy(RTL_CONSTASCII_LENGTH("--session=")), + aArg.subView(RTL_CONSTASCII_LENGTH("--session=")), osl_getThreadTextEncoding()); break; } diff --git a/vcl/unx/generic/fontmanager/fontconfig.cxx b/vcl/unx/generic/fontmanager/fontconfig.cxx index 65cba56e069c..48428aa4be36 100644 --- a/vcl/unx/generic/fontmanager/fontconfig.cxx +++ b/vcl/unx/generic/fontmanager/fontconfig.cxx @@ -18,6 +18,8 @@ */ #include <memory> +#include <string_view> + #include <unx/fontmanager.hxx> #include <unx/helper.hxx> #include <comphelper/sequence.hxx> @@ -618,7 +620,7 @@ void PrintFontManager::countFontconfigFonts( std::unordered_map<OString, int>& o if( eSlantRes == FcResultMatch ) xUpdate->m_eItalic = convertSlant(slant); if( eStyleRes == FcResultMatch ) - xUpdate->m_aStyleName = OStringToOUString( OString( reinterpret_cast<char*>(style) ), RTL_TEXTENCODING_UTF8 ); + xUpdate->m_aStyleName = OStringToOUString( std::string_view( reinterpret_cast<char*>(style) ), RTL_TEXTENCODING_UTF8 ); if( eIndexRes == FcResultMatch ) xUpdate->m_nVariationEntry = GetVariationIndex(nEntryId); diff --git a/vcl/unx/generic/fontmanager/fontmanager.cxx b/vcl/unx/generic/fontmanager/fontmanager.cxx index b38a2d570afd..2906fc8f0123 100644 --- a/vcl/unx/generic/fontmanager/fontmanager.cxx +++ b/vcl/unx/generic/fontmanager/fontmanager.cxx @@ -558,7 +558,7 @@ bool PrintFontManager::analyzeSfntFile( PrintFont* pFont ) const if ( dotIndex == -1 ) dotIndex = pFont->m_aFontFile.getLength(); - pFont->m_aFamilyName = OStringToOUString(pFont->m_aFontFile.copy(0, dotIndex), aEncoding); + pFont->m_aFamilyName = OStringToOUString(pFont->m_aFontFile.subView(0, dotIndex), aEncoding); } } for (auto const& aAlias : aNames) @@ -841,7 +841,7 @@ int PrintFontManager::getFontFaceVariation( fontID nFontID ) const return nRet; } -FontFamily PrintFontManager::matchFamilyName( const OUString& rFamily ) +FontFamily PrintFontManager::matchFamilyName( std::u16string_view rFamily ) { struct family_t { const char* mpName; diff --git a/vcl/unx/generic/print/psputil.cxx b/vcl/unx/generic/print/psputil.cxx index 91e986dbd28e..1e82819d048b 100644 --- a/vcl/unx/generic/print/psputil.cxx +++ b/vcl/unx/generic/print/psputil.cxx @@ -174,7 +174,7 @@ WritePS (osl::File* pFile, const OString &rString) } bool -WritePS (osl::File* pFile, const OUString &rString) +WritePS (osl::File* pFile, std::u16string_view rString) { return WritePS (pFile, OUStringToOString(rString, RTL_TEXTENCODING_ASCII_US)); } diff --git a/vcl/unx/generic/print/psputil.hxx b/vcl/unx/generic/print/psputil.hxx index 1a5ec620d9ba..a401b04db511 100644 --- a/vcl/unx/generic/print/psputil.hxx +++ b/vcl/unx/generic/print/psputil.hxx @@ -20,6 +20,10 @@ #ifndef INCLUDED_VCL_GENERIC_PRINT_PSPUTIL_HXX #define INCLUDED_VCL_GENERIC_PRINT_PSPUTIL_HXX +#include <sal/config.h> + +#include <string_view> + #include <osl/file.hxx> #include <rtl/math.hxx> @@ -45,7 +49,7 @@ inline void getValueOfDouble( OStringBuffer& pBuffer, double f, int nPrecision = bool WritePS (osl::File* pFile, const char* pString); bool WritePS (osl::File* pFile, const char* pString, sal_uInt64 nInLength); bool WritePS (osl::File* pFile, const OString &rString); -bool WritePS (osl::File* pFile, const OUString &rString); +bool WritePS (osl::File* pFile, std::u16string_view rString); } /* namespace psp */ diff --git a/vcl/unx/generic/printer/cupsmgr.cxx b/vcl/unx/generic/printer/cupsmgr.cxx index 7830323d22d7..6ac997d14c10 100644 --- a/vcl/unx/generic/printer/cupsmgr.cxx +++ b/vcl/unx/generic/printer/cupsmgr.cxx @@ -42,6 +42,7 @@ #include <algorithm> #include <cstddef> +#include <string_view> using namespace psp; using namespace osl; @@ -673,7 +674,7 @@ namespace std::unique_ptr<weld::Entry> m_xPassEdit; public: - RTSPWDialog(weld::Window* pParent, const OString& rServer, const OString& rUserName); + RTSPWDialog(weld::Window* pParent, std::string_view rServer, std::string_view rUserName); OString getDomain() const { @@ -709,7 +710,7 @@ namespace } }; - RTSPWDialog::RTSPWDialog(weld::Window* pParent, const OString& rServer, const OString& rUserName) + RTSPWDialog::RTSPWDialog(weld::Window* pParent, std::string_view rServer, std::string_view rUserName) : GenericDialogController(pParent, "vcl/ui/cupspassworddialog.ui", "CUPSPasswordDialog") , m_xText(m_xBuilder->weld_label("text")) , m_xDomainLabel(m_xBuilder->weld_label("label3")) @@ -723,7 +724,7 @@ namespace aText = aText.replaceFirst("%s", OStringToOUString(rServer, osl_getThreadTextEncoding())); m_xText->set_label(aText); m_xDomainEdit->set_text("WORKGROUP"); - if (rUserName.isEmpty()) + if (rUserName.empty()) m_xUserEdit->grab_focus(); else { @@ -732,7 +733,7 @@ namespace } } - bool AuthenticateQuery(const OString& rServer, OString& rUserName, OString& rPassword) + bool AuthenticateQuery(std::string_view rServer, OString& rUserName, OString& rPassword) { bool bRet = false; diff --git a/vcl/unx/generic/printer/jobdata.cxx b/vcl/unx/generic/printer/jobdata.cxx index 5bbeceba0036..1e955bde21a0 100644 --- a/vcl/unx/generic/printer/jobdata.cxx +++ b/vcl/unx/generic/printer/jobdata.cxx @@ -221,7 +221,7 @@ bool JobData::constructFromStreamBuffer( const void* pData, sal_uInt32 bytes, Jo else if (aLine.startsWith(printerEquals)) { bPrinter = true; - rJobData.m_aPrinterName = OStringToOUString(aLine.copy(RTL_CONSTASCII_LENGTH(printerEquals)), RTL_TEXTENCODING_UTF8); + rJobData.m_aPrinterName = OStringToOUString(aLine.subView(RTL_CONSTASCII_LENGTH(printerEquals)), RTL_TEXTENCODING_UTF8); } else if (aLine.startsWith(orientatationEquals)) { diff --git a/vcl/unx/generic/printer/ppdparser.cxx b/vcl/unx/generic/printer/ppdparser.cxx index 2dbd268ae57e..7b29c876a8c3 100644 --- a/vcl/unx/generic/printer/ppdparser.cxx +++ b/vcl/unx/generic/printer/ppdparser.cxx @@ -1091,7 +1091,8 @@ void PPDParser::parse( ::std::vector< OString >& rLines ) nPos = aCurrentLine.indexOf(':'); if( nPos != -1 ) { - aOption = OStringToOUString( aCurrentLine.copy( 1, nPos-1 ), RTL_TEXTENCODING_MS_1252 ); + aOption = OStringToOUString( + aCurrentLine.subView( 1, nPos-1 ), RTL_TEXTENCODING_MS_1252 ); aOption = GetCommandLineToken( 1, aOption ); sal_Int32 nTransPos = aOption.indexOf( '/' ); if( nTransPos != -1 ) @@ -1143,7 +1144,7 @@ void PPDParser::parse( ::std::vector< OString >& rLines ) nTransPos = aLine.indexOf('"'); if (nTransPos == -1) nTransPos = aLine.getLength(); - aValue = OStringToOUString(aLine.copy(0, nTransPos), RTL_TEXTENCODING_MS_1252); + aValue = OStringToOUString(aLine.subView(0, nTransPos), RTL_TEXTENCODING_MS_1252); // after the second doublequote can follow a / and a translation if (nTransPos < aLine.getLength() - 2) { @@ -1173,7 +1174,7 @@ void PPDParser::parse( ::std::vector< OString >& rLines ) nTransPos = aLine.indexOf('/'); if (nTransPos == -1) nTransPos = aLine.getLength(); - aValue = OStringToOUString(aLine.copy(0, nTransPos), RTL_TEXTENCODING_MS_1252); + aValue = OStringToOUString(aLine.subView(0, nTransPos), RTL_TEXTENCODING_MS_1252); if (nTransPos+1 < aLine.getLength()) aValueTranslation = handleTranslation( aLine.copy( nTransPos+1 ), bIsGlobalizedLine ); eType = eString; @@ -1235,7 +1236,7 @@ void PPDParser::parse( ::std::vector< OString >& rLines ) if (aLine.startsWith("*Default")) { SAL_INFO("vcl.unx.print", "Found a default: '" << aLine << "'"); - OUString aKey(OStringToOUString(aLine.copy(8), RTL_TEXTENCODING_MS_1252)); + OUString aKey(OStringToOUString(aLine.subView(8), RTL_TEXTENCODING_MS_1252)); sal_Int32 nPos = aKey.indexOf( ':' ); if( nPos != -1 ) { @@ -1272,7 +1273,7 @@ void PPDParser::parse( ::std::vector< OString >& rLines ) } } -void PPDParser::parseOpenUI(const OString& rLine, const OString& rPPDGroup) +void PPDParser::parseOpenUI(const OString& rLine, std::string_view rPPDGroup) { OUString aTranslation; OString aKey = rLine; @@ -1916,11 +1917,12 @@ void PPDContext::rebuildFromStreamBuffer(const std::vector<char> &rBuffer) sal_Int32 nPos = aLine.indexOf(':'); if( nPos != -1 ) { - const PPDKey* pKey = m_pParser->getKey( OStringToOUString( aLine.copy( 0, nPos ), RTL_TEXTENCODING_MS_1252 ) ); + const PPDKey* pKey = m_pParser->getKey( OStringToOUString( aLine.subView( 0, nPos ), RTL_TEXTENCODING_MS_1252 ) ); if( pKey ) { const PPDValue* pValue = nullptr; - OUString aOption(OStringToOUString(aLine.copy(nPos+1), RTL_TEXTENCODING_MS_1252)); + OUString aOption( + OStringToOUString(aLine.subView(nPos+1), RTL_TEXTENCODING_MS_1252)); if (aOption != "*nil") pValue = pKey->getValue( aOption ); m_aCurrentValues[ pKey ] = pValue; diff --git a/vcl/unx/generic/printer/printerinfomanager.cxx b/vcl/unx/generic/printer/printerinfomanager.cxx index aae0f9f5f7b1..c6780b491f34 100644 --- a/vcl/unx/generic/printer/printerinfomanager.cxx +++ b/vcl/unx/generic/printer/printerinfomanager.cxx @@ -263,7 +263,7 @@ void PrinterInfoManager::initialize() if (aKey.startsWith("PPD_")) { aValue = aConfig.ReadKey( aKey ); - const PPDKey* pKey = m_aGlobalDefaults.m_pParser->getKey(OStringToOUString(aKey.copy(4), RTL_TEXTENCODING_ISO_8859_1)); + const PPDKey* pKey = m_aGlobalDefaults.m_pParser->getKey(OStringToOUString(aKey.subView(4), RTL_TEXTENCODING_ISO_8859_1)); if( pKey ) { m_aGlobalDefaults.m_aContext. @@ -329,10 +329,10 @@ void PrinterInfoManager::initialize() // initialize to global defaults aPrinter.m_aInfo = m_aGlobalDefaults; - aPrinterName = OStringToOUString(aValue.copy(nNamePos+1), + aPrinterName = OStringToOUString(aValue.subView(nNamePos+1), RTL_TEXTENCODING_UTF8); aPrinter.m_aInfo.m_aPrinterName = aPrinterName; - aPrinter.m_aInfo.m_aDriverName = OStringToOUString(aValue.copy(0, nNamePos), RTL_TEXTENCODING_UTF8); + aPrinter.m_aInfo.m_aDriverName = OStringToOUString(aValue.subView(0, nNamePos), RTL_TEXTENCODING_UTF8); // set parser, merge settings // don't do this for CUPS printers as this is done @@ -448,7 +448,7 @@ void PrinterInfoManager::initialize() if( aKey.startsWith("PPD_") && aPrinter.m_aInfo.m_pParser ) { aValue = aConfig.ReadKey( aKey ); - const PPDKey* pKey = aPrinter.m_aInfo.m_pParser->getKey(OStringToOUString(aKey.copy(4), RTL_TEXTENCODING_ISO_8859_1)); + const PPDKey* pKey = aPrinter.m_aInfo.m_pParser->getKey(OStringToOUString(aKey.subView(4), RTL_TEXTENCODING_ISO_8859_1)); if( pKey ) { aPrinter.m_aInfo.m_aContext. @@ -828,7 +828,7 @@ static void standardSysQueueTokenHandler( if( nAftPos != -1 ) { // get the queue name between fore and aft tokens - OUString aSysQueue( OStringToOUString( line.copy( nPos, nAftPos - nPos ), aEncoding ) ); + OUString aSysQueue( OStringToOUString( line.subView( nPos, nAftPos - nPos ), aEncoding ) ); // do not insert duplicates (e.g. lpstat tends to produce such lines) if( aUniqueSet.insert( aSysQueue ).second ) { diff --git a/vcl/unx/generic/window/salframe.cxx b/vcl/unx/generic/window/salframe.cxx index bdb192d376df..f12fb2805427 100644 --- a/vcl/unx/generic/window/salframe.cxx +++ b/vcl/unx/generic/window/salframe.cxx @@ -2204,7 +2204,7 @@ void X11SalFrame::ShowFullScreen( bool bFullScreen, sal_Int32 nScreen ) void X11SalFrame::StartPresentation( bool bStart ) { maScreenSaverInhibitor.inhibit( bStart, - "presentation", + u"presentation", true, // isX11 mhWindow, GetXDisplay() ); diff --git a/vcl/unx/generic/window/screensaverinhibitor.cxx b/vcl/unx/generic/window/screensaverinhibitor.cxx index 0b499e638ecb..36eac26c28dd 100644 --- a/vcl/unx/generic/window/screensaverinhibitor.cxx +++ b/vcl/unx/generic/window/screensaverinhibitor.cxx @@ -46,7 +46,7 @@ #include <sal/log.hxx> -void ScreenSaverInhibitor::inhibit( bool bInhibit, const OUString& sReason, +void ScreenSaverInhibitor::inhibit( bool bInhibit, std::u16string_view sReason, bool bIsX11, const std::optional<unsigned int>& xid, std::optional<Display*> pDisplay ) { const char* appname = SalGenericSystem::getFrameClassName(); diff --git a/vcl/unx/gtk3/a11y/atkwrapper.hxx b/vcl/unx/gtk3/a11y/atkwrapper.hxx index d9c651a2eae8..3b9e5bd03c1b 100644 --- a/vcl/unx/gtk3/a11y/atkwrapper.hxx +++ b/vcl/unx/gtk3/a11y/atkwrapper.hxx @@ -20,6 +20,10 @@ #ifndef INCLUDED_VCL_UNX_GTK_A11Y_ATKWRAPPER_HXX #define INCLUDED_VCL_UNX_GTK_A11Y_ATKWRAPPER_HXX +#include <sal/config.h> + +#include <string_view> + #include <atk/atk.h> #include <gtk/gtk.h> #include <gtk/gtk-a11y.h> @@ -112,7 +116,7 @@ void valueIfaceInit(AtkValueIface *iface); #define ATK_IS_OBJECT_WRAPPER(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), ATK_TYPE_OBJECT_WRAPPER)) static inline gchar * -OUStringToGChar(const OUString& rString ) +OUStringToGChar(std::u16string_view rString ) { OString aUtf8 = OUStringToOString( rString, RTL_TEXTENCODING_UTF8 ); return g_strdup( aUtf8.getStr() ); diff --git a/vcl/unx/gtk3/a11y/gtk3atkaction.cxx b/vcl/unx/gtk3/a11y/gtk3atkaction.cxx index 7d3313aa4066..84770c09cfe9 100644 --- a/vcl/unx/gtk3/a11y/gtk3atkaction.cxx +++ b/vcl/unx/gtk3/a11y/gtk3atkaction.cxx @@ -208,7 +208,7 @@ appendKeyStrokes(OStringBuffer& rBuffer, const uno::Sequence< awt::KeyStroke >& { // The KeyCode approach did not work, probably a non ascii character // let's hope that there is a character given in KeyChar. - rBuffer.append(OUStringToOString(OUString(rKeyStroke.KeyChar), RTL_TEXTENCODING_UTF8)); + rBuffer.append(OUStringToOString(OUStringChar(rKeyStroke.KeyChar), RTL_TEXTENCODING_UTF8)); } } } diff --git a/vcl/unx/gtk3/a11y/gtk3atkimage.cxx b/vcl/unx/gtk3/a11y/gtk3atkimage.cxx index acd43f467690..477c71cc99ba 100644 --- a/vcl/unx/gtk3/a11y/gtk3atkimage.cxx +++ b/vcl/unx/gtk3/a11y/gtk3atkimage.cxx @@ -17,6 +17,10 @@ * the License at http://www.apache.org/licenses/LICENSE-2.0 . */ +#include <sal/config.h> + +#include <string_view> + #include "atkwrapper.hxx" #include <com/sun/star/accessibility/XAccessibleImage.hpp> @@ -25,7 +29,7 @@ using namespace ::com::sun::star; // FIXME static const gchar * -getAsConst( const OUString& rString ) +getAsConst( std::u16string_view rString ) { static const int nMax = 10; static OString aUgly[nMax]; diff --git a/vcl/unx/gtk3/a11y/gtk3atktable.cxx b/vcl/unx/gtk3/a11y/gtk3atktable.cxx index 221e55d2b287..11df8a73ce1c 100644 --- a/vcl/unx/gtk3/a11y/gtk3atktable.cxx +++ b/vcl/unx/gtk3/a11y/gtk3atktable.cxx @@ -17,6 +17,10 @@ * the License at http://www.apache.org/licenses/LICENSE-2.0 . */ +#include <sal/config.h> + +#include <string_view> + #include "atkwrapper.hxx" #include <com/sun/star/accessibility/XAccessibleTable.hpp> @@ -37,7 +41,7 @@ atk_object_wrapper_conditional_ref( const uno::Reference< accessibility::XAccess // FIXME static const gchar * -getAsConst( const OUString& rString ) +getAsConst( std::u16string_view rString ) { static const int nMax = 10; static OString aUgly[nMax]; diff --git a/vcl/unx/gtk3/fpicker/SalGtkFilePicker.cxx b/vcl/unx/gtk3/fpicker/SalGtkFilePicker.cxx index 9becbc3c8319..6e27e777d373 100644 --- a/vcl/unx/gtk3/fpicker/SalGtkFilePicker.cxx +++ b/vcl/unx/gtk3/fpicker/SalGtkFilePicker.cxx @@ -50,6 +50,7 @@ #include <algorithm> #include <set> #include <string.h> +#include <string_view> #include "SalGtkFilePicker.hxx" @@ -1106,7 +1107,7 @@ static void HackWidthToFirst(GtkComboBox *pWidget) gtk_widget_set_size_request(GTK_WIDGET(pWidget), requisition.width, -1); } -static void ComboBoxAppendText(GtkComboBox *pCombo, const OUString &rStr) +static void ComboBoxAppendText(GtkComboBox *pCombo, std::u16string_view rStr) { GtkTreeIter aIter; GtkListStore *pStore = GTK_LIST_STORE(gtk_combo_box_get_model(pCombo)); diff --git a/vcl/unx/gtk3/fpicker/SalGtkPicker.cxx b/vcl/unx/gtk3/fpicker/SalGtkPicker.cxx index c847774d13d3..f1bcbfc4d265 100644 --- a/vcl/unx/gtk3/fpicker/SalGtkPicker.cxx +++ b/vcl/unx/gtk3/fpicker/SalGtkPicker.cxx @@ -254,7 +254,7 @@ OUString SalGtkPicker::implgetDisplayDirectory() return aCurrentFolderName; } -void SalGtkPicker::implsetTitle( const OUString& aTitle ) +void SalGtkPicker::implsetTitle( std::u16string_view aTitle ) { OSL_ASSERT( m_pDialog != nullptr ); diff --git a/vcl/unx/gtk3/fpicker/SalGtkPicker.hxx b/vcl/unx/gtk3/fpicker/SalGtkPicker.hxx index 46d6d9278b63..e38f48df22d1 100644 --- a/vcl/unx/gtk3/fpicker/SalGtkPicker.hxx +++ b/vcl/unx/gtk3/fpicker/SalGtkPicker.hxx @@ -20,6 +20,10 @@ #ifndef INCLUDED_VCL_UNX_GTK_FPICKER_SALGTKPICKER_HXX #define INCLUDED_VCL_UNX_GTK_FPICKER_SALGTKPICKER_HXX +#include <sal/config.h> + +#include <string_view> + #include <osl/mutex.hxx> #include <tools/link.hxx> #include <cppuhelper/compbase.hxx> @@ -52,7 +56,7 @@ class SalGtkPicker GtkWidget *m_pDialog; protected: /// @throws css::uno::RuntimeException - void implsetTitle( const OUString& aTitle ); + void implsetTitle( std::u16string_view aTitle ); /// @throws css::lang::IllegalArgumentException /// @throws css::uno::RuntimeException diff --git a/vcl/unx/gtk3/gtk3gtkframe.cxx b/vcl/unx/gtk3/gtk3gtkframe.cxx index bb636e7874f8..81eb8f5466a3 100644 --- a/vcl/unx/gtk3/gtk3gtkframe.cxx +++ b/vcl/unx/gtk3/gtk3gtkframe.cxx @@ -1973,7 +1973,7 @@ void GtkSalFrame::StartPresentation( bool bStart ) } m_ScreenSaverInhibitor.inhibit( bStart, - "presentation", + u"presentation", getDisplay()->IsX11Display(), aWindow, aDisplay ); diff --git a/vcl/unx/gtk3/gtk3gtkinst.cxx b/vcl/unx/gtk3/gtk3gtkinst.cxx index 7e30c1792f1e..1f59a80637cd 100644 --- a/vcl/unx/gtk3/gtk3gtkinst.cxx +++ b/vcl/unx/gtk3/gtk3gtkinst.cxx @@ -12,6 +12,8 @@ #include <deque> #include <stack> #include <string.h> +#include <string_view> + #include <osl/process.h> #include <unx/gtk/gtkdata.hxx> #include <unx/gtk/gtkinst.hxx> @@ -3271,7 +3273,7 @@ namespace return OUString(pStr, pStr ? strlen(pStr) : 0, RTL_TEXTENCODING_UTF8); } - void set_title(GtkWindow* pWindow, const OUString& rTitle) + void set_title(GtkWindow* pWindow, std::u16string_view rTitle) { gtk_window_set_title(pWindow, OUStringToOString(rTitle, RTL_TEXTENCODING_UTF8).getStr()); } @@ -3283,14 +3285,14 @@ namespace return OUString(pText, pText ? strlen(pText) : 0, RTL_TEXTENCODING_UTF8); } - void set_primary_text(GtkMessageDialog* pMessageDialog, const OUString& rText) + void set_primary_text(GtkMessageDialog* pMessageDialog, std::u16string_view rText) { g_object_set(G_OBJECT(pMessageDialog), "text", OUStringToOString(rText, RTL_TEXTENCODING_UTF8).getStr(), nullptr); } - void set_secondary_text(GtkMessageDialog* pMessageDialog, const OUString& rText) + void set_secondary_text(GtkMessageDialog* pMessageDialog, std::u16string_view rText) { g_object_set(G_OBJECT(pMessageDialog), "secondary-text", OUStringToOString(rText, RTL_TEXTENCODING_UTF8).getStr(), @@ -3507,7 +3509,7 @@ public: g_signal_handlers_unblock_by_func(a.second, reinterpret_cast<void*>(signalActivate), this); } - void insert_item(int pos, const OUString& rId, const OUString& rStr, + void insert_item(int pos, std::u16string_view rId, const OUString& rStr, const OUString* pIconName, const VirtualDevice* pImageSurface, TriState eCheckRadioFalse) { @@ -3552,7 +3554,7 @@ public: gtk_menu_reorder_child(m_pMenu, pItem, pos); } - void insert_separator(int pos, const OUString& rId) + void insert_separator(int pos, std::u16string_view rId) { GtkWidget* pItem = gtk_separator_menu_item_new(); gtk_buildable_set_name(GTK_BUILDABLE(pItem), OUStringToOString(rId, RTL_TEXTENCODING_UTF8).getStr()); @@ -9473,7 +9475,7 @@ public: OString str; int index; int col; - Search(const OUString& rText, int nCol) + Search(std::u16string_view rText, int nCol) : str(OUStringToOString(rText, RTL_TEXTENCODING_UTF8)) , index(-1) , col(nCol) @@ -9497,7 +9499,7 @@ public: return found; } - void insert_row(GtkListStore* pListStore, GtkTreeIter& iter, int pos, const OUString* pId, const OUString& rText, const OUString* pIconName, const VirtualDevice* pDevice) + void insert_row(GtkListStore* pListStore, GtkTreeIter& iter, int pos, const OUString* pId, std::u16string_view rText, const OUString* pIconName, const VirtualDevice* pDevice) { if (!pIconName && !pDevice) { @@ -10046,13 +10048,13 @@ private: } } - void set(const GtkTreeIter& iter, int col, const OUString& rText) + void set(const GtkTreeIter& iter, int col, std::u16string_view rText) { OString aStr(OUStringToOString(rText, RTL_TEXTENCODING_UTF8)); m_Setter(m_pTreeModel, const_cast<GtkTreeIter*>(&iter), col, aStr.getStr(), -1); } - void set(int pos, int col, const OUString& rText) + void set(int pos, int col, std::u16string_view rText) { GtkTreeIter iter; if (gtk_tree_model_iter_nth_child(m_pTreeModel, &iter, nullptr, pos)) @@ -14479,7 +14481,7 @@ private: return sRet; } - void set(int pos, int col, const OUString& rText) + void set(int pos, int col, std::u16string_view rText) { GtkTreeIter iter; if (gtk_tree_model_iter_nth_child(m_pTreeModel, &iter, nullptr, pos)) @@ -14489,7 +14491,7 @@ private: } } - int find(const OUString& rStr, int col, bool bSearchMRUArea) const + int find(std::u16string_view rStr, int col, bool bSearchMRUArea) const { GtkTreeIter iter; if (!gtk_tree_model_get_iter_first(m_pTreeModel, &iter)) @@ -15013,12 +15015,12 @@ private: signal_changed(); } - int find_text_including_mru(const OUString& rStr, bool bSearchMRU) const + int find_text_including_mru(std::u16string_view rStr, bool bSearchMRU) const { return find(rStr, m_nTextCol, bSearchMRU); } - int find_id_including_mru(const OUString& rId, bool bSearchMRU) const + int find_id_including_mru(std::u16string_view rId, bool bSearchMRU) const { return find(rId, m_nIdCol, bSearchMRU); } @@ -15033,7 +15035,7 @@ private: return get(pos, m_nIdCol); } - void set_id_including_mru(int pos, const OUString& rId) + void set_id_including_mru(int pos, std::u16string_view rId) { set(pos, m_nIdCol, rId); } @@ -15077,14 +15079,14 @@ private: GtkTreeIter iter; if (!gtk_tree_view_get_row_separator_func(m_pTreeView)) gtk_tree_view_set_row_separator_func(m_pTreeView, separatorFunction, this, nullptr); - insert_row(GTK_LIST_STORE(m_pTreeModel), iter, pos, &rId, "", nullptr, nullptr); + insert_row(GTK_LIST_STORE(m_pTreeModel), iter, pos, &rId, u"", nullptr, nullptr); GtkTreePath* pPath = gtk_tree_path_new_from_indices(pos, -1); m_aSeparatorRows.emplace_back(gtk_tree_row_reference_new(m_pTreeModel, pPath)); gtk_tree_path_free(pPath); enable_notify_events(); } - void insert_including_mru(int pos, const OUString& rText, const OUString* pId, const OUString* pIconName, const VirtualDevice* pImageSurface) + void insert_including_mru(int pos, std::u16string_view rText, const OUString* pId, const OUString* pIconName, const VirtualDevice* pImageSurface) { disable_notify_events(); GtkTreeIter iter; diff --git a/vcl/unx/gtk3/gtk3salprn-gtk.cxx b/vcl/unx/gtk3/gtk3salprn-gtk.cxx index dce0c36e76b7..c36df23e3691 100644 --- a/vcl/unx/gtk3/gtk3salprn-gtk.cxx +++ b/vcl/unx/gtk3/gtk3salprn-gtk.cxx @@ -33,6 +33,7 @@ #include <cstring> #include <map> +#include <string_view> namespace beans = com::sun::star::beans; namespace uno = com::sun::star::uno; @@ -285,7 +286,7 @@ lcl_setHelpText( GtkWidget* lcl_makeFrame( GtkWidget* const i_pChild, - const OUString &i_rText, + std::u16string_view i_rText, const uno::Sequence<OUString> &i_rHelpTexts, sal_Int32* const io_pCurHelpText) { diff --git a/vcl/unx/gtk3_kde5/gtk3_kde5_filepicker_ipc.cxx b/vcl/unx/gtk3_kde5/gtk3_kde5_filepicker_ipc.cxx index e9c9f4621820..4c0d23eb47bf 100644 --- a/vcl/unx/gtk3_kde5/gtk3_kde5_filepicker_ipc.cxx +++ b/vcl/unx/gtk3_kde5/gtk3_kde5_filepicker_ipc.cxx @@ -17,6 +17,10 @@ * the License at http://www.apache.org/licenses/LICENSE-2.0 . */ +#include <sal/config.h> + +#include <string_view> + #include "gtk3_kde5_filepicker_ipc.hxx" #undef Region @@ -53,7 +57,7 @@ OUString applicationDirPath() const auto utf8Path = applicationSystemPath.toUtf8(); auto ret = boost::filesystem::path(utf8Path.getStr(), utf8Path.getStr() + utf8Path.getLength()); ret.remove_filename(); - return OUString::fromUtf8(OString(ret.c_str())); + return OUString::fromUtf8(std::string_view(ret.c_str())); } OUString findPickerExecutable() @@ -72,7 +76,7 @@ OUString findPickerExecutable() void readIpcArg(std::istream& stream, OUString& str) { const auto buffer = readIpcStringArg(stream); - str = OUString::fromUtf8(OString(buffer.data(), buffer.size())); + str = OUString::fromUtf8(std::string_view(buffer.data(), buffer.size())); } void readIpcArg(std::istream& stream, css::uno::Sequence<OUString>& seq) diff --git a/vcl/workben/svpclient.cxx b/vcl/workben/svpclient.cxx index 78c6687b75d3..5bff9a819135 100644 --- a/vcl/workben/svpclient.cxx +++ b/vcl/workben/svpclient.cxx @@ -179,7 +179,7 @@ void MyWin::parseList( const OString& rList ) continue; if( aLine.startsWith( "ElementType: " ) ) - aElementType = OStringToOUString( aLine.copy( 13 ), RTL_TEXTENCODING_ASCII_US ); + aElementType = OStringToOUString( aLine.subView( 13 ), RTL_TEXTENCODING_ASCII_US ); else { OUString aNewElement = @@ -258,7 +258,7 @@ IMPL_LINK_NOARG( MyWin, SelectHdl, ListBox&, void) OString aCommand = "get " + - OUStringToOString( aEntry.copy( nPos+2 ), RTL_TEXTENCODING_ASCII_US ); + OUStringToOString( aEntry.subView( nPos+2 ), RTL_TEXTENCODING_ASCII_US ); OString aAnswer( processCommand( aCommand ) ); SvMemoryStream aStream( aAnswer.getLength() ); aStream.WriteBytes( aAnswer.getStr(), aAnswer.getLength() ); diff --git a/writerfilter/source/dmapper/LoggedResources.cxx b/writerfilter/source/dmapper/LoggedResources.cxx index c604019e0e2c..4a0886e44812 100644 --- a/writerfilter/source/dmapper/LoggedResources.cxx +++ b/writerfilter/source/dmapper/LoggedResources.cxx @@ -41,7 +41,7 @@ void LoggedResourcesHelper::startElement(const std::string& sElement) void LoggedResourcesHelper::endElement() { TagLogger::getInstance().endElement(); } -void LoggedResourcesHelper::chars(const OUString& rChars) +void LoggedResourcesHelper::chars(std::u16string_view rChars) { TagLogger::getInstance().chars(rChars); } diff --git a/writerfilter/source/dmapper/LoggedResources.hxx b/writerfilter/source/dmapper/LoggedResources.hxx index cb940800d949..52ef6a43e9d2 100644 --- a/writerfilter/source/dmapper/LoggedResources.hxx +++ b/writerfilter/source/dmapper/LoggedResources.hxx @@ -20,6 +20,10 @@ #ifndef INCLUDED_WRITERFILTER_SOURCE_DMAPPER_LOGGEDRESOURCES_HXX #define INCLUDED_WRITERFILTER_SOURCE_DMAPPER_LOGGEDRESOURCES_HXX +#include <sal/config.h> + +#include <string_view> + #include <dmapper/resourcemodel.hxx> namespace writerfilter @@ -33,7 +37,7 @@ public: void startElement(const std::string& sElement); static void endElement(); - static void chars(const OUString& rChars); + static void chars(std::u16string_view rChars); static void chars(const std::string& rChars); static void attribute(const std::string& rName, const std::string& rValue); static void attribute(const std::string& rName, sal_uInt32 nValue); diff --git a/writerfilter/source/dmapper/PropertyMap.cxx b/writerfilter/source/dmapper/PropertyMap.cxx index a29693683555..3bb0167678b8 100644 --- a/writerfilter/source/dmapper/PropertyMap.cxx +++ b/writerfilter/source/dmapper/PropertyMap.cxx @@ -16,6 +16,11 @@ * except in compliance with the License. You may obtain a copy of * the License at http://www.apache.org/licenses/LICENSE-2.0 . */ + +#include <sal/config.h> + +#include <string_view> + #include "PropertyMap.hxx" #include "TagLogger.hxx" #include <ooxml/resourceids.hxx> @@ -316,7 +321,7 @@ void PropertyMap::dumpXml() const TagLogger::getInstance().attribute( "floatValue", aFloat ); rPropPair.second.getValue() >>= auInt; - TagLogger::getInstance().attribute( "stringValue", OUString() ); + TagLogger::getInstance().attribute( "stringValue", std::u16string_view() ); } catch ( ... ) { diff --git a/writerfilter/source/dmapper/TagLogger.cxx b/writerfilter/source/dmapper/TagLogger.cxx index 6c655589d8cc..a7443f056d29 100644 --- a/writerfilter/source/dmapper/TagLogger.cxx +++ b/writerfilter/source/dmapper/TagLogger.cxx @@ -167,7 +167,7 @@ struct TheTagLogger: } #ifdef DBG_UTIL - void TagLogger::attribute(const std::string & name, const OUString & value) + void TagLogger::attribute(const std::string & name, std::u16string_view value) { attribute( name, OUStringToOString( value, RTL_TEXTENCODING_ASCII_US ).getStr() ); } @@ -218,7 +218,7 @@ struct TheTagLogger: xmlFree( xmlChars ); } - void TagLogger::chars(const OUString & rChars) + void TagLogger::chars(std::u16string_view rChars) { chars(OUStringToOString(rChars, RTL_TEXTENCODING_ASCII_US).getStr()); } diff --git a/writerfilter/source/dmapper/TagLogger.hxx b/writerfilter/source/dmapper/TagLogger.hxx index b1bba8f6166e..f28b58b59f26 100644 --- a/writerfilter/source/dmapper/TagLogger.hxx +++ b/writerfilter/source/dmapper/TagLogger.hxx @@ -24,6 +24,7 @@ #include <tools/ref.hxx> #include <com/sun/star/beans/XPropertySet.hpp> #include <string> +#include <string_view> #include <libxml/xmlwriter.h> namespace writerfilter @@ -52,11 +53,11 @@ namespace writerfilter #endif void attribute(const std::string & name, const std::string & value); #ifdef DBG_UTIL - void attribute(const std::string & name, const OUString & value); + void attribute(const std::string & name, std::u16string_view value); void attribute(const std::string & name, sal_uInt32 value); void attribute(const std::string & name, const css::uno::Any& aAny); void chars(const std::string & chars); - void chars(const OUString & chars); + void chars(std::u16string_view chars); void endElement(); #endif }; diff --git a/writerfilter/source/rtftok/rtfdispatchsymbol.cxx b/writerfilter/source/rtftok/rtfdispatchsymbol.cxx index 418498f98df3..fea4d7dac0a6 100644 --- a/writerfilter/source/rtftok/rtfdispatchsymbol.cxx +++ b/writerfilter/source/rtftok/rtfdispatchsymbol.cxx @@ -80,7 +80,7 @@ RTFError RTFDocumentImpl::dispatchSymbol(RTFKeyword nKeyword) } if (cCh > 0) { - OUString aStr(OStringToOUString(OString(char(cCh)), RTL_TEXTENCODING_MS_1252)); + OUString aStr(OStringToOUString(OStringChar(char(cCh)), RTL_TEXTENCODING_MS_1252)); text(aStr); return RTFError::OK; } diff --git a/writerperfect/qa/unit/EPUBExportTest.cxx b/writerperfect/qa/unit/EPUBExportTest.cxx index 172b9e0ac9a2..247448ba32c9 100644 --- a/writerperfect/qa/unit/EPUBExportTest.cxx +++ b/writerperfect/qa/unit/EPUBExportTest.cxx @@ -126,7 +126,7 @@ std::map<OUString, std::vector<OUString>> EPUBExportTest::parseCss(const OUStrin pStream->ReadLine(aLine); if (aLine.endsWith("{")) // '.name {' -> 'name' - aRuleName = OUString::fromUtf8(aLine.copy(1, aLine.getLength() - 3)); + aRuleName = OUString::fromUtf8(aLine.subView(1, aLine.getLength() - 3)); else if (aLine.endsWith(";")) aRet[aRuleName].push_back(OUString::fromUtf8(aLine)); } diff --git a/writerperfect/source/common/WPXSvInputStream.cxx b/writerperfect/source/common/WPXSvInputStream.cxx index ce5ff2956966..2af8475ee99e 100644 --- a/writerperfect/source/common/WPXSvInputStream.cxx +++ b/writerperfect/source/common/WPXSvInputStream.cxx @@ -27,6 +27,7 @@ #include <climits> #include <limits> #include <memory> +#include <string_view> #include <unordered_map> #include <vector> @@ -623,7 +624,7 @@ bool WPXSvInputStreamImpl::existsSubStream(const char* const name) PositionHolder pos(mxSeekable); mxSeekable->seek(0); - const OUString aName(OStringToOUString(OString(name), RTL_TEXTENCODING_UTF8)); + const OUString aName(OStringToOUString(std::string_view(name), RTL_TEXTENCODING_UTF8)); if (isOLE()) { @@ -653,7 +654,7 @@ librevenge::RVNGInputStream* WPXSvInputStreamImpl::getSubStreamByName(const char PositionHolder pos(mxSeekable); mxSeekable->seek(0); - const OUString aName(OStringToOUString(OString(name), RTL_TEXTENCODING_UTF8)); + const OUString aName(OStringToOUString(std::string_view(name), RTL_TEXTENCODING_UTF8)); if (isOLE()) { diff --git a/xmloff/source/chart/MultiPropertySetHandler.hxx b/xmloff/source/chart/MultiPropertySetHandler.hxx index ddbd9881f5de..a89e1c1ee7ed 100644 --- a/xmloff/source/chart/MultiPropertySetHandler.hxx +++ b/xmloff/source/chart/MultiPropertySetHandler.hxx @@ -22,6 +22,7 @@ #include <map> #include <memory> +#include <string_view> #include <rtl/ustring.hxx> #include <com/sun/star/beans/XPropertySet.hpp> @@ -94,7 +95,7 @@ class OUStringComparison { public: /// Compare two strings. Returns true if the first is before the second. - bool operator() (const OUString & a, const OUString & b) const + bool operator() (const OUString & a, std::u16string_view b) const { return (a.compareTo (b) < 0); } diff --git a/xmloff/source/core/xmlimp.cxx b/xmloff/source/core/xmlimp.cxx index 94eafa9f8ab2..5f1e7ec1b20a 100644 --- a/xmloff/source/core/xmlimp.cxx +++ b/xmloff/source/core/xmlimp.cxx @@ -1604,7 +1604,7 @@ bool SvXMLImport::IsODFVersionConsistent( const OUString& aODFVersion ) // the check returns sal_False only if the storage version could be retrieved bool bResult = true; - if ( !aODFVersion.isEmpty() && aODFVersion.compareTo( ODFVER_012_TEXT ) >= 0 ) + if ( !aODFVersion.isEmpty() && aODFVersion.compareTo( u"" ODFVER_012_TEXT ) >= 0 ) { // check the consistency only for the ODF1.2 and later ( according to content.xml ) // manifest.xml might have no version, it should be checked here and the correct version should be set diff --git a/xmloff/source/core/xmlmultiimagehelper.cxx b/xmloff/source/core/xmlmultiimagehelper.cxx index f48ae6e9a576..4ed4ddd96b03 100644 --- a/xmloff/source/core/xmlmultiimagehelper.cxx +++ b/xmloff/source/core/xmlmultiimagehelper.cxx @@ -31,7 +31,7 @@ namespace OUString sMimeType; if (rString.startsWith("vnd.sun.star.Package")) { - OString aExtension = OUStringToOString(rString.copy(rString.lastIndexOf(".") + 1), RTL_TEXTENCODING_ASCII_US); + OString aExtension = OUStringToOString(rString.subView(rString.lastIndexOf(".") + 1), RTL_TEXTENCODING_ASCII_US); sMimeType = comphelper::GraphicMimeTypeHelper::GetMimeTypeForExtension(aExtension); } return sMimeType; diff --git a/xmloff/source/style/GradientStyle.cxx b/xmloff/source/style/GradientStyle.cxx index 63e65f2d4965..221023d6e072 100644 --- a/xmloff/source/style/GradientStyle.cxx +++ b/xmloff/source/style/GradientStyle.cxx @@ -117,7 +117,7 @@ void XMLGradientStyleImport::importXML( break; case XML_ELEMENT(DRAW, XML_GRADIENT_ANGLE): { - auto const cmp12(rImport.GetODFVersion().compareTo(ODFVER_012_TEXT)); + auto const cmp12(rImport.GetODFVersion().compareTo(u"" ODFVER_012_TEXT)); bool const bSuccess = ::sax::Converter::convertAngle(aGradient.Angle, aStrValue, // tdf#89475 try to detect borked OOo angles diff --git a/xmloff/source/style/TransGradientStyle.cxx b/xmloff/source/style/TransGradientStyle.cxx index bae840c67348..8f7fe41d1444 100644 --- a/xmloff/source/style/TransGradientStyle.cxx +++ b/xmloff/source/style/TransGradientStyle.cxx @@ -134,7 +134,7 @@ void XMLTransGradientStyleImport::importXML( break; case XML_ELEMENT(DRAW, XML_GRADIENT_ANGLE): { - auto const cmp12(rImport.GetODFVersion().compareTo(ODFVER_012_TEXT)); + auto const cmp12(rImport.GetODFVersion().compareTo(u"" ODFVER_012_TEXT)); bool const bSuccess = ::sax::Converter::convertAngle(aGradient.Angle, aStrValue, // tdf#89475 try to detect borked OOo angles diff --git a/xmloff/source/text/txtparai.cxx b/xmloff/source/text/txtparai.cxx index aee55e50ae6c..733946a98b40 100644 --- a/xmloff/source/text/txtparai.cxx +++ b/xmloff/source/text/txtparai.cxx @@ -2072,7 +2072,7 @@ XMLNumberedParaContext::XMLNumberedParaContext( i_rImport.GetTextImport()->GetTextListHelper() ); if (m_ListId.isEmpty()) { - SAL_WARN_IF(0 <= i_rImport.GetODFVersion().compareTo("1.2"), "xmloff.text", "invalid numbered-paragraph: no list-id (1.2)"); + SAL_WARN_IF(0 <= i_rImport.GetODFVersion().compareTo(u"1.2"), "xmloff.text", "invalid numbered-paragraph: no list-id (1.2)"); m_ListId = rTextListsHelper.GetNumberedParagraphListId(m_Level, StyleName); SAL_WARN_IF(m_ListId.isEmpty(), "xmloff.text", "numbered-paragraph: no ListId"); diff --git a/xmlsecurity/inc/biginteger.hxx b/xmlsecurity/inc/biginteger.hxx index f0d1055ed176..ac411c2e53b7 100644 --- a/xmlsecurity/inc/biginteger.hxx +++ b/xmlsecurity/inc/biginteger.hxx @@ -20,6 +20,9 @@ #pragma once #include <sal/config.h> + +#include <string_view> + #include <rtl/ustring.hxx> #include <com/sun/star/uno/Sequence.h> @@ -30,7 +33,7 @@ namespace xmlsecurity { XSECXMLSEC_DLLPUBLIC OUString bigIntegerToNumericString(const css::uno::Sequence<sal_Int8>& serial); XSECXMLSEC_DLLPUBLIC css::uno::Sequence<sal_Int8> -numericStringToBigInteger(const OUString& serialNumber); +numericStringToBigInteger(std::u16string_view serialNumber); } /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/xmlsecurity/inc/xmlsec/saxhelper.hxx b/xmlsecurity/inc/xmlsec/saxhelper.hxx index e1eed377d6fa..af3d4ca259d1 100644 --- a/xmlsecurity/inc/xmlsec/saxhelper.hxx +++ b/xmlsecurity/inc/xmlsec/saxhelper.hxx @@ -20,6 +20,10 @@ #ifndef INCLUDED_XMLSECURITY_INC_XMLSEC_SAXHELPER_HXX #define INCLUDED_XMLSECURITY_INC_XMLSEC_SAXHELPER_HXX +#include <sal/config.h> + +#include <string_view> + #include <libxml/tree.h> #include <rtl/ustring.hxx> @@ -55,27 +59,27 @@ class SAXHelper final /// @throws css::xml::sax::SAXException /// @throws css::uno::RuntimeException void startElement( - const OUString& aName , + std::u16string_view aName , const css::uno::Sequence< css::xml::csax::XMLAttribute >& aAttributes ) ; /// @throws css::xml::sax::SAXException /// @throws css::uno::RuntimeException - void endElement( const OUString& aName ) ; + void endElement( std::u16string_view aName ) ; /// @throws css::xml::sax::SAXException /// @throws css::uno::RuntimeException - void characters( const OUString& aChars ) ; + void characters( std::u16string_view aChars ) ; /// @throws css::xml::sax::SAXException /// @throws css::uno::RuntimeException - void ignorableWhitespace( const OUString& aWhitespaces ) ; + void ignorableWhitespace( std::u16string_view aWhitespaces ) ; /// @throws css::xml::sax::SAXException /// @throws css::uno::RuntimeException void processingInstruction( - const OUString& aTarget , - const OUString& aData ) ; + std::u16string_view aTarget , + std::u16string_view aData ) ; } ; diff --git a/xmlsecurity/source/component/documentdigitalsignatures.cxx b/xmlsecurity/source/component/documentdigitalsignatures.cxx index ac9f25ce41c9..10e099dbf432 100644 --- a/xmlsecurity/source/component/documentdigitalsignatures.cxx +++ b/xmlsecurity/source/component/documentdigitalsignatures.cxx @@ -569,7 +569,7 @@ DocumentDigitalSignatures::ImplVerifySignatures( // collide, or PGPKeyID format might change - can't we // keep the xCert itself in rInfo? rSigInfo.Signer = xGpgSecEnv->getCertificate( - rInfo.ouGpgKeyID, xmlsecurity::numericStringToBigInteger("")); + rInfo.ouGpgKeyID, xmlsecurity::numericStringToBigInteger(u"")); rSigInfo.CertificateStatus = xGpgSecEnv->verifyCertificate( rSigInfo.Signer, Sequence<Reference<css::security::XCertificate>>()); } diff --git a/xmlsecurity/source/dialogs/digitalsignaturesdialog.cxx b/xmlsecurity/source/dialogs/digitalsignaturesdialog.cxx index ebce8634f96c..c29f43b4b91b 100644 --- a/xmlsecurity/source/dialogs/digitalsignaturesdialog.cxx +++ b/xmlsecurity/source/dialogs/digitalsignaturesdialog.cxx @@ -721,7 +721,7 @@ uno::Reference<security::XCertificate> DigitalSignaturesDialog::getCertificate(c if (!xCert.is() && xSecEnv.is()) xCert = xSecEnv->getCertificate( rInfo.ouX509IssuerName, xmlsecurity::numericStringToBigInteger( rInfo.ouX509SerialNumber ) ); if (!xCert.is() && xGpgSecEnv.is()) - xCert = xGpgSecEnv->getCertificate( rInfo.ouGpgKeyID, xmlsecurity::numericStringToBigInteger("") ); + xCert = xGpgSecEnv->getCertificate( rInfo.ouGpgKeyID, xmlsecurity::numericStringToBigInteger(u"") ); SAL_WARN_IF( !xCert.is(), "xmlsecurity.dialogs", "Certificate not found and can't be created!" ); diff --git a/xmlsecurity/source/xmlsec/biginteger.cxx b/xmlsecurity/source/xmlsec/biginteger.cxx index 0bfcbd326de1..3615eb73a54a 100644 --- a/xmlsecurity/source/xmlsec/biginteger.cxx +++ b/xmlsecurity/source/xmlsec/biginteger.cxx @@ -27,7 +27,7 @@ using namespace ::com::sun::star::uno ; namespace xmlsecurity { -Sequence< sal_Int8 > numericStringToBigInteger ( const OUString& numeral ) +Sequence< sal_Int8 > numericStringToBigInteger ( std::u16string_view numeral ) { xmlChar* chNumeral ; const xmlSecByte* bnInteger ; diff --git a/xmlsecurity/source/xmlsec/nss/securityenvironment_nssimpl.cxx b/xmlsecurity/source/xmlsec/nss/securityenvironment_nssimpl.cxx index 1a0444f638bc..ccf61e106e57 100644 --- a/xmlsecurity/source/xmlsec/nss/securityenvironment_nssimpl.cxx +++ b/xmlsecurity/source/xmlsec/nss/securityenvironment_nssimpl.cxx @@ -432,7 +432,7 @@ Sequence< Reference < XCertificate > > SecurityEnvironment_NssImpl::buildCertifi X509Certificate_NssImpl* SecurityEnvironment_NssImpl::createAndAddCertificateFromPackage( const css::uno::Sequence<sal_Int8>& raDERCertificate, - OUString const & raString) + std::u16string_view raString) { auto pCertificateBytes = reinterpret_cast<char *>(const_cast<sal_Int8 *>(raDERCertificate.getConstArray())); CERTCertificate* pCERTCertificate = CERT_DecodeCertFromPackage(pCertificateBytes, raDERCertificate.getLength()); @@ -913,7 +913,7 @@ uno::Reference<security::XCertificate> SecurityEnvironment_NssImpl::createDERCer if (!pPrivateKey) return uno::Reference<security::XCertificate>(); - X509Certificate_NssImpl* pX509Certificate = createAndAddCertificateFromPackage(raDERCertificate, "TCu,TCu,TCu"); + X509Certificate_NssImpl* pX509Certificate = createAndAddCertificateFromPackage(raDERCertificate, u"TCu,TCu,TCu"); if (!pX509Certificate) return uno::Reference<security::XCertificate>(); diff --git a/xmlsecurity/source/xmlsec/nss/securityenvironment_nssimpl.hxx b/xmlsecurity/source/xmlsec/nss/securityenvironment_nssimpl.hxx index 117e2c2945f2..fcc51072a690 100644 --- a/xmlsecurity/source/xmlsec/nss/securityenvironment_nssimpl.hxx +++ b/xmlsecurity/source/xmlsec/nss/securityenvironment_nssimpl.hxx @@ -35,6 +35,8 @@ #include <keythi.h> #include <certt.h> + +#include <string_view> #include <vector> #include <xmlsec-wrapper.h> @@ -131,7 +133,7 @@ private: static X509Certificate_NssImpl* createAndAddCertificateFromPackage( const css::uno::Sequence<sal_Int8>& raDerCertificate, - OUString const & raString); + std::u16string_view raString); static SECKEYPrivateKey* insertPrivateKey(css::uno::Sequence<sal_Int8> const & raPrivateKey); static X509Certificate_NssImpl* createX509CertificateFromDER(const css::uno::Sequence<sal_Int8>& raDerCertificate); diff --git a/xmlsecurity/source/xmlsec/saxhelper.cxx b/xmlsecurity/source/xmlsec/saxhelper.cxx index f34766666cd1..ff576db49673 100644 --- a/xmlsecurity/source/xmlsec/saxhelper.cxx +++ b/xmlsecurity/source/xmlsec/saxhelper.cxx @@ -17,6 +17,9 @@ * the License at http://www.apache.org/licenses/LICENSE-2.0 . */ +#include <sal/config.h> + +#include <string_view> #include <rtl/ustring.hxx> @@ -34,7 +37,7 @@ * The return value is NULL terminated. The application has the responsibility to * deallocate the return value. */ -static xmlChar* ous_to_xmlstr( const OUString& oustr ) +static xmlChar* ous_to_xmlstr( std::u16string_view oustr ) { OString ostr = OUStringToOString( oustr , RTL_TEXTENCODING_UTF8 ) ; return xmlStrndup( reinterpret_cast<xmlChar const *>(ostr.getStr()), static_cast<int>(ostr.getLength()) ) ; @@ -44,7 +47,7 @@ static xmlChar* ous_to_xmlstr( const OUString& oustr ) * The return value is NULL terminated. The application has the responsibility to * deallocate the return value. */ -static xmlChar* ous_to_nxmlstr( const OUString& oustr, int& length ) +static xmlChar* ous_to_nxmlstr( std::u16string_view oustr, int& length ) { OString ostr = OUStringToOString( oustr , RTL_TEXTENCODING_UTF8 ) ; length = ostr.getLength(); @@ -248,7 +251,7 @@ void SAXHelper::endDocument() * XDocumentHandler -- start an xml element */ void SAXHelper::startElement( - const OUString& aName, + std::u16string_view aName, const css::uno::Sequence< css::xml::csax::XMLAttribute >& aAttributes ) { const xmlChar* fullName = nullptr ; @@ -284,7 +287,7 @@ void SAXHelper::startElement( /** * XDocumentHandler -- end an xml element */ -void SAXHelper::endElement( const OUString& aName ) +void SAXHelper::endElement( std::u16string_view aName ) { xmlChar* fullname = ous_to_xmlstr( aName ) ; m_pSaxHandler->endElement( m_pParserCtxt , fullname ) ; @@ -299,7 +302,7 @@ void SAXHelper::endElement( const OUString& aName ) /** * XDocumentHandler -- an xml element or cdata characters */ -void SAXHelper::characters( const OUString& aChars ) +void SAXHelper::characters( std::u16string_view aChars ) { const xmlChar* chars = nullptr ; int length = 0 ; @@ -316,7 +319,7 @@ void SAXHelper::characters( const OUString& aChars ) /** * XDocumentHandler -- ignorable xml white space */ -void SAXHelper::ignorableWhitespace( const OUString& aWhitespaces ) +void SAXHelper::ignorableWhitespace( std::u16string_view aWhitespaces ) { const xmlChar* chars = nullptr ; int length = 0 ; @@ -334,8 +337,8 @@ void SAXHelper::ignorableWhitespace( const OUString& aWhitespaces ) * XDocumentHandler -- preprocessing instruction */ void SAXHelper::processingInstruction( - const OUString& aTarget, - const OUString& aData ) + std::u16string_view aTarget, + std::u16string_view aData ) { xmlChar* target = nullptr ; xmlChar* data = nullptr ; diff --git a/xmlsecurity/source/xmlsec/xmldocumentwrapper_xmlsecimpl.cxx b/xmlsecurity/source/xmlsec/xmldocumentwrapper_xmlsecimpl.cxx index b7313cbad8ff..800724a84051 100644 --- a/xmlsecurity/source/xmlsec/xmldocumentwrapper_xmlsecimpl.cxx +++ b/xmlsecurity/source/xmlsec/xmldocumentwrapper_xmlsecimpl.cxx @@ -53,7 +53,7 @@ XMLDocumentWrapper_XmlSecImpl::XMLDocumentWrapper_XmlSecImpl() /* * creates the virtual root element */ - saxHelper.startElement("root", uno::Sequence<css::xml::csax::XMLAttribute>()); + saxHelper.startElement(u"root", uno::Sequence<css::xml::csax::XMLAttribute>()); m_pRootElement = saxHelper.getCurrentNode(); m_pCurrentElement = m_pRootElement; diff --git a/xmlsecurity/workben/pdfverify.cxx b/xmlsecurity/workben/pdfverify.cxx index d98a2fb1750e..16856129fa5e 100644 --- a/xmlsecurity/workben/pdfverify.cxx +++ b/xmlsecurity/workben/pdfverify.cxx @@ -8,6 +8,7 @@ */ #include <iostream> +#include <string_view> #include <com/sun/star/lang/XMultiServiceFactory.hpp> #include <com/sun/star/uno/XComponentContext.hpp> @@ -33,7 +34,7 @@ using namespace com::sun::star; namespace { /// Does PDF to PNG conversion using pdfium. -void generatePreview(const OString& rPdfPath, const OString& rPngPath) +void generatePreview(std::string_view rPdfPath, std::string_view rPngPath) { GraphicFilter& rFilter = GraphicFilter::GetGraphicFilter(); Graphic aGraphic; |