summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--codemaker/source/javamaker/javatype.cxx2
-rw-r--r--connectivity/source/drivers/postgresql/pq_preparedstatement.cxx2
-rw-r--r--i18npool/source/breakiterator/breakiterator_unicode.cxx2
-rw-r--r--i18npool/source/breakiterator/xdictionary.cxx4
-rw-r--r--i18npool/source/localedata/localedata.cxx10
-rw-r--r--idlc/source/options.cxx5
-rw-r--r--include/rtl/strbuf.hxx19
-rw-r--r--include/rtl/string.hxx25
-rw-r--r--include/rtl/stringconcat.hxx87
-rw-r--r--include/rtl/ustrbuf.hxx19
-rw-r--r--include/rtl/ustring.hxx25
-rw-r--r--oox/source/core/relationshandler.cxx6
-rw-r--r--opencl/source/openclwrapper.cxx2
-rw-r--r--sal/qa/rtl/strings/test_ostring_concat.cxx17
-rw-r--r--sal/qa/rtl/strings/test_oustring_concat.cxx18
-rw-r--r--sdext/source/pdfimport/sax/emitcontext.cxx2
-rw-r--r--sfx2/source/appl/appuno.cxx4
-rw-r--r--stoc/source/uriproc/UriSchemeParser_vndDOTsunDOTstarDOTscript.cxx2
-rw-r--r--svtools/source/svhtml/htmlout.cxx2
-rw-r--r--sw/source/filter/html/htmlftn.cxx2
-rw-r--r--tools/source/fsys/urlobj.cxx8
-rw-r--r--ucb/source/ucp/webdav/SerfPutReqProcImpl.cxx2
-rw-r--r--vcl/source/gdi/pdfwriter_impl.cxx2
-rw-r--r--vcl/source/opengl/OpenGLHelper.cxx2
24 files changed, 172 insertions, 97 deletions
diff --git a/codemaker/source/javamaker/javatype.cxx b/codemaker/source/javamaker/javatype.cxx
index f800d7365852..3fdf79abe300 100644
--- a/codemaker/source/javamaker/javatype.cxx
+++ b/codemaker/source/javamaker/javatype.cxx
@@ -379,7 +379,7 @@ void MethodDescriptor::addTypeParameter(OUString const & name) {
}
OString MethodDescriptor::getDescriptor() const {
- return rtl::OStringView(m_descriptorStart) + m_descriptorEnd;
+ return m_descriptorStart + m_descriptorEnd;
}
diff --git a/connectivity/source/drivers/postgresql/pq_preparedstatement.cxx b/connectivity/source/drivers/postgresql/pq_preparedstatement.cxx
index 30d386a6cd3c..5c827b3bc0b7 100644
--- a/connectivity/source/drivers/postgresql/pq_preparedstatement.cxx
+++ b/connectivity/source/drivers/postgresql/pq_preparedstatement.cxx
@@ -489,7 +489,7 @@ void PreparedStatement::setBytes(
*this, OUString(), 1, Any() );
}
m_vars[parameterIndex-1]
- = "'" + rtl::OStringView(reinterpret_cast<char *>(escapedString.get()), len -1) + "'";
+ = OString::Concat("'") + std::string_view(reinterpret_cast<char *>(escapedString.get()), len -1) + "'";
}
diff --git a/i18npool/source/breakiterator/breakiterator_unicode.cxx b/i18npool/source/breakiterator/breakiterator_unicode.cxx
index 7c79b99ec028..bb8d7d9862aa 100644
--- a/i18npool/source/breakiterator/breakiterator_unicode.cxx
+++ b/i18npool/source/breakiterator/breakiterator_unicode.cxx
@@ -199,7 +199,7 @@ void BreakIterator_Unicode::loadICUBreakIterator(const css::lang::Locale& rLocal
}
status = U_ZERO_ERROR;
- OString aUDName = rtl::OStringView(rule) + "_" + aLanguage;
+ OString aUDName = OString::Concat(rule) + "_" + aLanguage;
UDataMemory* pUData = udata_open("OpenOffice", "brk", aUDName.getStr(), &status);
if( U_SUCCESS(status) )
rbi = std::make_shared<OOoRuleBasedBreakIterator>( pUData, status);
diff --git a/i18npool/source/breakiterator/xdictionary.cxx b/i18npool/source/breakiterator/xdictionary.cxx
index a57a3b0d4a4d..e8d732c882b2 100644
--- a/i18npool/source/breakiterator/xdictionary.cxx
+++ b/i18npool/source/breakiterator/xdictionary.cxx
@@ -166,11 +166,11 @@ void xdictionary::initDictionaryData(const char *pLang)
#ifdef SAL_DLLPREFIX
OString sModuleName = // mostly "lib*.so" (with * == dict_zh)
- SAL_DLLPREFIX
+ OString::Concat(SAL_DLLPREFIX "dict_") + pLang + SAL_DLLEXTENSION;
#else
OString sModuleName = // mostly "*.dll" (with * == dict_zh)
+ OString::Concat("dict_") + pLang + SAL_DLLEXTENSION;
#endif
- "dict_" + rtl::OStringView(pLang) + SAL_DLLEXTENSION;
aEntry.mhModule = osl_loadModuleRelativeAscii( &thisModule, sModuleName.getStr(), SAL_LOADMODULE_DEFAULT );
if( aEntry.mhModule ) {
oslGenericFunction func;
diff --git a/i18npool/source/localedata/localedata.cxx b/i18npool/source/localedata/localedata.cxx
index d98a2e840460..61d04abbdfc0 100644
--- a/i18npool/source/localedata/localedata.cxx
+++ b/i18npool/source/localedata/localedata.cxx
@@ -550,7 +550,7 @@ oslGenericFunction lcl_LookupTableHelper::getFunctionSymbolByName(
{
(*pOutCachedItem).reset(new LocaleDataLookupTableItem( rCurrent ));
(*pOutCachedItem)->localeName = i.pLocale;
- OString sSymbolName = rtl::OStringView(pFunction) + "_" +
+ OString sSymbolName = OString::Concat(pFunction) + "_" +
(*pOutCachedItem)->localeName;
return (*pOutCachedItem)->module->getFunctionSymbol(
sSymbolName.getStr());
@@ -563,10 +563,10 @@ oslGenericFunction lcl_LookupTableHelper::getFunctionSymbolByName(
// Library not loaded, load it and add it to the list.
#ifdef SAL_DLLPREFIX
OString sModuleName = // mostly "lib*.so"
- SAL_DLLPREFIX + rtl::OStringView(i.pLib) + SAL_DLLEXTENSION;
+ OString::Concat(SAL_DLLPREFIX) + i.pLib + SAL_DLLEXTENSION;
#else
OString sModuleName = // mostly "*.dll"
- rtl::OStringView(i.pLib) + SAL_DLLEXTENSION;
+ OString::Concat(i.pLib) + SAL_DLLEXTENSION;
#endif
std::unique_ptr<osl::Module> module(new osl::Module());
if ( module->loadRelative(&thisModule, sModuleName.getStr()) )
@@ -578,7 +578,7 @@ oslGenericFunction lcl_LookupTableHelper::getFunctionSymbolByName(
if( pOutCachedItem )
{
pOutCachedItem->reset(new LocaleDataLookupTableItem( maLookupTable.back() ));
- OString sSymbolName = rtl::OStringView(pFunction) + "_" + (*pOutCachedItem)->localeName;
+ OString sSymbolName = OString::Concat(pFunction) + "_" + (*pOutCachedItem)->localeName;
return pTmpModule->getFunctionSymbol(sSymbolName.getStr());
}
else
@@ -1436,7 +1436,7 @@ oslGenericFunction LocaleDataImpl::getFunctionSymbol( const Locale& rLocale, con
if (cachedItem && cachedItem->equals(rLocale))
{
- OString sSymbolName = rtl::OStringView(pFunction) + "_" +
+ OString sSymbolName = OString::Concat(pFunction) + "_" +
cachedItem->localeName;
return cachedItem->module->getFunctionSymbol(sSymbolName.getStr());
}
diff --git a/idlc/source/options.cxx b/idlc/source/options.cxx
index 2f2e3bb1e6f9..0ab0a9cc32d2 100644
--- a/idlc/source/options.cxx
+++ b/idlc/source/options.cxx
@@ -17,6 +17,9 @@
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
+#include <sal/config.h>
+
+#include <string_view>
#include <options.hxx>
@@ -285,7 +288,7 @@ bool Options::initOptions(std::vector< std::string > & rArgs)
{
return badOption("invalid", option);
}
- OString param = "-D" + rtl::OStringView((*first).c_str(), (*first).size());
+ OString param = OString::Concat("-D") + std::string_view((*first).c_str(), (*first).size());
if (m_options.count("-D") > 0)
{
param = m_options["-D"] + " " + param;
diff --git a/include/rtl/strbuf.hxx b/include/rtl/strbuf.hxx
index 2a303ce998e6..e7e6cc01a2d0 100644
--- a/include/rtl/strbuf.hxx
+++ b/include/rtl/strbuf.hxx
@@ -1035,13 +1035,6 @@ public:
*pInternalCapacity = &nCapacity;
}
-#if defined LIBO_INTERNAL_ONLY
- explicit operator OStringView() const
- {
- return OStringView(getStr(), getLength());
- }
-#endif
-
private:
/**
A pointer to the data structure which contains the data.
@@ -1054,6 +1047,18 @@ private:
sal_Int32 nCapacity;
};
+#if defined LIBO_INTERNAL_ONLY
+template<> struct ToStringHelper<OStringBuffer> {
+ static std::size_t length(OStringBuffer const & s) { return s.getLength(); }
+
+ static char * addData(char * buffer, OStringBuffer const & s) SAL_RETURNS_NONNULL
+ { return addDataHelper(buffer, s.getStr(), s.getLength()); }
+
+ static constexpr bool allowOStringConcat = true;
+ static constexpr bool allowOUStringConcat = false;
+};
+#endif
+
}
#ifdef RTL_STRING_UNITTEST
diff --git a/include/rtl/string.hxx b/include/rtl/string.hxx
index 35eccfc073c3..60485fbdfb96 100644
--- a/include/rtl/string.hxx
+++ b/include/rtl/string.hxx
@@ -1900,6 +1900,31 @@ public:
#if defined LIBO_INTERNAL_ONLY
operator std::string_view() const { return {getStr(), sal_uInt32(getLength())}; }
#endif
+
+#if defined LIBO_INTERNAL_ONLY
+ // A wrapper for the first expression in an
+ //
+ // OString::Concat(e1) + e2 + ...
+ //
+ // concatenation chain, when neither of the first two e1, e2 is one of our rtl string-related
+ // classes (so something like
+ //
+ // OString s = "a" + (b ? std::string_view("c" : "dd");
+ //
+ // would not compile):
+ template<typename T> [[nodiscard]] static
+ typename std::enable_if_t<
+ ToStringHelper<T>::allowOStringConcat, OStringConcat<OStringConcatMarker, T>>
+ Concat(T const & value) { return OStringConcat<OStringConcatMarker, T>({}, value); }
+
+ // This overload is needed so that an argument of type 'char const[N]' ends up as
+ // 'OStringConcat<rtl::OStringConcatMarker, char const[N]>' rather than as
+ // 'OStringConcat<rtl::OStringConcatMarker, char[N]>':
+ template<typename T, std::size_t N> [[nodiscard]] static
+ typename std::enable_if_t<
+ ToStringHelper<T[N]>::allowOStringConcat, OStringConcat<OStringConcatMarker, T[N]>>
+ Concat(T (& value)[N]) { return OStringConcat<OStringConcatMarker, T[N]>({}, value); }
+#endif
};
/* ======================================================================= */
diff --git a/include/rtl/stringconcat.hxx b/include/rtl/stringconcat.hxx
index f5c9a4d33a52..e2cba5d86f0d 100644
--- a/include/rtl/stringconcat.hxx
+++ b/include/rtl/stringconcat.hxx
@@ -490,63 +490,52 @@ struct ToStringHelper< OUStringNumber< T > >
static const bool allowOUStringConcat = true;
};
-// Abstractions over null-terminated char and sal_Unicode strings that sometimes are needed in
-// concatenations of multiple such raw strings, as in
-//
-// char const * s1, s2;
-// OString s = OStringView(s1) + s2;
-//
-// (Providing specializations of ToStringHelper<std::string_view> and
-// ToStringHelper<std::u16string_view> would look dubious, as it would give meaning to expressions
-// like
-//
-// std::string_view(s1) + s2
-//
-// that do not involve any user-defined types.)
-
-class OStringView {
-public:
- explicit OStringView(char const * s): view_(s) {}
- explicit OStringView(char const * s, size_t len): view_(s, len) {}
-
- std::size_t length() const { return view_.length(); }
-
- char const * data() const { return view_.data(); }
-
-private:
- std::string_view view_;
+template<> struct ToStringHelper<std::string_view> {
+ static constexpr std::size_t length(std::string_view s) { return s.size(); }
+
+ static char * addData(char * buffer, std::string_view s) SAL_RETURNS_NONNULL
+ { return addDataHelper(buffer, s.data(), s.size()); }
+
+ static constexpr bool allowOStringConcat = true;
+ static constexpr bool allowOUStringConcat = false;
};
-template<>
-struct ToStringHelper< OStringView >
- {
- static std::size_t length( const OStringView& v ) { return v.length(); }
- static char* addData( char* buffer, const OStringView& v ) SAL_RETURNS_NONNULL { return addDataHelper( buffer, v.data(), v.length() ); }
- static const bool allowOStringConcat = true;
- static const bool allowOUStringConcat = false;
- };
+template<> struct ToStringHelper<std::u16string_view> {
+ static constexpr std::size_t length(std::u16string_view s) { return s.size(); }
+
+ static sal_Unicode * addData(sal_Unicode * buffer, std::u16string_view s) SAL_RETURNS_NONNULL
+ { return addDataHelper(buffer, s.data(), s.size()); }
+
+ static constexpr bool allowOStringConcat = false;
+ static constexpr bool allowOUStringConcat = true;
+};
-class OUStringView {
-public:
- explicit OUStringView(sal_Unicode const * s): view_(s) {}
- explicit OUStringView(sal_Unicode const * s, size_t len): view_(s, len) {}
+// An internal marker class used by OString::Concat:
+struct OStringConcatMarker {};
- std::size_t length() const { return view_.length(); }
+template<> struct ToStringHelper<OStringConcatMarker> {
+ static constexpr std::size_t length(OStringConcatMarker) { return 0; }
- sal_Unicode const * data() const { return view_.data(); }
+ static constexpr char * addData(char * buffer, OStringConcatMarker) SAL_RETURNS_NONNULL
+ { return buffer; }
-private:
- std::u16string_view view_;
+ static constexpr bool allowOStringConcat = true;
+ static constexpr bool allowOUStringConcat = false;
};
-template<>
-struct ToStringHelper< OUStringView >
- {
- static std::size_t length( const OUStringView& v ) { return v.length(); }
- static sal_Unicode* addData( sal_Unicode* buffer, const OUStringView& v ) SAL_RETURNS_NONNULL { return addDataHelper( buffer, v.data(), v.length() ); }
- static const bool allowOStringConcat = false;
- static const bool allowOUStringConcat = true;
- };
+// An internal marker class used by OUString::Concat:
+struct OUStringConcatMarker {};
+
+template<> struct ToStringHelper<OUStringConcatMarker> {
+ static constexpr std::size_t length(OUStringConcatMarker) { return 0; }
+
+ static constexpr sal_Unicode * addData(sal_Unicode * buffer, OUStringConcatMarker)
+ SAL_RETURNS_NONNULL
+ { return buffer; }
+
+ static constexpr bool allowOStringConcat = false;
+ static constexpr bool allowOUStringConcat = true;
+};
} // namespace
diff --git a/include/rtl/ustrbuf.hxx b/include/rtl/ustrbuf.hxx
index 9e8a586279b0..a4936b8fd186 100644
--- a/include/rtl/ustrbuf.hxx
+++ b/include/rtl/ustrbuf.hxx
@@ -1643,13 +1643,6 @@ public:
return OUStringBuffer( pNew, count + 16 );
}
-#if defined LIBO_INTERNAL_ONLY
- explicit operator OUStringView() const
- {
- return OUStringView(getStr(), getLength());
- }
-#endif
-
private:
OUStringBuffer( rtl_uString * value, const sal_Int32 capacity )
{
@@ -1669,6 +1662,18 @@ private:
};
#if defined LIBO_INTERNAL_ONLY
+template<> struct ToStringHelper<OUStringBuffer> {
+ static std::size_t length(OUStringBuffer const & s) { return s.getLength(); }
+
+ static sal_Unicode * addData(sal_Unicode * buffer, OUStringBuffer const & s) SAL_RETURNS_NONNULL
+ { return addDataHelper(buffer, s.getStr(), s.getLength()); }
+
+ static constexpr bool allowOStringConcat = false;
+ static constexpr bool allowOUStringConcat = true;
+};
+#endif
+
+#if defined LIBO_INTERNAL_ONLY
// Define this here to avoid circular includes
inline OUString & OUString::operator+=( const OUStringBuffer & str ) &
{
diff --git a/include/rtl/ustring.hxx b/include/rtl/ustring.hxx
index 229ed22aeb45..b99cf758ed8b 100644
--- a/include/rtl/ustring.hxx
+++ b/include/rtl/ustring.hxx
@@ -3693,6 +3693,31 @@ public:
operator std::u16string_view() const { return {getStr(), sal_uInt32(getLength())}; }
#endif
+#if defined LIBO_INTERNAL_ONLY
+ // A wrapper for the first expression in an
+ //
+ // OUString::Concat(e1) + e2 + ...
+ //
+ // concatenation chain, when neither of the first two e1, e2 is one of our rtl string-related
+ // classes (so something like
+ //
+ // OUString s = "a" + (b ? std::u16string_view(u"c" : u"dd");
+ //
+ // would not compile):
+ template<typename T> [[nodiscard]] static
+ typename std::enable_if_t<
+ ToStringHelper<T>::allowOUStringConcat, OUStringConcat<OUStringConcatMarker, T>>
+ Concat(T const & value) { return OUStringConcat<OUStringConcatMarker, T>({}, value); }
+
+ // This overload is needed so that an argument of type 'char const[N]' ends up as
+ // 'OUStringConcat<rtl::OUStringConcatMarker, char const[N]>' rather than as
+ // 'OUStringConcat<rtl::OUStringConcatMarker, char[N]>':
+ template<typename T, std::size_t N> [[nodiscard]] static
+ typename std::enable_if_t<
+ ToStringHelper<T[N]>::allowOUStringConcat, OUStringConcat<OUStringConcatMarker, T[N]>>
+ Concat(T (& value)[N]) { return OUStringConcat<OUStringConcatMarker, T[N]>({}, value); }
+#endif
+
private:
OUString & internalAppend( rtl_uString* pOtherData )
{
diff --git a/oox/source/core/relationshandler.cxx b/oox/source/core/relationshandler.cxx
index af6481c3b576..90f3ebcef21c 100644
--- a/oox/source/core/relationshandler.cxx
+++ b/oox/source/core/relationshandler.cxx
@@ -19,6 +19,8 @@
#include <sal/config.h>
+#include <string_view>
+
#include <oox/core/relationshandler.hxx>
#include <sal/log.hxx>
@@ -41,9 +43,9 @@ namespace {
OUString lclGetRelationsPath( const OUString& rFragmentPath )
{
sal_Int32 nPathLen = ::std::max< sal_Int32 >( rFragmentPath.lastIndexOf( '/' ) + 1, 0 );
- return rtl::OUStringView(rFragmentPath.getStr(), nPathLen ) + // file path including slash
+ return OUString::Concat(std::u16string_view(rFragmentPath.getStr(), nPathLen )) + // file path including slash
"_rels/" + // additional '_rels/' path
- rtl::OUStringView(rFragmentPath.getStr() + nPathLen) + // file name after path
+ std::u16string_view(rFragmentPath.getStr() + nPathLen) + // file name after path
".rels"; // '.rels' suffix
}
diff --git a/opencl/source/openclwrapper.cxx b/opencl/source/openclwrapper.cxx
index aea040c73036..c7ac9525d620 100644
--- a/opencl/source/openclwrapper.cxx
+++ b/opencl/source/openclwrapper.cxx
@@ -185,7 +185,7 @@ OString createFileName(cl_device_id deviceId, const char* clFileName)
platformVersion, nullptr);
// create hash for deviceName + driver version + platform version
- OString aString = rtl::OStringView(deviceName) + driverVersion + platformVersion;
+ OString aString = OString::Concat(deviceName) + driverVersion + platformVersion;
OString aHash = generateMD5(aString.getStr(), aString.getLength());
return getCacheFolder() + fileName + "-" + aHash + ".bin";
diff --git a/sal/qa/rtl/strings/test_ostring_concat.cxx b/sal/qa/rtl/strings/test_ostring_concat.cxx
index 1e7ae6da25e4..e5872654b58d 100644
--- a/sal/qa/rtl/strings/test_ostring_concat.cxx
+++ b/sal/qa/rtl/strings/test_ostring_concat.cxx
@@ -65,6 +65,8 @@ void test::ostring::StringConcat::checkConcat()
CPPUNIT_ASSERT_EQUAL(( typeid( OStringConcat< OString, const char[ 4 ] > )), typeid( OString( "foo" ) + "bar" ));
CPPUNIT_ASSERT_EQUAL( OString( "foobarbaz" ), OString( OString( "foo" ) + "bar" + "baz" ));
CPPUNIT_ASSERT_EQUAL(( typeid( OStringConcat< OStringConcat< OString, const char[ 4 ] >, const char[ 4 ] > )), typeid( OString( "foo" ) + "bar" + "baz" ));
+ CPPUNIT_ASSERT_EQUAL( OString( "foobar" ), OString( OStringBuffer( "foo" ) + "bar" ));
+ CPPUNIT_ASSERT_EQUAL(( typeid( OStringConcat< OStringBuffer, const char[ 4 ] > )), typeid( OStringBuffer( "foo" ) + "bar" ));
CPPUNIT_ASSERT_EQUAL( OString( "foobar" ), OString( OStringLiteral( "foo" ) + "bar" ));
CPPUNIT_ASSERT_EQUAL(( typeid( OStringConcat< OStringLiteral, const char[ 4 ] > )), typeid( OStringLiteral( "foo" ) + "bar" ));
CPPUNIT_ASSERT_EQUAL( OString( "foobar" ), OString( OStringLiteral( "foo" ) + static_cast<const char*>("bar") ));
@@ -83,8 +85,16 @@ void test::ostring::StringConcat::checkConcat()
CPPUNIT_ASSERT_EQUAL(( typeid( OStringConcat< OString, char* > )), typeid( OString( "foo" ) + d4 ));
CPPUNIT_ASSERT_EQUAL( OString( "fooabc" ), OString( OString( "foo" ) + d4 ));
CPPUNIT_ASSERT_EQUAL(( typeid( OStringConcat< OString, char* > )), typeid( OString( "foo" ) + d4 ));
- CPPUNIT_ASSERT_EQUAL( OString( "fooabc" ), OString( rtl::OStringView( "foo" ) + d4 ));
- CPPUNIT_ASSERT_EQUAL(( typeid( OStringConcat< rtl::OStringView, char* > )), typeid( rtl::OStringView( "foo" ) + d4 ));
+ CPPUNIT_ASSERT_EQUAL( OString( "foobar" ), OString( OString::Concat( "foo" ) + "bar" ));
+ CPPUNIT_ASSERT_EQUAL(( typeid( OStringConcat< OStringConcat< OStringConcatMarker, const char[ 4 ] >, const char[ 4 ] > )), typeid( OString::Concat( "foo" ) + "bar" ));
+ CPPUNIT_ASSERT_EQUAL( OString( "xyzbar" ), OString( OString::Concat( d1 ) + "bar" ));
+ CPPUNIT_ASSERT_EQUAL(( typeid( OStringConcat< OStringConcat< OStringConcatMarker, const char[ 4 ] >, const char[ 4 ] > )), typeid( OString::Concat( d1 ) + "bar" ));
+ CPPUNIT_ASSERT_EQUAL( OString( "abcbar" ), OString( OString::Concat( d2 ) + "bar" ));
+ CPPUNIT_ASSERT_EQUAL(( typeid( OStringConcat< OStringConcat< OStringConcatMarker, char[ 4 ] >, const char[ 4 ] > )), typeid( OString::Concat( d2 ) + "bar" ));
+ CPPUNIT_ASSERT_EQUAL( OString( "xyzbar" ), OString( OString::Concat( d3 ) + "bar" ));
+ CPPUNIT_ASSERT_EQUAL(( typeid( OStringConcat< OStringConcat< OStringConcatMarker, const char* >, const char[ 4 ] > )), typeid( OString::Concat( d3 ) + "bar" ));
+ CPPUNIT_ASSERT_EQUAL( OString( "abcbar" ), OString( OString::Concat( d4 ) + "bar" ));
+ CPPUNIT_ASSERT_EQUAL(( typeid( OStringConcat< OStringConcat< OStringConcatMarker, char* >, const char[ 4 ] > )), typeid( OString::Concat( d4 ) + "bar" ));
CPPUNIT_ASSERT_EQUAL( OString( "num10" ), OString( OString( "num" ) + OString::number( 10 )));
CPPUNIT_ASSERT_EQUAL(( typeid( OStringConcat< OString, OStringNumber< int > > )), typeid( OString( "num" ) + OString::number( 10 )));
@@ -155,11 +165,10 @@ void test::ostring::StringConcat::checkAppend()
void test::ostring::StringConcat::checkInvalid()
{
CPPUNIT_ASSERT( !INVALID_CONCAT( OString() + OString()));
- CPPUNIT_ASSERT( INVALID_CONCAT( OString( "a" ) + OStringBuffer( "b" )));
CPPUNIT_ASSERT( INVALID_CONCAT( OString( "a" ) + OUString( "b" )));
CPPUNIT_ASSERT( INVALID_CONCAT( OString( "a" ) + OUStringBuffer( "b" )));
CPPUNIT_ASSERT( INVALID_CONCAT( OString( "a" ) + OUStringLiteral( u"b" )));
- CPPUNIT_ASSERT( INVALID_CONCAT( OString( "a" ) + rtl::OUStringView( u"b" )));
+ CPPUNIT_ASSERT( INVALID_CONCAT( OString( "a" ) + OUString::Concat( u"b" )));
CPPUNIT_ASSERT( INVALID_CONCAT( OString( "a" ) + 1 ));
rtl_String* rs = nullptr;
rtl_uString* rus = nullptr;
diff --git a/sal/qa/rtl/strings/test_oustring_concat.cxx b/sal/qa/rtl/strings/test_oustring_concat.cxx
index 4ffe20966a09..5203d0b6b5f0 100644
--- a/sal/qa/rtl/strings/test_oustring_concat.cxx
+++ b/sal/qa/rtl/strings/test_oustring_concat.cxx
@@ -66,6 +66,8 @@ void test::oustring::StringConcat::checkConcat()
CPPUNIT_ASSERT_EQUAL(( typeid( OUStringConcat< OUString, const char[ 4 ] > )), typeid( OUString( "foo" ) + "bar" ));
CPPUNIT_ASSERT_EQUAL( OUString( "foobarbaz" ), OUString( OUString( "foo" ) + "bar" + "baz" ));
CPPUNIT_ASSERT_EQUAL(( typeid( OUStringConcat< OUStringConcat< OUString, const char[ 4 ] >, const char[ 4 ] > )), typeid( OUString( "foo" ) + "bar" + "baz" ));
+ CPPUNIT_ASSERT_EQUAL( OUString( "foobar" ), OUString( OUStringBuffer( "foo" ) + "bar" ));
+ CPPUNIT_ASSERT_EQUAL(( typeid( OUStringConcat< OUStringBuffer, const char[ 4 ] > )), typeid( OUStringBuffer( "foo" ) + "bar" ));
CPPUNIT_ASSERT_EQUAL( OUString( "foobar" ), OUString( OUStringLiteral( u"foo" ) + "bar" ));
CPPUNIT_ASSERT_EQUAL(( typeid( OUStringConcat< OUStringLiteral, const char[ 4 ] > )), typeid( OUStringLiteral( u"foo" ) + "bar" ));
const char d1[] = "xyz";
@@ -74,8 +76,17 @@ void test::oustring::StringConcat::checkConcat()
const sal_Unicode* d2 = u"xyz";
CPPUNIT_ASSERT_EQUAL( OUString( "fooxyz" ), OUString( OUString( "foo" ) + d2 ));
CPPUNIT_ASSERT_EQUAL(( typeid( OUStringConcat< OUString, const sal_Unicode* > )), typeid( OUString( "foo" ) + d2 ));
- CPPUNIT_ASSERT_EQUAL( OUString( "fooxyz" ), OUString( rtl::OUStringView( u"foo" ) + d2 ));
- CPPUNIT_ASSERT_EQUAL(( typeid( OUStringConcat< rtl::OUStringView, const sal_Unicode* > )), typeid( rtl::OUStringView( u"foo" ) + d2 ));
+ const sal_Unicode d3[] = u"xyz";
+ CPPUNIT_ASSERT_EQUAL( OUString( "foobar" ), OUString( OUString::Concat( "foo" ) + "bar" ));
+ CPPUNIT_ASSERT_EQUAL(( typeid( OUStringConcat< OUStringConcat< rtl::OUStringConcatMarker, const char[ 4 ] >, const char[ 4 ] > )), typeid( OUString::Concat( "foo" ) + "bar" ));
+ CPPUNIT_ASSERT_EQUAL( OUString( "xyzbar" ), OUString( OUString::Concat( d1 ) + "bar" ));
+ CPPUNIT_ASSERT_EQUAL(( typeid( OUStringConcat< OUStringConcat< rtl::OUStringConcatMarker, const char[ 4 ] >, const char[ 4 ] > )), typeid( OUString::Concat( d1 ) + "bar" ));
+ CPPUNIT_ASSERT_EQUAL( OUString( "foobar" ), OUString( OUString::Concat( u"foo" ) + "bar" ));
+ CPPUNIT_ASSERT_EQUAL(( typeid( OUStringConcat< OUStringConcat< rtl::OUStringConcatMarker, const sal_Unicode[ 4 ] >, const char[ 4 ] > )), typeid( OUString::Concat( u"foo" ) + "bar" ));
+ CPPUNIT_ASSERT_EQUAL( OUString( "xyzbar" ), OUString( OUString::Concat( d2 ) + "bar" ));
+ CPPUNIT_ASSERT_EQUAL(( typeid( OUStringConcat< OUStringConcat< rtl::OUStringConcatMarker, const sal_Unicode* >, const char[ 4 ] > )), typeid( OUString::Concat( d2 ) + "bar" ));
+ CPPUNIT_ASSERT_EQUAL( OUString( "xyzbar" ), OUString( OUString::Concat( d3 ) + "bar" ));
+ CPPUNIT_ASSERT_EQUAL(( typeid( OUStringConcat< OUStringConcat< rtl::OUStringConcatMarker, const sal_Unicode[ 4 ] >, const char[ 4 ] > )), typeid( OUString::Concat( d3 ) + "bar" ));
CPPUNIT_ASSERT_EQUAL( OUString( "num10" ), OUString( OUString( "num" ) + OUString::number( 10 )));
CPPUNIT_ASSERT_EQUAL(( typeid( OUStringConcat< OUString, OUStringNumber< int > > )), typeid( OUString( "num" ) + OUString::number( 10 )));
@@ -164,7 +175,6 @@ void test::oustring::StringConcat::checkAppend()
void test::oustring::StringConcat::checkInvalid()
{
CPPUNIT_ASSERT( !INVALID_CONCAT( OUString() + OUString()));
- CPPUNIT_ASSERT( INVALID_CONCAT( OUString( "a" ) + OUStringBuffer( "b" )));
CPPUNIT_ASSERT( INVALID_CONCAT( OUString( "a" ) + OString( "b" )));
CPPUNIT_ASSERT( INVALID_CONCAT( OUString( "a" ) + OStringBuffer( "b" )));
CPPUNIT_ASSERT( INVALID_CONCAT( OUString( "a" ) + static_cast<const char*>("b") ));
@@ -172,7 +182,7 @@ void test::oustring::StringConcat::checkInvalid()
CPPUNIT_ASSERT( INVALID_CONCAT( OUString( "a" ) + d ));
CPPUNIT_ASSERT( INVALID_CONCAT( OUString( "a" ) + static_cast<char*>(d) ));
CPPUNIT_ASSERT( INVALID_CONCAT( OUString( "a" ) + OStringLiteral( "b" )));
- CPPUNIT_ASSERT( INVALID_CONCAT( OUString( "a" ) + rtl::OStringView( "b" )));
+ CPPUNIT_ASSERT( INVALID_CONCAT( OUString( "a" ) + OString::Concat( "b" )));
CPPUNIT_ASSERT( INVALID_CONCAT( OUString( "a" ) + 1 ));
rtl_String* rs = nullptr;
rtl_uString* rus = nullptr;
diff --git a/sdext/source/pdfimport/sax/emitcontext.cxx b/sdext/source/pdfimport/sax/emitcontext.cxx
index 80c459c7d82e..a923488d688d 100644
--- a/sdext/source/pdfimport/sax/emitcontext.cxx
+++ b/sdext/source/pdfimport/sax/emitcontext.cxx
@@ -163,7 +163,7 @@ void SaxEmitter::endTag( const char* pTag )
for( int i = 0; i < nIndent; i++ )
pStream->write( " ", 4, nWritten );
- OString aBuf = "</" + rtl::OStringView(pTag) + ">\n";
+ OString aBuf = OString::Concat("</") + pTag + ">\n";
pStream->write( aBuf.getStr(), aBuf.getLength(), nWritten );
nIndent--;
#endif
diff --git a/sfx2/source/appl/appuno.cxx b/sfx2/source/appl/appuno.cxx
index da8d333c935b..559cadd8f534 100644
--- a/sfx2/source/appl/appuno.cxx
+++ b/sfx2/source/appl/appuno.cxx
@@ -242,7 +242,7 @@ void TransformParameters( sal_uInt16 nSlotId, const uno::Sequence<beans::Propert
for ( nSub=0; nSub<nSubCount; nSub++ )
{
// search sub item by name
- OString aStr = rtl::OStringView(pSlot->pUnoName) + "." + pType->aAttrib[nSub].pName;
+ OString aStr = OString::Concat(pSlot->pUnoName) + "." + pType->aAttrib[nSub].pName;
if ( rPropValue.Name.equalsAsciiL(aStr.getStr(), aStr.getLength()) )
{
sal_uInt8 nSubId = static_cast<sal_uInt8>(static_cast<sal_Int8>(pType->aAttrib[nSub].nAID));
@@ -345,7 +345,7 @@ void TransformParameters( sal_uInt16 nSlotId, const uno::Sequence<beans::Propert
for ( sal_uInt16 nSub=0; nSub<nSubCount; nSub++ )
{
// search sub item by name
- OString aStr = rtl::OStringView(rArg.pName) + "." + pType->aAttrib[nSub].pName;
+ OString aStr = OString::Concat(rArg.pName) + "." + pType->aAttrib[nSub].pName;
if ( rProp.Name.equalsAsciiL(aStr.getStr(), aStr.getLength()) )
{
// at least one member found ...
diff --git a/stoc/source/uriproc/UriSchemeParser_vndDOTsunDOTstarDOTscript.cxx b/stoc/source/uriproc/UriSchemeParser_vndDOTsunDOTstarDOTscript.cxx
index 6f8624d270fb..960ecbcd16a8 100644
--- a/stoc/source/uriproc/UriSchemeParser_vndDOTsunDOTstarDOTscript.cxx
+++ b/stoc/source/uriproc/UriSchemeParser_vndDOTsunDOTstarDOTscript.cxx
@@ -284,7 +284,7 @@ void SAL_CALL UrlReference::setName(OUString const & name)
auto tmp = std::u16string_view(m_base.m_path).substr(i);
m_base.m_path = encodeNameOrParamFragment(name) +
- rtl::OUStringView(tmp.data(), tmp.length());
+ std::u16string_view(tmp.data(), tmp.length());
}
sal_Bool UrlReference::hasParameter(OUString const & key)
diff --git a/svtools/source/svhtml/htmlout.cxx b/svtools/source/svhtml/htmlout.cxx
index ce43e2dd9cce..20d06954fdc7 100644
--- a/svtools/source/svhtml/htmlout.cxx
+++ b/svtools/source/svhtml/htmlout.cxx
@@ -923,7 +923,7 @@ SvStream& HTMLOutFuncs::Out_Events( SvStream& rStrm,
if( pStr )
{
- OString sOut = " " + rtl::OStringView(pStr) + "=\"";
+ OString sOut = OString::Concat(" ") + pStr + "=\"";
rStrm.WriteOString( sOut );
Out_String( rStrm, pMacro->GetMacName(), eDestEnc, pNonConvertableChars ).WriteChar( '\"' );
diff --git a/sw/source/filter/html/htmlftn.cxx b/sw/source/filter/html/htmlftn.cxx
index 5787ed80bc38..cec1d3df6326 100644
--- a/sw/source/filter/html/htmlftn.cxx
+++ b/sw/source/filter/html/htmlftn.cxx
@@ -505,7 +505,7 @@ static void lcl_html_outFootEndNoteInfo( Writer& rWrt, OUString const *pParts,
rHTMLWrt.OutNewLine();
OString sOut =
"<" + rHTMLWrt.GetNamespace() + OOO_STRING_SVTOOLS_HTML_meta " "
- OOO_STRING_SVTOOLS_HTML_O_name "=\"" + rtl::OStringView(pName) +
+ OOO_STRING_SVTOOLS_HTML_O_name "=\"" + pName +
"\" " OOO_STRING_SVTOOLS_HTML_O_content "=\"";
rWrt.Strm().WriteOString( sOut );
HTMLOutFuncs::Out_String( rWrt.Strm(), aContent.makeStringAndClear(), rHTMLWrt.m_eDestEnc, &rHTMLWrt.m_aNonConvertableCharacters );
diff --git a/tools/source/fsys/urlobj.cxx b/tools/source/fsys/urlobj.cxx
index 2478a2bd5d55..d52edb1d2f2a 100644
--- a/tools/source/fsys/urlobj.cxx
+++ b/tools/source/fsys/urlobj.cxx
@@ -39,6 +39,7 @@
#include <cassert>
#include <limits>
#include <memory>
+#include <string_view>
#include <string.h>
@@ -4198,8 +4199,8 @@ bool INetURLObject::removeExtension(sal_Int32 nIndex, bool bIgnoreFinalSlash)
return true;
OUString aNewPath =
- rtl::OUStringView(pPathBegin, pExtension - pPathBegin) +
- rtl::OUStringView(p, pPathEnd - p);
+ OUString::Concat(std::u16string_view(pPathBegin, pExtension - pPathBegin)) +
+ std::u16string_view(p, pPathEnd - p);
return setPath(aNewPath, EncodeMechanism::NotCanonical, RTL_TEXTENCODING_UTF8);
}
@@ -4226,7 +4227,8 @@ bool INetURLObject::setFinalSlash()
if (pPathEnd > pPathBegin && pPathEnd[-1] == '/')
return true;
- OUString aNewPath = rtl::OUStringView(pPathBegin, pPathEnd - pPathBegin) + "/";
+ OUString aNewPath
+ = OUString::Concat(std::u16string_view(pPathBegin, pPathEnd - pPathBegin)) + "/";
return setPath(aNewPath, EncodeMechanism::NotCanonical, RTL_TEXTENCODING_UTF8);
}
diff --git a/ucb/source/ucp/webdav/SerfPutReqProcImpl.cxx b/ucb/source/ucp/webdav/SerfPutReqProcImpl.cxx
index 466f7a10cacb..6641016aec62 100644
--- a/ucb/source/ucp/webdav/SerfPutReqProcImpl.cxx
+++ b/ucb/source/ucp/webdav/SerfPutReqProcImpl.cxx
@@ -67,7 +67,7 @@ serf_bucket_t * SerfPutReqProcImpl::createSerfRequestBucket( serf_request_t * in
setRequestHeaders( hdrs_bkt );
// 'If' header with token, so that we can save document locked by us
- const OString sIfHeader( "<" + rtl::OStringView(getPathStr()) + "> (<" + OUStringToOString(
+ const OString sIfHeader( OString::Concat("<") + getPathStr() + "> (<" + OUStringToOString(
msToken, RTL_TEXTENCODING_UTF8) + ">)" );
serf_bucket_headers_set( hdrs_bkt, "If", sIfHeader.getStr() );
diff --git a/vcl/source/gdi/pdfwriter_impl.cxx b/vcl/source/gdi/pdfwriter_impl.cxx
index c879c9143858..4d2e94540614 100644
--- a/vcl/source/gdi/pdfwriter_impl.cxx
+++ b/vcl/source/gdi/pdfwriter_impl.cxx
@@ -1571,7 +1571,7 @@ void PDFWriterImpl::appendLiteralStringEncrypt( const OUString& rInString, const
void PDFWriterImpl::emitComment( const char* pComment )
{
- OString aLine = "% " + rtl::OStringView(pComment) + "\n";
+ OString aLine = OString::Concat("% ") + pComment + "\n";
writeBuffer( aLine.getStr(), aLine.getLength() );
}
diff --git a/vcl/source/opengl/OpenGLHelper.cxx b/vcl/source/opengl/OpenGLHelper.cxx
index 64a470fe5f63..fc5cc3703b7a 100644
--- a/vcl/source/opengl/OpenGLHelper.cxx
+++ b/vcl/source/opengl/OpenGLHelper.cxx
@@ -213,7 +213,7 @@ namespace
OUStringToOString(aInfo.GetDriverVersion(), RTL_TEXTENCODING_UTF8) +
OString::number(DriverBlocklist::GetWindowsVersion());
#else
- return rtl::OStringView(reinterpret_cast<const char*>(glGetString(GL_VENDOR))) +
+ return OString::Concat(reinterpret_cast<const char*>(glGetString(GL_VENDOR))) +
reinterpret_cast<const char*>(glGetString(GL_RENDERER)) +
reinterpret_cast<const char*>(glGetString(GL_VERSION));
#endif