O[U]String overloads that return view for rest parameter

Add new overloads to OUString methods that have a
"OUString* rest" style parameter.

Instead return a view, which does not require allocation.

To avoid overload ambiguity, split the methods into
different variants that do not use default parameters.

Change-Id: I1aa366115750f1f7ea4fe665804195f59f7c4b69
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/167632
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Tested-by: Jenkins
This commit is contained in:
Noel Grandin
2024-07-25 13:29:11 +02:00
parent b84ef4d67e
commit 1bbcc3fdf3
25 changed files with 913 additions and 121 deletions
+1 -1
View File
@@ -1279,7 +1279,7 @@ void SfxLibraryContainer::checkStorageURL( const OUString& aSourceURL,
else
{
// try to re-create the variable URL: helps moving the profile
if (OUString aRest; aSourceURL.startsWith(expand_url(sUserBasicVariablePrefix), &aRest))
if (std::u16string_view aRest; aSourceURL.startsWith(expand_url(sUserBasicVariablePrefix), &aRest))
aUnexpandedStorageURL = sUserBasicVariablePrefix + aRest;
else if (aSourceURL.startsWith(expand_url(sInstBasicVariablePrefix), &aRest))
aUnexpandedStorageURL = sInstBasicVariablePrefix + aRest;
+3 -2
View File
@@ -55,9 +55,10 @@ OString scopedCppName(OString const & type, bool ns_alias)
} while( nPos != -1 );
OString s(tmpBuf.makeStringAndClear());
if (ns_alias && s.startsWith("::com::sun::star::", &s))
std::string_view rest;
if (ns_alias && s.startsWith("::com::sun::star::", &rest))
{
s = "::css::" + s; // nicer shorthand
s = OString::Concat("::css::") + rest; // nicer shorthand
}
return s;
+1 -1
View File
@@ -704,7 +704,7 @@ uno::Reference< io::XStream > OStorageHelper::GetStreamAtPackageURL(
const OUString& rURL, sal_uInt32 const nOpenMode,
LifecycleProxy const & rNastiness)
{
OUString path;
std::u16string_view path;
if (rURL.startsWithIgnoreAsciiCase("vnd.sun.star.Package:", &path))
{
return GetStreamAtPath(xParentStorage, path, nOpenMode, rNastiness);
+2 -2
View File
@@ -1940,10 +1940,10 @@ IMPL_LINK(SvxNumOptionsTabPage, GraphicHdl_Impl, const OUString&, rIdent, void)
bool bSucc(false);
SvxOpenGraphicDialog aGrfDlg(CuiResId(RID_CUISTR_EDIT_GRAPHIC), GetFrameWeld());
OUString sNumber;
std::u16string_view sNumber;
if (rIdent.startsWith("gallery", &sNumber))
{
auto idx = sNumber.toUInt32();
auto idx = o3tl::toUInt32(sNumber);
if (idx < aGrfNames.size())
{
aGrfName = aGrfNames[idx];
+4 -3
View File
@@ -63,6 +63,7 @@
#include <cuitabarea.hxx>
#include <svtools/unitconv.hxx>
#include <comphelper/lok.hxx>
#include <o3tl/string_view.hxx>
#define MAX_BMP_WIDTH 16
#define MAX_BMP_HEIGHT 16
@@ -1527,16 +1528,16 @@ IMPL_LINK(SvxLineTabPage, GraphicHdl_Impl, const OUString&, rIdent, void)
bool bEnable = true;
tools::Long nPreviousSymbolType = m_nSymbolType;
OUString sNumber;
std::u16string_view sNumber;
if (rIdent.startsWith("gallery", &sNumber))
{
SvxBmpItemInfo* pInfo = m_aGalleryBrushItems[sNumber.toUInt32()].get();
SvxBmpItemInfo* pInfo = m_aGalleryBrushItems[o3tl::toUInt32(sNumber)].get();
pGraphic = pInfo->pBrushItem->GetGraphic();
m_nSymbolType = SVX_SYMBOLTYPE_BRUSHITEM;
}
else if (rIdent.startsWith("symbol", &sNumber))
{
m_nSymbolType = sNumber.toUInt32();
m_nSymbolType = o3tl::toUInt32(sNumber);
SvxBmpItemInfo* pInfo = m_aSymbolBrushItems[m_nSymbolType].get();
pGraphic = pInfo->pBrushItem->GetGraphic();
}
@@ -120,8 +120,8 @@ void SAL_CALL ToolBarWrapper::initialize( const Sequence< Any >& aArguments )
if ( !(xFrame.is() && m_xConfigSource.is()) )
return;
OUString aContextPart;
if ( m_aResourceURL.startsWith( "private:resource/toolbar/singlemode", &aContextPart ) && aContextPart.isEmpty() )
std::u16string_view aContextPart;
if ( m_aResourceURL.startsWith( "private:resource/toolbar/singlemode", &aContextPart ) && aContextPart.empty() )
{
auto xMultiplexer( ContextChangeEventMultiplexer::get( m_xContext ) );
try
@@ -138,7 +138,7 @@ void SAL_CALL ToolBarWrapper::initialize( const Sequence< Any >& aArguments )
// Create VCL based toolbar which will be filled with settings data
VclPtr<ToolBox> pToolBar;
rtl::Reference<ToolBarManager> pToolBarManager;
if ( aContextPart.isEmpty() )
if ( aContextPart.empty() )
{
SolarMutexGuard aSolarMutexGuard;
if ( !xParentWindow.is() )
+384 -30
View File
@@ -1059,6 +1059,63 @@ public:
== 0;
}
#if defined LIBO_INTERNAL_ONLY
/**
Check whether this string starts with a given substring.
@param str the substring to be compared
@return true if and only if the given str appears as a substring at the
start of this string
@since LibreOffice 4.0
*/
bool startsWith(std::string_view str) const {
return match(str);
}
/**
Check whether this string starts with a given substring.
@param str the substring to be compared
@param rest if this function returns true, then assign a
copy of the remainder of this string to *rest.
@return true if and only if the given str appears as a substring at the
start of this string
@since LibreOffice 4.0
*/
bool startsWith(std::string_view str, OString * rest) const {
assert(rest);
bool b = match(str);
if (b) {
*rest = copy(str.size());
}
return b;
}
/**
Check whether this string starts with a given substring.
@param str the substring to be compared
@param rest if this function returns true, then assign a
copy of the remainder of this string to *rest.
@return true if and only if the given str appears as a substring at the
start of this string
@since LibreOffice 24.2
*/
bool startsWith(std::string_view str, std::string_view * rest) const {
assert(rest);
bool b = match(str);
if (b) {
*rest = subView(str.size());
}
return b;
}
#else
/**
Check whether this string starts with a given substring.
@@ -1073,15 +1130,6 @@ public:
@since LibreOffice 4.0
*/
#if defined LIBO_INTERNAL_ONLY
bool startsWith(std::string_view str, OString * rest = NULL) const {
bool b = match(str);
if (b && rest != NULL) {
*rest = copy(str.size());
}
return b;
}
#else
bool startsWith(OString const & str, OString * rest = NULL) const {
bool b = match(str);
if (b && rest != NULL) {
@@ -1091,6 +1139,55 @@ public:
}
#endif
#if defined LIBO_INTERNAL_ONLY
/**
@overload
This function accepts an ASCII string literal as its argument.
@since LibreOffice 4.0
*/
template< typename T >
typename libreoffice_internal::ConstCharArrayDetector< T, bool >::Type startsWith(
T & literal) const
{
RTL_STRING_CONST_FUNCTION
return match(literal, 0);
}
/**
@overload
This function accepts an ASCII string literal as its argument.
@since LibreOffice 4.0
*/
template< typename T >
typename libreoffice_internal::ConstCharArrayDetector< T, bool >::Type startsWith(
T & literal, OString * rest) const
{
RTL_STRING_CONST_FUNCTION
assert(rest);
bool b = match(literal, 0);
if (b) {
*rest = copy(
libreoffice_internal::ConstCharArrayDetector<T>::length);
}
return b;
}
/**
This function accepts an ASCII string literal as its argument.
@since LibreOffice 25.2
*/
template< typename T >
typename libreoffice_internal::ConstCharArrayDetector< T, bool >::Type startsWith(
T & literal, std::string_view * rest) const
{
RTL_STRING_CONST_FUNCTION
assert(rest);
bool b = match(literal, 0);
if (b) {
*rest = subView(
libreoffice_internal::ConstCharArrayDetector<T>::length);
}
return b;
}
#else
/**
@overload
This function accepts an ASCII string literal as its argument.
@@ -1108,7 +1205,89 @@ public:
}
return b;
}
#endif
#if defined LIBO_INTERNAL_ONLY
/**
Check whether this string starts with a given string, ignoring the case of
ASCII letters.
Character values between 65 and 90 (ASCII A-Z) are interpreted as
values between 97 and 122 (ASCII a-z).
This function can't be used for language specific comparison.
@param str the substring to be compared
@return true if and only if the given str appears as a substring at the
start of this string, ignoring the case of ASCII letters ("A"--"Z" and
"a"--"z")
@since LibreOffice 5.1
*/
bool startsWithIgnoreAsciiCase(std::string_view str)
const
{
return matchIgnoreAsciiCase(str);
}
/**
Check whether this string starts with a given string, ignoring the case of
ASCII letters.
Character values between 65 and 90 (ASCII A-Z) are interpreted as
values between 97 and 122 (ASCII a-z).
This function can't be used for language specific comparison.
@param str the substring to be compared
@param rest if this function returns true, then assign a
copy of the remainder of this string to *rest.
@return true if and only if the given str appears as a substring at the
start of this string, ignoring the case of ASCII letters ("A"--"Z" and
"a"--"z")
@since LibreOffice 5.1
*/
bool startsWithIgnoreAsciiCase(std::string_view str, OString * rest)
const
{
assert(rest);
bool b = matchIgnoreAsciiCase(str);
if (b) {
*rest = copy(str.size());
}
return b;
}
/**
Check whether this string starts with a given string, ignoring the case of
ASCII letters.
Character values between 65 and 90 (ASCII A-Z) are interpreted as
values between 97 and 122 (ASCII a-z).
This function can't be used for language specific comparison.
@param str the substring to be compared
@param rest if this function returns true, then assign a
copy of the remainder of this string to *rest.
@return true if and only if the given str appears as a substring at the
start of this string, ignoring the case of ASCII letters ("A"--"Z" and
"a"--"z")
@since LibreOffice 24.2
*/
bool startsWithIgnoreAsciiCase(std::string_view str, std::string_view * rest)
const
{
assert(rest);
bool b = matchIgnoreAsciiCase(str);
if (b) {
*rest = subView(str.size());
}
return b;
}
#else
/**
Check whether this string starts with a given string, ignoring the case of
ASCII letters.
@@ -1128,17 +1307,6 @@ public:
@since LibreOffice 5.1
*/
#if defined LIBO_INTERNAL_ONLY
bool startsWithIgnoreAsciiCase(std::string_view str, OString * rest = NULL)
const
{
bool b = matchIgnoreAsciiCase(str);
if (b && rest != NULL) {
*rest = copy(str.size());
}
return b;
}
#else
bool startsWithIgnoreAsciiCase(OString const & str, OString * rest = NULL)
const
{
@@ -1150,6 +1318,57 @@ public:
}
#endif
#if defined LIBO_INTERNAL_ONLY
/**
@overload
This function accepts an ASCII string literal as its argument.
@since LibreOffice 5.1
*/
template< typename T >
typename libreoffice_internal::ConstCharArrayDetector< T, bool >::Type
startsWithIgnoreAsciiCase(T & literal) const
{
RTL_STRING_CONST_FUNCTION
assert(
libreoffice_internal::ConstCharArrayDetector<T>::isValid(literal));
return matchIgnoreAsciiCase(literal);
}
/**
@overload
This function accepts an ASCII string literal as its argument.
@since LibreOffice 5.1
*/
template< typename T >
typename libreoffice_internal::ConstCharArrayDetector< T, bool >::Type
startsWithIgnoreAsciiCase(T & literal, OString * rest) const
{
RTL_STRING_CONST_FUNCTION
assert(
libreoffice_internal::ConstCharArrayDetector<T>::isValid(literal));
assert(rest);
bool b = matchIgnoreAsciiCase(literal);
if (b) {
*rest = copy(
libreoffice_internal::ConstCharArrayDetector<T>::length);
}
return b;
}
template< typename T >
typename libreoffice_internal::ConstCharArrayDetector< T, bool >::Type
startsWithIgnoreAsciiCase(T & literal, std::string_view * rest) const
{
RTL_STRING_CONST_FUNCTION
assert(
libreoffice_internal::ConstCharArrayDetector<T>::isValid(literal));
assert(rest);
bool b = matchIgnoreAsciiCase(literal);
if (b) {
*rest = subView(
libreoffice_internal::ConstCharArrayDetector<T>::length);
}
return b;
}
#else
/**
@overload
This function accepts an ASCII string literal as its argument.
@@ -1169,7 +1388,69 @@ public:
}
return b;
}
#endif
#if defined LIBO_INTERNAL_ONLY
/**
Check whether this string ends with a given substring.
@param str the substring to be compared
@return true if and only if the given str appears as a substring at the
end of this string
@since LibreOffice 3.6
*/
bool endsWith(std::string_view str) const {
return str.size() <= sal_uInt32(getLength())
&& match(str, getLength() - str.size());
}
/**
Check whether this string ends with a given substring.
@param str the substring to be compared
@param rest if this function returns true, then assign a
copy of the remainder of this string to *rest. Available since
LibreOffice 4.2
@return true if and only if the given str appears as a substring at the
end of this string
@since LibreOffice 3.6
*/
bool endsWith(std::string_view str, OString * rest) const {
assert(rest);
bool b = str.size() <= sal_uInt32(getLength())
&& match(str, getLength() - str.size());
if (b) {
*rest = copy(0, getLength() - str.size());
}
return b;
}
/**
Check whether this string ends with a given substring.
@param str the substring to be compared
@param rest if this function returns true, then assign a
copy of the remainder of this string to *rest.
@return true if and only if the given str appears as a substring at the
end of this string
@since LibreOffice 24.2
*/
bool endsWith(std::string_view str, std::string_view * rest) const {
assert(rest);
bool b = str.size() <= sal_uInt32(getLength())
&& match(str, getLength() - str.size());
if (b) {
*rest = subView(0, getLength() - str.size());
}
return b;
}
#else
/**
Check whether this string ends with a given substring.
@@ -1184,16 +1465,6 @@ public:
@since LibreOffice 3.6
*/
#if defined LIBO_INTERNAL_ONLY
bool endsWith(std::string_view str, OString * rest = NULL) const {
bool b = str.size() <= sal_uInt32(getLength())
&& match(str, getLength() - str.size());
if (b && rest != NULL) {
*rest = copy(0, getLength() - str.size());
}
return b;
}
#else
bool endsWith(OString const & str, OString * rest = NULL) const {
bool b = str.getLength() <= getLength()
&& match(str, getLength() - str.getLength());
@@ -1204,6 +1475,88 @@ public:
}
#endif
#if defined LIBO_INTERNAL_ONLY
/**
@overload
This function accepts an ASCII string literal as its argument.
@since LibreOffice 25.2
*/
template< typename T >
typename libreoffice_internal::ConstCharArrayDetector< T, bool >::Type endsWith(
T & literal) const
{
RTL_STRING_CONST_FUNCTION
assert(
libreoffice_internal::ConstCharArrayDetector<T>::isValid(literal));
bool b
= (libreoffice_internal::ConstCharArrayDetector<T>::length
<= sal_uInt32(getLength()))
&& match(
libreoffice_internal::ConstCharArrayDetector<T>::toPointer(
literal),
(getLength()
- libreoffice_internal::ConstCharArrayDetector<T>::length));
return b;
}
/**
@overload
This function accepts an ASCII string literal as its argument.
@since LibreOffice 3.6
*/
template< typename T >
typename libreoffice_internal::ConstCharArrayDetector< T, bool >::Type endsWith(
T & literal, OString * rest) const
{
RTL_STRING_CONST_FUNCTION
assert(
libreoffice_internal::ConstCharArrayDetector<T>::isValid(literal));
assert(rest);
bool b
= (libreoffice_internal::ConstCharArrayDetector<T>::length
<= sal_uInt32(getLength()))
&& match(
libreoffice_internal::ConstCharArrayDetector<T>::toPointer(
literal),
(getLength()
- libreoffice_internal::ConstCharArrayDetector<T>::length));
if (b) {
*rest = copy(
0,
(getLength()
- libreoffice_internal::ConstCharArrayDetector<T>::length));
}
return b;
}
/**
@overload
This function accepts an ASCII string literal as its argument.
@since LibreOffice 25.2
*/
template< typename T >
typename libreoffice_internal::ConstCharArrayDetector< T, bool >::Type endsWith(
T & literal, std::string_view * rest) const
{
RTL_STRING_CONST_FUNCTION
assert(
libreoffice_internal::ConstCharArrayDetector<T>::isValid(literal));
assert(rest);
bool b
= (libreoffice_internal::ConstCharArrayDetector<T>::length
<= sal_uInt32(getLength()))
&& match(
libreoffice_internal::ConstCharArrayDetector<T>::toPointer(
literal),
(getLength()
- libreoffice_internal::ConstCharArrayDetector<T>::length));
if (b) {
*rest = subView(
0,
(getLength()
- libreoffice_internal::ConstCharArrayDetector<T>::length));
}
return b;
}
#else
/**
@overload
This function accepts an ASCII string literal as its argument.
@@ -1232,6 +1585,7 @@ public:
}
return b;
}
#endif
/**
Check whether this string ends with a given substring.
+464 -31
View File
@@ -1446,6 +1446,64 @@ public:
const;
#endif
#if defined LIBO_INTERNAL_ONLY
/**
Check whether this string starts with a given substring.
@param str the substring to be compared
@return true if and only if the given str appears as a substring at the
start of this string
@since LibreOffice 4.0
*/
bool startsWith(std::u16string_view sv) const {
return match(sv);
}
/**
Check whether this string starts with a given substring.
@param str the substring to be compared
@param rest if this function returns true, then assign a
copy of the remainder of this string to *rest. Available since
LibreOffice 4.2
@return true if and only if the given str appears as a substring at the
start of this string
@since LibreOffice 4.0
*/
bool startsWith(std::u16string_view sv, OUString * rest) const {
assert(rest);
auto const b = match(sv);
if (b) {
*rest = copy(sv.size());
}
return b;
}
/**
Check whether this string starts with a given substring.
@param str the substring to be compared
@param rest if this function returns true, then assign a
copy of the remainder of this string to *rest.
@return true if and only if the given str appears as a substring at the
start of this string
@since LibreOffice 24.2
*/
bool startsWith(std::u16string_view sv, std::u16string_view * rest) const {
assert(rest);
auto const b = match(sv);
if (b) {
*rest = subView(sv.size());
}
return b;
}
#else
/**
Check whether this string starts with a given substring.
@@ -1460,15 +1518,6 @@ public:
@since LibreOffice 4.0
*/
#if defined LIBO_INTERNAL_ONLY
bool startsWith(std::u16string_view sv, OUString * rest = nullptr) const {
auto const b = match(sv);
if (b && rest != nullptr) {
*rest = copy(sv.size());
}
return b;
}
#else
bool startsWith(OUString const & str, OUString * rest = NULL) const {
bool b = match(str);
if (b && rest != NULL) {
@@ -1478,6 +1527,79 @@ public:
}
#endif
#if defined LIBO_INTERNAL_ONLY
/**
This function accepts an ASCII string literal as its argument.
@since LibreOffice 25.2
*/
template< typename T >
typename libreoffice_internal::ConstCharArrayDetector< T, bool >::Type startsWith(
T & literal) const
{
assert(
libreoffice_internal::ConstCharArrayDetector<T>::isValid(literal));
bool b
= (libreoffice_internal::ConstCharArrayDetector<T>::length
<= sal_uInt32(pData->length))
&& rtl_ustr_asciil_reverseEquals_WithLength(
pData->buffer,
libreoffice_internal::ConstCharArrayDetector<T>::toPointer(
literal),
libreoffice_internal::ConstCharArrayDetector<T>::length);
return b;
}
/**
@overload
This function accepts an ASCII string literal as its argument.
@since LibreOffice 4.0
*/
template< typename T >
typename libreoffice_internal::ConstCharArrayDetector< T, bool >::Type startsWith(
T & literal, OUString * rest) const
{
assert(
libreoffice_internal::ConstCharArrayDetector<T>::isValid(literal));
assert(rest);
bool b
= (libreoffice_internal::ConstCharArrayDetector<T>::length
<= sal_uInt32(pData->length))
&& rtl_ustr_asciil_reverseEquals_WithLength(
pData->buffer,
libreoffice_internal::ConstCharArrayDetector<T>::toPointer(
literal),
libreoffice_internal::ConstCharArrayDetector<T>::length);
if (b) {
*rest = copy(
libreoffice_internal::ConstCharArrayDetector<T>::length);
}
return b;
}
/**
This function accepts an ASCII string literal as its argument.
@since LibreOffice 25.2
*/
template< typename T >
typename libreoffice_internal::ConstCharArrayDetector< T, bool >::Type startsWith(
T & literal, std::u16string_view * rest) const
{
assert(
libreoffice_internal::ConstCharArrayDetector<T>::isValid(literal));
assert(rest);
bool b
= (libreoffice_internal::ConstCharArrayDetector<T>::length
<= sal_uInt32(pData->length))
&& rtl_ustr_asciil_reverseEquals_WithLength(
pData->buffer,
libreoffice_internal::ConstCharArrayDetector<T>::toPointer(
literal),
libreoffice_internal::ConstCharArrayDetector<T>::length);
if (b) {
*rest = subView(
libreoffice_internal::ConstCharArrayDetector<T>::length);
}
return b;
}
#else
/**
@overload
This function accepts an ASCII string literal as its argument.
@@ -1503,6 +1625,7 @@ public:
}
return b;
}
#endif
/**
Check whether this string starts with a given string, ignoring the case of
@@ -1525,13 +1648,25 @@ public:
@since LibreOffice 4.0
*/
#if defined LIBO_INTERNAL_ONLY
bool startsWithIgnoreAsciiCase(std::u16string_view sv, OUString * rest = nullptr) const {
bool startsWithIgnoreAsciiCase(std::u16string_view sv) const {
return matchIgnoreAsciiCase(sv);
}
bool startsWithIgnoreAsciiCase(std::u16string_view sv, OUString * rest) const {
assert(rest);
auto const b = matchIgnoreAsciiCase(sv);
if (b && rest != nullptr) {
if (b) {
*rest = copy(sv.size());
}
return b;
}
bool startsWithIgnoreAsciiCase(std::u16string_view sv, std::u16string_view * rest) const {
assert(rest);
auto const b = matchIgnoreAsciiCase(sv);
if (b) {
*rest = subView(sv.size());
}
return b;
}
#else
bool startsWithIgnoreAsciiCase(OUString const & str, OUString * rest = NULL)
const
@@ -1544,6 +1679,86 @@ public:
}
#endif
#if defined LIBO_INTERNAL_ONLY
/**
@overload
This function accepts an ASCII string literal as its argument.
@since LibreOffice 4.0
*/
template< typename T >
typename libreoffice_internal::ConstCharArrayDetector< T, bool >::Type
startsWithIgnoreAsciiCase(T & literal) const
{
assert(
libreoffice_internal::ConstCharArrayDetector<T>::isValid(literal));
bool b
= (libreoffice_internal::ConstCharArrayDetector<T>::length
<= sal_uInt32(pData->length))
&& (rtl_ustr_ascii_compareIgnoreAsciiCase_WithLengths(
pData->buffer,
libreoffice_internal::ConstCharArrayDetector<T>::length,
libreoffice_internal::ConstCharArrayDetector<T>::toPointer(
literal),
libreoffice_internal::ConstCharArrayDetector<T>::length)
== 0);
return b;
}
/**
@overload
This function accepts an ASCII string literal as its argument.
@since LibreOffice 4.0
*/
template< typename T >
typename libreoffice_internal::ConstCharArrayDetector< T, bool >::Type
startsWithIgnoreAsciiCase(T & literal, OUString * rest) const
{
assert(
libreoffice_internal::ConstCharArrayDetector<T>::isValid(literal));
assert(rest);
bool b
= (libreoffice_internal::ConstCharArrayDetector<T>::length
<= sal_uInt32(pData->length))
&& (rtl_ustr_ascii_compareIgnoreAsciiCase_WithLengths(
pData->buffer,
libreoffice_internal::ConstCharArrayDetector<T>::length,
libreoffice_internal::ConstCharArrayDetector<T>::toPointer(
literal),
libreoffice_internal::ConstCharArrayDetector<T>::length)
== 0);
if (b) {
*rest = copy(
libreoffice_internal::ConstCharArrayDetector<T>::length);
}
return b;
}
/**
This function accepts an ASCII string literal as its argument.
@since LibreOffice 24.2
*/
template< typename T >
typename libreoffice_internal::ConstCharArrayDetector< T, bool >::Type
startsWithIgnoreAsciiCase(T & literal, std::u16string_view * rest) const
{
assert(
libreoffice_internal::ConstCharArrayDetector<T>::isValid(literal));
assert(rest);
bool b
= (libreoffice_internal::ConstCharArrayDetector<T>::length
<= sal_uInt32(pData->length))
&& (rtl_ustr_ascii_compareIgnoreAsciiCase_WithLengths(
pData->buffer,
libreoffice_internal::ConstCharArrayDetector<T>::length,
libreoffice_internal::ConstCharArrayDetector<T>::toPointer(
literal),
libreoffice_internal::ConstCharArrayDetector<T>::length)
== 0);
if (b) {
*rest = subView(
libreoffice_internal::ConstCharArrayDetector<T>::length);
}
return b;
}
#else
/**
@overload
This function accepts an ASCII string literal as its argument.
@@ -1571,7 +1786,54 @@ public:
}
return b;
}
#endif
#if defined LIBO_INTERNAL_ONLY
/**
Check whether this string ends with a given substring.
@param str the substring to be compared
@return true if and only if the given str appears as a substring at the
end of this string
@since LibreOffice 3.6
*/
bool endsWith(std::u16string_view sv) const {
return sv.size() <= sal_uInt32(pData->length)
&& match(sv, pData->length - sv.size());
}
bool endsWith(std::u16string_view sv, OUString * rest) const {
auto const b = sv.size() <= sal_uInt32(pData->length)
&& match(sv, pData->length - sv.size());
if (b && rest != nullptr) {
*rest = copy(0, (pData->length - sv.size()));
}
return b;
}
/**
Check whether this string ends with a given substring.
@param str the substring to be compared
@param rest if this function returns true, then assign a
copy of the remainder of this string to *rest.
@return true if and only if the given str appears as a substring at the
end of this string
@since LibreOffice 24.2
*/
bool endsWith(std::u16string_view sv, std::u16string_view * rest) const {
assert(rest);
auto const b = sv.size() <= sal_uInt32(pData->length)
&& match(sv, pData->length - sv.size());
if (b) {
*rest = subView(0, (pData->length - sv.size()));
}
return b;
}
#else
/**
Check whether this string ends with a given substring.
@@ -1586,16 +1848,6 @@ public:
@since LibreOffice 3.6
*/
#if defined LIBO_INTERNAL_ONLY
bool endsWith(std::u16string_view sv, OUString * rest = nullptr) const {
auto const b = sv.size() <= sal_uInt32(pData->length)
&& match(sv, pData->length - sv.size());
if (b && rest != nullptr) {
*rest = copy(0, (pData->length - sv.size()));
}
return b;
}
#else
bool endsWith(OUString const & str, OUString * rest = NULL) const {
bool b = str.getLength() <= getLength()
&& match(str, getLength() - str.getLength());
@@ -1606,6 +1858,78 @@ public:
}
#endif
#if defined LIBO_INTERNAL_ONLY
/**
@overload
This function accepts an ASCII string literal as its argument.
@since LibreOffice 25.2
*/
template< typename T >
typename libreoffice_internal::ConstCharArrayDetector< T, bool >::Type
endsWith(T & literal) const
{
assert(
libreoffice_internal::ConstCharArrayDetector<T>::isValid(literal));
bool b
= (libreoffice_internal::ConstCharArrayDetector<T>::length
<= sal_uInt32(pData->length))
&& rtl_ustr_asciil_reverseEquals_WithLength(
(pData->buffer + pData->length
- libreoffice_internal::ConstCharArrayDetector<T>::length),
libreoffice_internal::ConstCharArrayDetector<T>::toPointer(
literal),
libreoffice_internal::ConstCharArrayDetector<T>::length);
return b;
}
template< typename T >
typename libreoffice_internal::ConstCharArrayDetector< T, bool >::Type
endsWith(T & literal, OUString * rest) const
{
assert(
libreoffice_internal::ConstCharArrayDetector<T>::isValid(literal));
assert(rest);
bool b
= (libreoffice_internal::ConstCharArrayDetector<T>::length
<= sal_uInt32(pData->length))
&& rtl_ustr_asciil_reverseEquals_WithLength(
(pData->buffer + pData->length
- libreoffice_internal::ConstCharArrayDetector<T>::length),
libreoffice_internal::ConstCharArrayDetector<T>::toPointer(
literal),
libreoffice_internal::ConstCharArrayDetector<T>::length);
if (b) {
*rest = copy(
0,
(getLength()
- libreoffice_internal::ConstCharArrayDetector<T>::length));
}
return b;
}
template< typename T >
typename libreoffice_internal::ConstCharArrayDetector< T, bool >::Type
endsWith(T & literal, std::u16string_view * rest) const
{
assert(
libreoffice_internal::ConstCharArrayDetector<T>::isValid(literal));
assert(rest);
bool b
= (libreoffice_internal::ConstCharArrayDetector<T>::length
<= sal_uInt32(pData->length))
&& rtl_ustr_asciil_reverseEquals_WithLength(
(pData->buffer + pData->length
- libreoffice_internal::ConstCharArrayDetector<T>::length),
libreoffice_internal::ConstCharArrayDetector<T>::toPointer(
literal),
libreoffice_internal::ConstCharArrayDetector<T>::length);
if (b) {
*rest = subView(
0,
(getLength()
- libreoffice_internal::ConstCharArrayDetector<T>::length));
}
return b;
}
#else
/**
@overload
This function accepts an ASCII string literal as its argument.
@@ -1634,6 +1958,7 @@ public:
}
return b;
}
#endif
/**
Check whether this string ends with a given ASCII string.
@@ -1655,6 +1980,68 @@ public:
asciiStrLength);
}
#if defined LIBO_INTERNAL_ONLY
/**
Check whether this string ends with a given string, ignoring the case of
ASCII letters.
Character values between 65 and 90 (ASCII A-Z) are interpreted as
values between 97 and 122 (ASCII a-z).
This function can't be used for language specific comparison.
@param str the substring to be compared
@param rest if this function returns true, then assign a
copy of the remainder of this string to *rest. Available since
LibreOffice 4.2
@return true if and only if the given str appears as a substring at the
end of this string, ignoring the case of ASCII letters ("A"--"Z" and
"a"--"z")
@since LibreOffice 3.6
*/
bool endsWithIgnoreAsciiCase(std::u16string_view sv) const {
return sv.size() <= sal_uInt32(pData->length)
&& matchIgnoreAsciiCase(sv, pData->length - sv.size());
}
bool endsWithIgnoreAsciiCase(std::u16string_view sv, OUString * rest) const {
auto const b = sv.size() <= sal_uInt32(pData->length)
&& matchIgnoreAsciiCase(sv, pData->length - sv.size());
if (b && rest != nullptr) {
*rest = copy(0, pData->length - sv.size());
}
return b;
}
/**
Check whether this string ends with a given string, ignoring the case of
ASCII letters.
Character values between 65 and 90 (ASCII A-Z) are interpreted as
values between 97 and 122 (ASCII a-z).
This function can't be used for language specific comparison.
@param str the substring to be compared
@param rest if this function returns true, then assign a
copy of the remainder of this string to *rest.
@return true if and only if the given str appears as a substring at the
end of this string, ignoring the case of ASCII letters ("A"--"Z" and
"a"--"z")
@since LibreOffice 24.2
*/
bool endsWithIgnoreAsciiCase(std::u16string_view sv, std::u16string_view * rest) const {
assert(rest);
auto const b = sv.size() <= sal_uInt32(pData->length)
&& matchIgnoreAsciiCase(sv, pData->length - sv.size());
if (b) {
*rest = subView(0, pData->length - sv.size());
}
return b;
}
#else
/**
Check whether this string ends with a given string, ignoring the case of
ASCII letters.
@@ -1675,16 +2062,6 @@ public:
@since LibreOffice 3.6
*/
#if defined LIBO_INTERNAL_ONLY
bool endsWithIgnoreAsciiCase(std::u16string_view sv, OUString * rest = nullptr) const {
auto const b = sv.size() <= sal_uInt32(pData->length)
&& matchIgnoreAsciiCase(sv, pData->length - sv.size());
if (b && rest != nullptr) {
*rest = copy(0, pData->length - sv.size());
}
return b;
}
#else
bool endsWithIgnoreAsciiCase(OUString const & str, OUString * rest = NULL) const
{
bool b = str.getLength() <= getLength()
@@ -1696,6 +2073,61 @@ public:
}
#endif
#if defined LIBO_INTERNAL_ONLY
/**
This function accepts an ASCII string literal as its argument.
@since LibreOffice 24.2
*/
template< typename T >
typename libreoffice_internal::ConstCharArrayDetector< T, bool >::Type
endsWithIgnoreAsciiCase(T & literal) const
{
assert(
libreoffice_internal::ConstCharArrayDetector<T>::isValid(literal));
bool b
= (libreoffice_internal::ConstCharArrayDetector<T>::length
<= sal_uInt32(pData->length))
&& (rtl_ustr_ascii_compareIgnoreAsciiCase_WithLengths(
(pData->buffer + pData->length
- libreoffice_internal::ConstCharArrayDetector<T>::length),
libreoffice_internal::ConstCharArrayDetector<T>::length,
libreoffice_internal::ConstCharArrayDetector<T>::toPointer(
literal),
libreoffice_internal::ConstCharArrayDetector<T>::length)
== 0);
return b;
}
/**
This function accepts an ASCII string literal as its argument.
@since LibreOffice 24.2
*/
template< typename T >
typename libreoffice_internal::ConstCharArrayDetector< T, bool >::Type
endsWithIgnoreAsciiCase(T & literal, std::u16string_view * rest) const
{
assert(
libreoffice_internal::ConstCharArrayDetector<T>::isValid(literal));
assert(rest);
bool b
= (libreoffice_internal::ConstCharArrayDetector<T>::length
<= sal_uInt32(pData->length))
&& (rtl_ustr_ascii_compareIgnoreAsciiCase_WithLengths(
(pData->buffer + pData->length
- libreoffice_internal::ConstCharArrayDetector<T>::length),
libreoffice_internal::ConstCharArrayDetector<T>::length,
libreoffice_internal::ConstCharArrayDetector<T>::toPointer(
literal),
libreoffice_internal::ConstCharArrayDetector<T>::length)
== 0);
if (b) {
*rest = subView(
0,
(getLength()
- libreoffice_internal::ConstCharArrayDetector<T>::length));
}
return b;
}
#else
/**
@overload
This function accepts an ASCII string literal as its argument.
@@ -1726,6 +2158,7 @@ public:
}
return b;
}
#endif
/**
Check whether this string ends with a given ASCII string, ignoring the
+2 -2
View File
@@ -313,12 +313,12 @@ void ShapeBase::finalizeFragmentImport()
// Temporary fix, shapetype not found if referenced from different substream
// FIXME: extend scope of ShapeContainer to store all shapetypes from the document
static constexpr OUString sShapeTypePrefix = u"shapetype_"_ustr;
OUString tmp;
std::u16string_view tmp;
if (aType.startsWith(sShapeTypePrefix)) {
maTypeModel.moShapeType = o3tl::toInt32(aType.subView(sShapeTypePrefix.getLength()));
}
else if (aType.startsWith("_x0000_t", &tmp)) {
maTypeModel.moShapeType = tmp.toInt32();
maTypeModel.moShapeType = o3tl::toInt32(tmp);
}
}
}
+2 -2
View File
@@ -297,7 +297,7 @@ ShapeTypeContext::ShapeTypeContext(ContextHandler2Helper const & rParent,
mrTypeModel.maShapeName = rAttribs.getXString( XML_id, OUString() );
// get ShapeType and ShapeId from name for compatibility
static constexpr OUString sShapeTypePrefix = u"shapetype_"_ustr;
OUString tmp;
std::u16string_view tmp;
if( mrTypeModel.maShapeName.startsWith( sShapeTypePrefix ) )
{
mrTypeModel.maShapeId = mrTypeModel.maShapeName;
@@ -306,7 +306,7 @@ ShapeTypeContext::ShapeTypeContext(ContextHandler2Helper const & rParent,
else if (mrTypeModel.maShapeName.startsWith("_x0000_t", &tmp))
{
mrTypeModel.maShapeId = mrTypeModel.maShapeName;
mrTypeModel.moShapeType = tmp.toInt32();
mrTypeModel.moShapeType = o3tl::toInt32(tmp);
}
}
+3 -3
View File
@@ -47,7 +47,7 @@
#include <BulletAndPositionDlg.hxx>
#include <sdresid.hxx>
#include <DrawViewShell.hxx>
#include <o3tl/string_view.hxx>
#include <bitmaps.hlst>
#define SHOW_NUMBERING 0
@@ -815,10 +815,10 @@ IMPL_LINK(SvxBulletAndPositionDlg, GraphicHdl_Impl, const OUString&, rIdent, voi
bool bSucc(false);
SvxOpenGraphicDialog aGrfDlg(SdResId(RID_SVXSTR_EDIT_GRAPHIC), p_Window);
OUString sNumber;
std::u16string_view sNumber;
if (rIdent.startsWith("gallery", &sNumber))
{
auto idx = sNumber.toUInt32();
auto idx = o3tl::toUInt32(sNumber);
if (idx < aGrfNames.size())
{
aGrfName = aGrfNames[idx];
+1 -1
View File
@@ -784,7 +784,7 @@ bool rewriteFlatpakHelpRootUrl(OUString * helpRootUrl) {
}
ini.close();
// Extract <sha> from ...;org.libreoffice.LibreOffice.Help=<sha>;...:
OUString sha;
std::u16string_view sha;
for (sal_Int32 i = 0;;) {
OUString elem = extensions.getToken(0, ';', i);
if (elem.startsWith("org.libreoffice.LibreOffice.Help=", &sha)) {
+5 -4
View File
@@ -53,6 +53,7 @@
#include <sal/log.hxx>
#include <officecfg/Office/UI/Sidebar.hxx>
#include <LibreOfficeKit/LibreOfficeKitEnums.h>
#include <o3tl/string_view.hxx>
#include <com/sun/star/awt/XWindowPeer.hpp>
#include <com/sun/star/frame/XDispatch.hpp>
@@ -1154,11 +1155,11 @@ IMPL_LINK(SidebarController, OnMenuItemSelected, const OUString&, rCurItemId, vo
{
try
{
OUString sNumber;
std::u16string_view sNumber;
if (rCurItemId.startsWith("select", &sNumber))
{
RequestOpenDeck();
SwitchToDeck(mpTabBar->GetDeckIdForIndex(sNumber.toInt32()));
SwitchToDeck(mpTabBar->GetDeckIdForIndex(o3tl::toInt32(sNumber)));
}
mpParentWindow->GrabFocusToDocument();
}
@@ -1176,10 +1177,10 @@ IMPL_LINK(SidebarController, OnSubMenuItemSelected, const OUString&, rCurItemId,
{
try
{
OUString sNumber;
std::u16string_view sNumber;
if (rCurItemId.startsWith("customize", &sNumber))
{
mpTabBar->ToggleHideFlag(sNumber.toInt32());
mpTabBar->ToggleHideFlag(o3tl::toInt32(sNumber));
// Find the set of decks that could be displayed for the new context.
ResourceManager::DeckContextDescriptorContainer aDecks;
+8 -6
View File
@@ -28,6 +28,7 @@
#include <set>
#include <o3tl/any.hxx>
#include <o3tl/string_view.hxx>
#include <osl/diagnose.h>
#include <sal/log.hxx>
#include <cppuhelper/basemutex.hxx>
@@ -2014,7 +2015,7 @@ css::uno::Reference<css::beans::XIntrospectionAccess> Implementation::inspect(
// Get name and evaluate
OUString aMethName2 = rxMethod_k->getName();
OUString aPropName2;
std::u16string_view aPropName2;
if (!(aMethName2.startsWith("set", &aPropName2)
&& aPropName2 == aPropName))
continue;
@@ -2061,7 +2062,7 @@ css::uno::Reference<css::beans::XIntrospectionAccess> Implementation::inspect(
else if( aMethName.startsWith("add", &aPropName) )
{
// Does it end with "Listener"?
OUString aListenerName;
std::u16string_view aListenerName;
if( !aPropName.endsWith("Listener", &aListenerName) )
continue;
@@ -2083,11 +2084,12 @@ css::uno::Reference<css::beans::XIntrospectionAccess> Implementation::inspect(
// Get name and evaluate
OUString aMethName2 = rxMethod_k->getName();
OUString aListenerName2;
std::u16string_view rest;
std::u16string_view aListenerName2;
if (!(aMethName2.startsWith(
"remove", &aPropName)
&& aPropName.endsWith(
"Listener", &aListenerName2)
"remove", &rest)
&& o3tl::ends_with(rest,
u"Listener", &aListenerName2)
&& aListenerName2 == aListenerName))
continue;
+2 -2
View File
@@ -1948,10 +1948,10 @@ namespace svxform
for (int i = 0; i < nCount; ++i)
{
OUString sIdent = m_xTabCtrl->get_page_ident(i);
OUString sNumber;
std::u16string_view sNumber;
if (!sIdent.startsWith("additional", &sNumber))
continue;
int nPageId = sNumber.toInt32();
int nPageId = o3tl::toInt32(sNumber);
if (nMax < nPageId)
nMax = nPageId;
}
+1 -1
View File
@@ -224,7 +224,7 @@ bool PaletteGPL::IsValid()
bool PaletteGPL::ReadPaletteHeader(SvFileStream& rFileStream)
{
OString aLine;
OString aPaletteName;
std::string_view aPaletteName;
rFileStream.ReadLine(aLine);
if( !aLine.startsWith("GIMP Palette") ) return false;
@@ -511,10 +511,10 @@ OUString DomainMapper_Impl::GetUnusedCharacterStyleName()
sal_Int32 nMaxIndex = 0;
for ( const auto& rStyleName : aCharacterStyleNames )
{
OUString sSuffix;
std::u16string_view sSuffix;
if ( rStyleName.startsWith( cListLabel, &sSuffix ) )
{
sal_Int32 nSuffix = sSuffix.toInt32();
sal_Int32 nSuffix = o3tl::toInt32(sSuffix);
if( nSuffix > 0 && nSuffix > nMaxIndex )
nMaxIndex = nSuffix;
}
+2 -2
View File
@@ -20,14 +20,14 @@ namespace cmis
static OUString CheckInsecureProtocol(OUString const& rURL)
{
OUString rest;
std::u16string_view rest;
if (rURL.startsWithIgnoreAsciiCase("http://", &rest))
{
if (!officecfg::Office::Security::Net::AllowInsecureProtocols::get())
{
// "http" not allowed -> immediately redirect to "https",
// better than showing confusing error to user
return "https://" + rest;
return OUString::Concat("https://") + rest;
}
}
return rURL;
+10 -9
View File
@@ -510,19 +510,19 @@ static auto ProcessHeaders(::std::vector<OString> const& rHeaders) -> ::std::map
::std::map<OUString, OUString> ret;
for (OString const& rLine : rHeaders)
{
OString line;
std::string_view line;
if (!rLine.endsWith("\r\n", &line))
{
SAL_WARN("ucb.ucp.webdav.curl", "invalid header field (no CRLF)");
continue;
}
if (line.startsWith("HTTP/") // first line
|| line.isEmpty()) // last line
if (o3tl::starts_with(line, "HTTP/") // first line
|| line.empty()) // last line
{
continue;
}
auto const nColon(line.indexOf(':'));
if (nColon == -1)
auto const nColon(line.find(':'));
if (nColon == std::string_view::npos)
{
{
SAL_WARN("ucb.ucp.webdav.curl", "invalid header field (no :)");
@@ -535,20 +535,21 @@ static auto ProcessHeaders(::std::vector<OString> const& rHeaders) -> ::std::map
continue;
}
// case insensitive; must be ASCII
auto const name(::rtl::OStringToOUString(line.copy(0, nColon).toAsciiLowerCase(),
auto const name(::rtl::OStringToOUString(OString(line.substr(0, nColon)).toAsciiLowerCase(),
RTL_TEXTENCODING_ASCII_US));
sal_Int32 nStart(nColon + 1);
while (nStart < line.getLength() && (line[nStart] == ' ' || line[nStart] == '\t'))
while (nStart < static_cast<sal_Int32>(line.size())
&& (line[nStart] == ' ' || line[nStart] == '\t'))
{
++nStart;
}
sal_Int32 nEnd(line.getLength());
sal_Int32 nEnd(line.size());
while (nStart < nEnd && (line[nEnd - 1] == ' ' || line[nEnd - 1] == '\t'))
{
--nEnd;
}
// RFC 7230 says that only ASCII works reliably anyway (neon also did this)
auto const value(::rtl::OStringToOUString(line.subView(nStart, nEnd - nStart),
auto const value(::rtl::OStringToOUString(line.substr(nStart, nEnd - nStart),
RTL_TEXTENCODING_ASCII_US));
auto const it(ret.find(name));
if (it != ret.end())
+2 -2
View File
@@ -2282,10 +2282,10 @@ void TextView::ToggleComment()
// Notice that a REM comment is only actually a comment if:
// a) There is no subsequent character or
// b) The subsequent character is a blank space or a tab
OUString sRest;
std::u16string_view sRest;
if (sText.startsWithIgnoreAsciiCase("REM", &sRest))
{
if (sRest.getLength() > 0 && !sRest.startsWith(" ") && !sRest.startsWith("\t"))
if (sRest.size() > 0 && !o3tl::starts_with(sRest, u" ") && !o3tl::starts_with(sRest, u"\t"))
{
bAddCommentChar = true;
break;
+3 -3
View File
@@ -112,11 +112,11 @@ sal_uInt32 PDFDocument::GetNextSignature()
continue;
const OString& rValue = pT->GetValue();
static constexpr std::string_view aPrefix = "Signature";
if (!rValue.startsWith(aPrefix))
std::string_view rest;
if (!rValue.startsWith("Signature", &rest))
continue;
nRet = std::max(nRet, o3tl::toUInt32(rValue.subView(aPrefix.size())));
nRet = std::max(nRet, o3tl::toUInt32(rest));
}
return nRet + 1;
+3 -3
View File
@@ -3911,15 +3911,15 @@ std::vector<vcl::EnumContext::Context> VclBuilder::handleStyle(xmlreader::XmlRea
if (name == "class")
{
OUString classStyle = getStyleClass(reader);
OUString rest;
std::u16string_view rest;
if (classStyle.startsWith("context-", &rest))
{
aContext.push_back(vcl::EnumContext::GetContextEnum(rest));
aContext.push_back(vcl::EnumContext::GetContextEnum(OUString(rest)));
}
else if (classStyle.startsWith("priority-", &rest))
{
nPriority = rest.toInt32();
nPriority = o3tl::toInt32(rest);
}
else if (classStyle != "small-button" && classStyle != "destructive-action" && classStyle != "suggested-action")
{
+2 -2
View File
@@ -1002,11 +1002,11 @@ void PPDParser::parse( ::std::vector< OString >& rLines )
}
else if( aKey == "CustomPageSize" ) // currently not handled
continue;
else if (aKey.startsWith("Custom", &aKey) )
else if ( std::string_view rest; aKey.startsWith("Custom", &rest) )
{
//fdo#43049 very basic support for Custom entries, we ignore the
//validation params and types
OUString aUniKey(OStringToOUString(aKey, RTL_TEXTENCODING_MS_1252));
OUString aUniKey(OStringToOUString(rest, RTL_TEXTENCODING_MS_1252));
keyit = m_aKeys.find( aUniKey );
if(keyit != m_aKeys.end())
{
@@ -289,7 +289,7 @@ const std::vector< OUString >& Databases::getModuleList( const OUString& Languag
fileName = aStatus.getFileName();
// Check, whether fileName is of the form *.cfg
if (!fileName.endsWithIgnoreAsciiCase(".cfg", &fileName)) {
if (!fileName.endsWithIgnoreAsciiCase(u".cfg", &fileName)) {
continue;
}
fileName = fileName.toAsciiLowerCase();
+2 -3
View File
@@ -514,8 +514,7 @@ char const s_PkgScheme[] = "vnd.sun.star.Package:";
static OUString lcl_StoreMediaAndGetURL(SvXMLExport & rExport, OUString const& rURL)
{
OUString urlPath;
if (rURL.startsWithIgnoreAsciiCase(s_PkgScheme, &urlPath))
if (rURL.startsWithIgnoreAsciiCase(s_PkgScheme))
{
try // video is embedded
{
@@ -528,7 +527,7 @@ static OUString lcl_StoreMediaAndGetURL(SvXMLExport & rExport, OUString const& r
uno::Reference<embed::XStorage> const xTarget(
rExport.GetTargetStorage(), uno::UNO_SET_THROW);
urlPath = rURL.copy(SAL_N_ELEMENTS(s_PkgScheme)-1);
OUString urlPath = rURL.copy(SAL_N_ELEMENTS(s_PkgScheme)-1);
lcl_CopyStream(xSource, xTarget, urlPath);