diff options
Diffstat (limited to 'include')
-rw-r--r-- | include/comphelper/string.hxx | 2 | ||||
-rw-r--r-- | include/rtl/string.h | 5 | ||||
-rw-r--r-- | include/rtl/string.hxx | 12 | ||||
-rw-r--r-- | include/rtl/ustring.h | 5 | ||||
-rw-r--r-- | include/rtl/ustring.hxx | 12 |
5 files changed, 35 insertions, 1 deletions
diff --git a/include/comphelper/string.hxx b/include/comphelper/string.hxx index 349dc17360a4..d4c9ccd1b947 100644 --- a/include/comphelper/string.hxx +++ b/include/comphelper/string.hxx @@ -234,7 +234,7 @@ inline OUStringBuffer& padToLength( @return original string with token nToken replaced by rNewToken */ COMPHELPER_DLLPUBLIC OUString setToken(const OUString& rIn, sal_Int32 nToken, sal_Unicode cTok, - const OUString& rNewToken); + std::u16string_view rNewToken); /** Find any of a list of code units in the string. @param rIn OUString to search diff --git a/include/rtl/string.h b/include/rtl/string.h index e0d751f18bd3..f80bef02ca91 100644 --- a/include/rtl/string.h +++ b/include/rtl/string.h @@ -1108,6 +1108,11 @@ SAL_DLLPUBLIC void SAL_CALL rtl_string_newConcat( rtl_String ** newStr, rtl_Stri SAL_DLLPUBLIC void SAL_CALL rtl_string_newReplaceStrAt( rtl_String ** newStr, rtl_String * str, sal_Int32 idx, sal_Int32 count, rtl_String * subStr ) SAL_THROW_EXTERN_C(); +#ifdef LIBO_INTERNAL_ONLY +SAL_DLLPUBLIC void SAL_CALL rtl_string_newReplaceStrAt_WithLength ( + rtl_String ** newStr, rtl_String * str, sal_Int32 idx, sal_Int32 count, char const * subStr, sal_Int32 substrLen ) SAL_THROW_EXTERN_C(); +#endif + /** Create a new string by replacing all occurrences of a single character within another string. diff --git a/include/rtl/string.hxx b/include/rtl/string.hxx index cebaa114517d..440f80900855 100644 --- a/include/rtl/string.hxx +++ b/include/rtl/string.hxx @@ -1594,6 +1594,8 @@ public: } #endif +// hide this from internal code to avoid ambiguous lookup error +#ifndef LIBO_INTERNAL_ONLY /** Returns a new string resulting from replacing n = count characters from position index in this string with newStr. @@ -1613,6 +1615,16 @@ public: rtl_string_newReplaceStrAt( &pNew, pData, index, count, newStr.pData ); return OString( pNew, SAL_NO_ACQUIRE ); } +#endif + +#ifdef LIBO_INTERNAL_ONLY + SAL_WARN_UNUSED_RESULT OString replaceAt( sal_Int32 index, sal_Int32 count, std::string_view newStr ) const + { + rtl_String* pNew = NULL; + rtl_string_newReplaceStrAt_WithLength ( &pNew, pData, index, count, newStr.data(), newStr.size() ); + return OString( pNew, SAL_NO_ACQUIRE ); + } +#endif /** Returns a new string resulting from replacing all occurrences of diff --git a/include/rtl/ustring.h b/include/rtl/ustring.h index b4990fec12eb..16ec6ed5931c 100644 --- a/include/rtl/ustring.h +++ b/include/rtl/ustring.h @@ -1541,6 +1541,11 @@ SAL_DLLPUBLIC void SAL_CALL rtl_uString_newConcatUtf16L( SAL_DLLPUBLIC void SAL_CALL rtl_uString_newReplaceStrAt( rtl_uString ** newStr, rtl_uString * str, sal_Int32 idx, sal_Int32 count, rtl_uString * subStr ) SAL_THROW_EXTERN_C(); +#ifdef LIBO_INTERNAL_ONLY +SAL_DLLPUBLIC void SAL_CALL rtl_uString_newReplaceStrAtUtf16L( + rtl_uString ** newStr, rtl_uString * str, sal_Int32 idx, sal_Int32 count, sal_Unicode const * subStr, sal_Int32 substrLen ) SAL_THROW_EXTERN_C(); +#endif + /** Create a new string by replacing all occurrences of a single character within another string. diff --git a/include/rtl/ustring.hxx b/include/rtl/ustring.hxx index e14549482f35..13cc367c5589 100644 --- a/include/rtl/ustring.hxx +++ b/include/rtl/ustring.hxx @@ -2223,6 +2223,8 @@ public: } #endif +// hide this from internal code to avoid ambiguous lookup error +#ifndef LIBO_INTERNAL_ONLY /** Returns a new string resulting from replacing n = count characters from position index in this string with newStr. @@ -2242,6 +2244,16 @@ public: rtl_uString_newReplaceStrAt( &pNew, pData, index, count, newStr.pData ); return OUString( pNew, SAL_NO_ACQUIRE ); } +#endif + +#ifdef LIBO_INTERNAL_ONLY + SAL_WARN_UNUSED_RESULT OUString replaceAt( sal_Int32 index, sal_Int32 count, std::u16string_view newStr ) const + { + rtl_uString* pNew = NULL; + rtl_uString_newReplaceStrAtUtf16L( &pNew, pData, index, count, newStr.data(), newStr.size() ); + return OUString( pNew, SAL_NO_ACQUIRE ); + } +#endif /** Returns a new string resulting from replacing all occurrences of |