diff options
author | Noel Grandin <noel.grandin@collabora.co.uk> | 2021-05-17 15:17:13 +0200 |
---|---|---|
committer | Noel Grandin <noel.grandin@collabora.co.uk> | 2021-05-18 12:58:55 +0200 |
commit | 7462343cb9c7a61cd28c7eae245f21b6bfc56b40 (patch) | |
tree | fef10a16712d4bc070dd0905ebd8ae437d2f947c /include | |
parent | 5c5b058c83e31e798a63a96d0e16b35927ce519f (diff) |
update "add OString::getTokenView"
update
commit 3669d4ec43a6aa2d410d8351d631548db45a5302
Date: Fri May 14 15:51:38 2021 +0200
add OString::getTokenView (tdf#42374 related)
with suggested changes from gerrit review
Change-Id: I861d960deaa010740a4aa964e402c4c76a85cbc7
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/115706
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'include')
-rw-r--r-- | include/rtl/string.h | 51 | ||||
-rw-r--r-- | include/rtl/string.hxx | 2 |
2 files changed, 7 insertions, 46 deletions
diff --git a/include/rtl/string.h b/include/rtl/string.h index c0f724245d9e..c86468c7f302 100644 --- a/include/rtl/string.h +++ b/include/rtl/string.h @@ -747,31 +747,6 @@ SAL_DLLPUBLIC sal_Bool SAL_CALL rtl_str_toBoolean( SAL_DLLPUBLIC sal_Int32 SAL_CALL rtl_str_toInt32( const char * str, sal_Int16 radix ) SAL_THROW_EXTERN_C(); -/** Interpret a string as an integer. - - This function cannot be used for language-specific conversion. The string - must be null-terminated. - - @param str - a null-terminated string. - - @param radix - the radix. Must be between RTL_STR_MIN_RADIX (2) and RTL_STR_MAX_RADIX - (36), inclusive. - - @param len - the length of the character array. - - @return - the integer value represented by the string, or 0 if the string does not - represent an integer. - - @since LibreOffice 7.2 - @internal - */ -SAL_DLLPUBLIC sal_Int32 SAL_CALL rtl_str_toInt32_WithLength( - const char * str, sal_Int16 radix, sal_Int32 nStrLength ) SAL_THROW_EXTERN_C(); - /** Interpret a string as an unsigned integer. This function cannot be used for language-specific conversion. The string @@ -1289,7 +1264,7 @@ SAL_DLLPUBLIC void SAL_CALL rtl_string_newTrim( /** Create a new string by extracting a single token from another string. - Starting at index, the token's next token is searched for. If there is no + Starting at index, the next token is searched for. If there is no such token, the result is an empty string. Otherwise, all characters from the start of that token and up to, but not including the next occurrence of cTok make up the resulting token. The return value is the position of @@ -1334,33 +1309,19 @@ SAL_DLLPUBLIC void SAL_CALL rtl_string_newTrim( SAL_DLLPUBLIC sal_Int32 SAL_CALL rtl_string_getToken( rtl_String ** newStr , rtl_String * str, sal_Int32 token, char cTok, sal_Int32 idx ) SAL_THROW_EXTERN_C(); +/** @cond INTERNAL */ /** Create a new string by extracting a single token from another string. - Starting at index, the token's next token is searched for. If there is no + Starting at index, the next token is searched for. If there is no such token, the result is an empty string. Otherwise, all characters from the start of that token and up to, but not including the next occurrence of cTok make up the resulting token. The return value is the position of the next token, or -1 if no more tokens follow. - Example code could look like - rtl_String * pToken = NULL; - sal_Int32 nIndex = 0; - do - { - ... - nIndex = rtl_string_getToken(&pToken, pStr, 0, ';', nIndex); - ... - } - while (nIndex >= 0); - - The new string does not necessarily have a reference count of 1, so it - must not be modified without checking the reference count. This function - does not handle out-of-memory conditions. + This function does not handle out-of-memory conditions. @param ppViewStr - pointer to the start of the token. The pointed-to data must be null or a valid - string. If either token or index is negative, nullptr is stored in - newStr (and -1 is returned). + pointer to the start of the token. @param pViewLength length of the token. @@ -1382,10 +1343,10 @@ SAL_DLLPUBLIC sal_Int32 SAL_CALL rtl_string_getToken( the index of the next token, or -1 if no more tokens follow. @since LibreOffice 7.2 - @internal */ SAL_DLLPUBLIC sal_Int32 SAL_CALL rtl_string_getTokenView( const char ** ppViewStr , sal_Int32* pViewLength, rtl_String * str, sal_Int32 token, char cTok, sal_Int32 idx ) SAL_THROW_EXTERN_C(); +/** @endcond */ /* ======================================================================= */ diff --git a/include/rtl/string.hxx b/include/rtl/string.hxx index c16519fa14df..3fc461de0c2c 100644 --- a/include/rtl/string.hxx +++ b/include/rtl/string.hxx @@ -1765,7 +1765,7 @@ public: index = rtl_string_getToken( &pNew, pData, token, cTok, index ); return OString( pNew, SAL_NO_ACQUIRE ); } -#ifdef LIBO_INTERNAL_ONLY // "RTL_FAST_STRING" +#ifdef LIBO_INTERNAL_ONLY std::string_view getTokenView( sal_Int32 token, char cTok, sal_Int32& index ) const { const char* pViewData = nullptr; |