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 /include | |
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>
Diffstat (limited to 'include')
42 files changed, 180 insertions, 59 deletions
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); |