1*cdf0e10cSrcweir /************************************************************************* 2*cdf0e10cSrcweir * 3*cdf0e10cSrcweir * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 4*cdf0e10cSrcweir * 5*cdf0e10cSrcweir * Copyright 2000, 2010 Oracle and/or its affiliates. 6*cdf0e10cSrcweir * 7*cdf0e10cSrcweir * OpenOffice.org - a multi-platform office productivity suite 8*cdf0e10cSrcweir * 9*cdf0e10cSrcweir * This file is part of OpenOffice.org. 10*cdf0e10cSrcweir * 11*cdf0e10cSrcweir * OpenOffice.org is free software: you can redistribute it and/or modify 12*cdf0e10cSrcweir * it under the terms of the GNU Lesser General Public License version 3 13*cdf0e10cSrcweir * only, as published by the Free Software Foundation. 14*cdf0e10cSrcweir * 15*cdf0e10cSrcweir * OpenOffice.org is distributed in the hope that it will be useful, 16*cdf0e10cSrcweir * but WITHOUT ANY WARRANTY; without even the implied warranty of 17*cdf0e10cSrcweir * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 18*cdf0e10cSrcweir * GNU Lesser General Public License version 3 for more details 19*cdf0e10cSrcweir * (a copy is included in the LICENSE file that accompanied this code). 20*cdf0e10cSrcweir * 21*cdf0e10cSrcweir * You should have received a copy of the GNU Lesser General Public License 22*cdf0e10cSrcweir * version 3 along with OpenOffice.org. If not, see 23*cdf0e10cSrcweir * <http://www.openoffice.org/license.html> 24*cdf0e10cSrcweir * for a copy of the LGPLv3 License. 25*cdf0e10cSrcweir * 26*cdf0e10cSrcweir ************************************************************************/ 27*cdf0e10cSrcweir 28*cdf0e10cSrcweir #ifndef _RTL_STRING_H_ 29*cdf0e10cSrcweir #define _RTL_STRING_H_ 30*cdf0e10cSrcweir 31*cdf0e10cSrcweir #include <sal/types.h> 32*cdf0e10cSrcweir #include <osl/interlck.h> 33*cdf0e10cSrcweir #include <rtl/textcvt.h> 34*cdf0e10cSrcweir 35*cdf0e10cSrcweir #ifdef __cplusplus 36*cdf0e10cSrcweir extern "C" { 37*cdf0e10cSrcweir #endif 38*cdf0e10cSrcweir 39*cdf0e10cSrcweir /* ======================================================================= */ 40*cdf0e10cSrcweir 41*cdf0e10cSrcweir /** Return the length of a string. 42*cdf0e10cSrcweir 43*cdf0e10cSrcweir The length is equal to the number of 8-bit characters in the string, 44*cdf0e10cSrcweir without the terminating NUL character. 45*cdf0e10cSrcweir 46*cdf0e10cSrcweir @param str 47*cdf0e10cSrcweir a null-terminated string. 48*cdf0e10cSrcweir 49*cdf0e10cSrcweir @return 50*cdf0e10cSrcweir the length of the sequence of characters represented by this string, 51*cdf0e10cSrcweir excluding the terminating NUL character. 52*cdf0e10cSrcweir */ 53*cdf0e10cSrcweir sal_Int32 SAL_CALL rtl_str_getLength( const sal_Char * str ) SAL_THROW_EXTERN_C(); 54*cdf0e10cSrcweir 55*cdf0e10cSrcweir /** Compare two strings. 56*cdf0e10cSrcweir 57*cdf0e10cSrcweir The comparison is based on the numeric value of each character in the 58*cdf0e10cSrcweir strings and returns a value indicating their relationship. This function 59*cdf0e10cSrcweir cannot be used for language-specific sorting. Both strings must be 60*cdf0e10cSrcweir null-terminated. 61*cdf0e10cSrcweir 62*cdf0e10cSrcweir @param first 63*cdf0e10cSrcweir the first null-terminated string to be compared. 64*cdf0e10cSrcweir 65*cdf0e10cSrcweir @param second 66*cdf0e10cSrcweir the second null-terminated string which is compared with the first one. 67*cdf0e10cSrcweir 68*cdf0e10cSrcweir @return 69*cdf0e10cSrcweir 0 if both strings are equal, a value less than 0 if the first string is 70*cdf0e10cSrcweir less than the second string, and a value greater than 0 if the first 71*cdf0e10cSrcweir string is greater than the second string. 72*cdf0e10cSrcweir */ 73*cdf0e10cSrcweir sal_Int32 SAL_CALL rtl_str_compare( const sal_Char * first, const sal_Char * second ) SAL_THROW_EXTERN_C(); 74*cdf0e10cSrcweir 75*cdf0e10cSrcweir /** Compare two strings. 76*cdf0e10cSrcweir 77*cdf0e10cSrcweir The comparison is based on the numeric value of each character in the 78*cdf0e10cSrcweir strings and returns a value indicating their relationship. This function 79*cdf0e10cSrcweir cannot be used for language-specific sorting. 80*cdf0e10cSrcweir 81*cdf0e10cSrcweir @param first 82*cdf0e10cSrcweir the first string to be compared. Need not be null-terminated, but must be 83*cdf0e10cSrcweir at least as long as the specified firstLen. 84*cdf0e10cSrcweir 85*cdf0e10cSrcweir @param firstLen 86*cdf0e10cSrcweir the length of the first string. 87*cdf0e10cSrcweir 88*cdf0e10cSrcweir @param second 89*cdf0e10cSrcweir the second string which is compared with the first one. Need not be 90*cdf0e10cSrcweir null-terminated, but must be at least as long as the specified secondLen. 91*cdf0e10cSrcweir 92*cdf0e10cSrcweir @param secondLen 93*cdf0e10cSrcweir the length of the second string. 94*cdf0e10cSrcweir 95*cdf0e10cSrcweir @return 96*cdf0e10cSrcweir 0 if both strings are equal, a value less than 0 if the first string is 97*cdf0e10cSrcweir less than the second string, and a value greater than 0 if the first 98*cdf0e10cSrcweir string is greater than the second string. 99*cdf0e10cSrcweir */ 100*cdf0e10cSrcweir sal_Int32 SAL_CALL rtl_str_compare_WithLength( const sal_Char * first, sal_Int32 firstLen, const sal_Char * second, sal_Int32 secondLen ) SAL_THROW_EXTERN_C(); 101*cdf0e10cSrcweir 102*cdf0e10cSrcweir /** Compare two strings with a maximum count of characters. 103*cdf0e10cSrcweir 104*cdf0e10cSrcweir The comparison is based on the numeric value of each character in the 105*cdf0e10cSrcweir strings and returns a value indicating their relationship. This function 106*cdf0e10cSrcweir cannot be used for language-specific sorting. 107*cdf0e10cSrcweir 108*cdf0e10cSrcweir @param first 109*cdf0e10cSrcweir the first string to be compared. Need not be null-terminated, but must be 110*cdf0e10cSrcweir at least as long as the specified firstLen. 111*cdf0e10cSrcweir 112*cdf0e10cSrcweir @param firstLen 113*cdf0e10cSrcweir the length of the first string. 114*cdf0e10cSrcweir 115*cdf0e10cSrcweir @param second 116*cdf0e10cSrcweir the second string which is compared with the first one. Need not be 117*cdf0e10cSrcweir null-terminated, but must be at least as long as the specified secondLen. 118*cdf0e10cSrcweir 119*cdf0e10cSrcweir @param secondLen 120*cdf0e10cSrcweir the length of the second string. 121*cdf0e10cSrcweir 122*cdf0e10cSrcweir @param shortenedLen 123*cdf0e10cSrcweir the maximum number of characters to compare. This length can be greater 124*cdf0e10cSrcweir or smaller than the lengths of the two strings. 125*cdf0e10cSrcweir 126*cdf0e10cSrcweir @return 127*cdf0e10cSrcweir 0 if both substrings are equal, a value less than 0 if the first substring 128*cdf0e10cSrcweir is less than the second substring, and a value greater than 0 if the first 129*cdf0e10cSrcweir substring is greater than the second substring. 130*cdf0e10cSrcweir */ 131*cdf0e10cSrcweir sal_Int32 SAL_CALL rtl_str_shortenedCompare_WithLength( const sal_Char * first, sal_Int32 firstLen, const sal_Char * second, sal_Int32 secondLen, sal_Int32 shortenedLen ) SAL_THROW_EXTERN_C(); 132*cdf0e10cSrcweir 133*cdf0e10cSrcweir /** Compare two strings from back to front. 134*cdf0e10cSrcweir 135*cdf0e10cSrcweir The comparison is based on the numeric value of each character in the 136*cdf0e10cSrcweir strings and returns a value indicating their relationship. This function 137*cdf0e10cSrcweir cannot be used for language-specific sorting. 138*cdf0e10cSrcweir 139*cdf0e10cSrcweir @param first 140*cdf0e10cSrcweir the first string to be compared. Need not be null-terminated, but must be 141*cdf0e10cSrcweir at least as long as the specified firstLen. 142*cdf0e10cSrcweir 143*cdf0e10cSrcweir @param firstLen 144*cdf0e10cSrcweir the length of the first string. 145*cdf0e10cSrcweir 146*cdf0e10cSrcweir @param second 147*cdf0e10cSrcweir the second string which is compared with the first one. Need not be 148*cdf0e10cSrcweir null-terminated, but must be at least as long as the specified secondLen. 149*cdf0e10cSrcweir 150*cdf0e10cSrcweir @param secondLen 151*cdf0e10cSrcweir the length of the second string. 152*cdf0e10cSrcweir 153*cdf0e10cSrcweir @return 154*cdf0e10cSrcweir 0 if both strings are equal, a value less than 0 if the first string 155*cdf0e10cSrcweir compares less than the second string, and a value greater than 0 if the 156*cdf0e10cSrcweir first string compares greater than the second string. 157*cdf0e10cSrcweir */ 158*cdf0e10cSrcweir sal_Int32 SAL_CALL rtl_str_reverseCompare_WithLength( const sal_Char * first, sal_Int32 firstLen, const sal_Char * second, sal_Int32 secondLen ) SAL_THROW_EXTERN_C(); 159*cdf0e10cSrcweir 160*cdf0e10cSrcweir /** Compare two strings, ignoring the case of ASCII characters. 161*cdf0e10cSrcweir 162*cdf0e10cSrcweir The comparison is based on the numeric value of each character in the 163*cdf0e10cSrcweir strings and returns a value indicating their relationship. Character 164*cdf0e10cSrcweir values between 65 and 90 (ASCII A--Z) are interpreted as values between 97 165*cdf0e10cSrcweir and 122 (ASCII a--z). This function cannot be used for language-specific 166*cdf0e10cSrcweir sorting. Both strings must be null-terminated. 167*cdf0e10cSrcweir 168*cdf0e10cSrcweir @param first 169*cdf0e10cSrcweir the first null-terminated string to be compared. 170*cdf0e10cSrcweir 171*cdf0e10cSrcweir @param second 172*cdf0e10cSrcweir the second null-terminated string which is compared with the first one. 173*cdf0e10cSrcweir 174*cdf0e10cSrcweir @return 175*cdf0e10cSrcweir 0 if both strings are equal, a value less than 0 if the first string is 176*cdf0e10cSrcweir less than the second string, and a value greater than 0 if the first 177*cdf0e10cSrcweir string is greater than the second string. 178*cdf0e10cSrcweir */ 179*cdf0e10cSrcweir sal_Int32 SAL_CALL rtl_str_compareIgnoreAsciiCase( const sal_Char * first, const sal_Char * second ) SAL_THROW_EXTERN_C(); 180*cdf0e10cSrcweir 181*cdf0e10cSrcweir /** Compare two strings, ignoring the case of ASCII characters. 182*cdf0e10cSrcweir 183*cdf0e10cSrcweir The comparison is based on the numeric value of each character in the 184*cdf0e10cSrcweir strings and returns a value indicating their relationship. Character 185*cdf0e10cSrcweir values between 65 and 90 (ASCII A--Z) are interpreted as values between 97 186*cdf0e10cSrcweir and 122 (ASCII a--z). This function cannot be used for language-specific 187*cdf0e10cSrcweir sorting. 188*cdf0e10cSrcweir 189*cdf0e10cSrcweir @param first 190*cdf0e10cSrcweir the first string to be compared. Need not be null-terminated, but must be 191*cdf0e10cSrcweir at least as long as the specified firstLen. 192*cdf0e10cSrcweir 193*cdf0e10cSrcweir @param firstLen 194*cdf0e10cSrcweir the length of the first string. 195*cdf0e10cSrcweir 196*cdf0e10cSrcweir @param second 197*cdf0e10cSrcweir the second string which is compared with the first one. Need not be 198*cdf0e10cSrcweir null-terminated, but must be at least as long as the specified secondLen. 199*cdf0e10cSrcweir 200*cdf0e10cSrcweir @param secondLen 201*cdf0e10cSrcweir the length of the second string. 202*cdf0e10cSrcweir 203*cdf0e10cSrcweir @return 204*cdf0e10cSrcweir 0 if both strings are equal, a value less than 0 if the first string is 205*cdf0e10cSrcweir less than the second string, and a value greater than 0 if the first 206*cdf0e10cSrcweir string is greater than the second string. 207*cdf0e10cSrcweir */ 208*cdf0e10cSrcweir sal_Int32 SAL_CALL rtl_str_compareIgnoreAsciiCase_WithLength( const sal_Char * first, sal_Int32 firstLen, const sal_Char * second, sal_Int32 secondLen ) SAL_THROW_EXTERN_C(); 209*cdf0e10cSrcweir 210*cdf0e10cSrcweir /** Compare two strings with a maximum count of characters, ignoring the case 211*cdf0e10cSrcweir of ASCII characters. 212*cdf0e10cSrcweir 213*cdf0e10cSrcweir The comparison is based on the numeric value of each character in the 214*cdf0e10cSrcweir strings and returns a value indicating their relationship. Character 215*cdf0e10cSrcweir values between 65 and 90 (ASCII A--Z) are interpreted as values between 97 216*cdf0e10cSrcweir and 122 (ASCII a--z). This function cannot be used for language-specific 217*cdf0e10cSrcweir sorting. 218*cdf0e10cSrcweir 219*cdf0e10cSrcweir @param first 220*cdf0e10cSrcweir the first string to be compared. Need not be null-terminated, but must be 221*cdf0e10cSrcweir at least as long as the specified firstLen. 222*cdf0e10cSrcweir 223*cdf0e10cSrcweir @param firstLen 224*cdf0e10cSrcweir the length of the first string. 225*cdf0e10cSrcweir 226*cdf0e10cSrcweir @param second 227*cdf0e10cSrcweir the second string which is compared with the first one. Need not be 228*cdf0e10cSrcweir null-terminated, but must be at least as long as the specified secondLen. 229*cdf0e10cSrcweir 230*cdf0e10cSrcweir @param secondLen 231*cdf0e10cSrcweir the length of the second string. 232*cdf0e10cSrcweir 233*cdf0e10cSrcweir @param shortenedLen 234*cdf0e10cSrcweir the maximum number of characters to compare. This length can be greater 235*cdf0e10cSrcweir or smaller than the lengths of the two strings. 236*cdf0e10cSrcweir 237*cdf0e10cSrcweir @return 238*cdf0e10cSrcweir 0 if both substrings are equal, a value less than 0 if the first substring 239*cdf0e10cSrcweir is less than the second substring, and a value greater than 0 if the first 240*cdf0e10cSrcweir substring is greater than the second substring. 241*cdf0e10cSrcweir */ 242*cdf0e10cSrcweir sal_Int32 SAL_CALL rtl_str_shortenedCompareIgnoreAsciiCase_WithLength( const sal_Char * first, sal_Int32 firstLen, const sal_Char * second, sal_Int32 secondLen, sal_Int32 shortenedLen ) SAL_THROW_EXTERN_C(); 243*cdf0e10cSrcweir 244*cdf0e10cSrcweir /** Return a hash code for a string. 245*cdf0e10cSrcweir 246*cdf0e10cSrcweir It is not allowed to store the hash code persistently, because later 247*cdf0e10cSrcweir versions could return other hash codes. The string must be 248*cdf0e10cSrcweir null-terminated. 249*cdf0e10cSrcweir 250*cdf0e10cSrcweir @param str 251*cdf0e10cSrcweir a null-terminated string. 252*cdf0e10cSrcweir 253*cdf0e10cSrcweir @return 254*cdf0e10cSrcweir a hash code for the given string. 255*cdf0e10cSrcweir */ 256*cdf0e10cSrcweir sal_Int32 SAL_CALL rtl_str_hashCode( const sal_Char * str ) SAL_THROW_EXTERN_C(); 257*cdf0e10cSrcweir 258*cdf0e10cSrcweir /** Return a hash code for a string. 259*cdf0e10cSrcweir 260*cdf0e10cSrcweir It is not allowed to store the hash code persistently, because later 261*cdf0e10cSrcweir versions could return other hash codes. 262*cdf0e10cSrcweir 263*cdf0e10cSrcweir @param str 264*cdf0e10cSrcweir a string. Need not be null-terminated, but must be at least as long as 265*cdf0e10cSrcweir the specified len. 266*cdf0e10cSrcweir 267*cdf0e10cSrcweir @param len 268*cdf0e10cSrcweir the length of the string. 269*cdf0e10cSrcweir 270*cdf0e10cSrcweir @return 271*cdf0e10cSrcweir a hash code for the given string. 272*cdf0e10cSrcweir */ 273*cdf0e10cSrcweir sal_Int32 SAL_CALL rtl_str_hashCode_WithLength( const sal_Char * str, sal_Int32 len ) SAL_THROW_EXTERN_C(); 274*cdf0e10cSrcweir 275*cdf0e10cSrcweir /** Search for the first occurrence of a character within a string. 276*cdf0e10cSrcweir 277*cdf0e10cSrcweir The string must be null-terminated. 278*cdf0e10cSrcweir 279*cdf0e10cSrcweir @param str 280*cdf0e10cSrcweir a null-terminated string. 281*cdf0e10cSrcweir 282*cdf0e10cSrcweir @param ch 283*cdf0e10cSrcweir the character to be searched for. 284*cdf0e10cSrcweir 285*cdf0e10cSrcweir @return 286*cdf0e10cSrcweir the index (starting at 0) of the first occurrence of the character in the 287*cdf0e10cSrcweir string, or -1 if the character does not occur. 288*cdf0e10cSrcweir */ 289*cdf0e10cSrcweir sal_Int32 SAL_CALL rtl_str_indexOfChar( const sal_Char * str, sal_Char ch ) SAL_THROW_EXTERN_C(); 290*cdf0e10cSrcweir 291*cdf0e10cSrcweir /** Search for the first occurrence of a character within a string. 292*cdf0e10cSrcweir 293*cdf0e10cSrcweir @param str 294*cdf0e10cSrcweir a string. Need not be null-terminated, but must be at least as long as 295*cdf0e10cSrcweir the specified len. 296*cdf0e10cSrcweir 297*cdf0e10cSrcweir @param len 298*cdf0e10cSrcweir the length of the string. 299*cdf0e10cSrcweir 300*cdf0e10cSrcweir @param ch 301*cdf0e10cSrcweir the character to be searched for. 302*cdf0e10cSrcweir 303*cdf0e10cSrcweir @return 304*cdf0e10cSrcweir the index (starting at 0) of the first occurrence of the character in the 305*cdf0e10cSrcweir string, or -1 if the character does not occur. 306*cdf0e10cSrcweir */ 307*cdf0e10cSrcweir sal_Int32 SAL_CALL rtl_str_indexOfChar_WithLength( const sal_Char * str, sal_Int32 len, sal_Char ch ) SAL_THROW_EXTERN_C(); 308*cdf0e10cSrcweir 309*cdf0e10cSrcweir /** Search for the last occurrence of a character within a string. 310*cdf0e10cSrcweir 311*cdf0e10cSrcweir The string must be null-terminated. 312*cdf0e10cSrcweir 313*cdf0e10cSrcweir @param str 314*cdf0e10cSrcweir a null-terminated string. 315*cdf0e10cSrcweir 316*cdf0e10cSrcweir @param ch 317*cdf0e10cSrcweir the character to be searched for. 318*cdf0e10cSrcweir 319*cdf0e10cSrcweir @return 320*cdf0e10cSrcweir the index (starting at 0) of the last occurrence of the character in the 321*cdf0e10cSrcweir string, or -1 if the character does not occur. The returned value is 322*cdf0e10cSrcweir always smaller than the string length. 323*cdf0e10cSrcweir */ 324*cdf0e10cSrcweir sal_Int32 SAL_CALL rtl_str_lastIndexOfChar( const sal_Char * str, sal_Char ch ) SAL_THROW_EXTERN_C(); 325*cdf0e10cSrcweir 326*cdf0e10cSrcweir /** Search for the last occurrence of a character within a string. 327*cdf0e10cSrcweir 328*cdf0e10cSrcweir @param str 329*cdf0e10cSrcweir a string. Need not be null-terminated, but must be at least as long as 330*cdf0e10cSrcweir the specified len. 331*cdf0e10cSrcweir 332*cdf0e10cSrcweir @param len 333*cdf0e10cSrcweir the length of the string. 334*cdf0e10cSrcweir 335*cdf0e10cSrcweir @param ch 336*cdf0e10cSrcweir the character to be searched for. 337*cdf0e10cSrcweir 338*cdf0e10cSrcweir @return 339*cdf0e10cSrcweir the index (starting at 0) of the last occurrence of the character in the 340*cdf0e10cSrcweir string, or -1 if the character does not occur. The returned value is 341*cdf0e10cSrcweir always smaller than the string length. 342*cdf0e10cSrcweir */ 343*cdf0e10cSrcweir sal_Int32 SAL_CALL rtl_str_lastIndexOfChar_WithLength( const sal_Char * str, sal_Int32 len, sal_Char ch ) SAL_THROW_EXTERN_C(); 344*cdf0e10cSrcweir 345*cdf0e10cSrcweir /** Search for the first occurrence of a substring within a string. 346*cdf0e10cSrcweir 347*cdf0e10cSrcweir If subStr is empty, or both str and subStr are empty, -1 is returned. 348*cdf0e10cSrcweir Both strings must be null-terminated. 349*cdf0e10cSrcweir 350*cdf0e10cSrcweir @param str 351*cdf0e10cSrcweir a null-terminated string. 352*cdf0e10cSrcweir 353*cdf0e10cSrcweir @param subStr 354*cdf0e10cSrcweir the null-terminated substring to be searched for. 355*cdf0e10cSrcweir 356*cdf0e10cSrcweir @return 357*cdf0e10cSrcweir the index (starting at 0) of the first character of the first occurrence 358*cdf0e10cSrcweir of the substring within the string, or -1 if the substring does not occur. 359*cdf0e10cSrcweir */ 360*cdf0e10cSrcweir sal_Int32 SAL_CALL rtl_str_indexOfStr( const sal_Char * str, const sal_Char * subStr ) SAL_THROW_EXTERN_C(); 361*cdf0e10cSrcweir 362*cdf0e10cSrcweir /** Search for the first occurrence of a substring within a string. 363*cdf0e10cSrcweir 364*cdf0e10cSrcweir If subStr is empty, or both str and subStr are empty, -1 is returned. 365*cdf0e10cSrcweir 366*cdf0e10cSrcweir @param str 367*cdf0e10cSrcweir a string. Need not be null-terminated, but must be at least as long as 368*cdf0e10cSrcweir the specified len. 369*cdf0e10cSrcweir 370*cdf0e10cSrcweir @param len 371*cdf0e10cSrcweir the length of the string. 372*cdf0e10cSrcweir 373*cdf0e10cSrcweir @param subStr 374*cdf0e10cSrcweir the substring to be searched for. Need not be null-terminated, but must 375*cdf0e10cSrcweir be at least as long as the specified subLen. 376*cdf0e10cSrcweir 377*cdf0e10cSrcweir @param subLen 378*cdf0e10cSrcweir the length of the substring. 379*cdf0e10cSrcweir 380*cdf0e10cSrcweir @return 381*cdf0e10cSrcweir the index (starting at 0) of the first character of the first occurrence 382*cdf0e10cSrcweir of the substring within the string, or -1 if the substring does not occur. 383*cdf0e10cSrcweir */ 384*cdf0e10cSrcweir sal_Int32 SAL_CALL rtl_str_indexOfStr_WithLength( const sal_Char * str, sal_Int32 len, const sal_Char * subStr, sal_Int32 subLen ) SAL_THROW_EXTERN_C(); 385*cdf0e10cSrcweir 386*cdf0e10cSrcweir /** Search for the last occurrence of a substring within a string. 387*cdf0e10cSrcweir 388*cdf0e10cSrcweir If subStr is empty, or both str and subStr are empty, -1 is returned. 389*cdf0e10cSrcweir Both strings must be null-terminated. 390*cdf0e10cSrcweir 391*cdf0e10cSrcweir @param str 392*cdf0e10cSrcweir a null-terminated string. 393*cdf0e10cSrcweir 394*cdf0e10cSrcweir @param subStr 395*cdf0e10cSrcweir the null-terminated substring to be searched for. 396*cdf0e10cSrcweir 397*cdf0e10cSrcweir @return 398*cdf0e10cSrcweir the index (starting at 0) of the first character of the last occurrence 399*cdf0e10cSrcweir of the substring within the string, or -1 if the substring does not occur. 400*cdf0e10cSrcweir */ 401*cdf0e10cSrcweir sal_Int32 SAL_CALL rtl_str_lastIndexOfStr( const sal_Char * str, const sal_Char * subStr ) SAL_THROW_EXTERN_C(); 402*cdf0e10cSrcweir 403*cdf0e10cSrcweir /** Search for the last occurrence of a substring within a string. 404*cdf0e10cSrcweir 405*cdf0e10cSrcweir If subStr is empty, or both str and subStr are empty, -1 is returned. 406*cdf0e10cSrcweir 407*cdf0e10cSrcweir @param str 408*cdf0e10cSrcweir a string. Need not be null-terminated, but must be at least as long as 409*cdf0e10cSrcweir the specified len. 410*cdf0e10cSrcweir 411*cdf0e10cSrcweir @param len 412*cdf0e10cSrcweir the length of the string. 413*cdf0e10cSrcweir 414*cdf0e10cSrcweir @param subStr 415*cdf0e10cSrcweir the substring to be searched for. Need not be null-terminated, but must 416*cdf0e10cSrcweir be at least as long as the specified subLen. 417*cdf0e10cSrcweir 418*cdf0e10cSrcweir @param subLen 419*cdf0e10cSrcweir the length of the substring. 420*cdf0e10cSrcweir 421*cdf0e10cSrcweir @return 422*cdf0e10cSrcweir the index (starting at 0) of the first character of the first occurrence 423*cdf0e10cSrcweir of the substring within the string, or -1 if the substring does not occur. 424*cdf0e10cSrcweir */ 425*cdf0e10cSrcweir sal_Int32 SAL_CALL rtl_str_lastIndexOfStr_WithLength( const sal_Char * str, sal_Int32 len, const sal_Char * subStr, sal_Int32 subLen ) SAL_THROW_EXTERN_C(); 426*cdf0e10cSrcweir 427*cdf0e10cSrcweir /** Replace all occurrences of a single character within a string. 428*cdf0e10cSrcweir 429*cdf0e10cSrcweir If oldChar does not occur within str, then the string is not modified. 430*cdf0e10cSrcweir The string must be null-terminated. 431*cdf0e10cSrcweir 432*cdf0e10cSrcweir @param str 433*cdf0e10cSrcweir a null-terminated string. 434*cdf0e10cSrcweir 435*cdf0e10cSrcweir @param oldChar 436*cdf0e10cSrcweir the old character. 437*cdf0e10cSrcweir 438*cdf0e10cSrcweir @param newChar 439*cdf0e10cSrcweir the new character. 440*cdf0e10cSrcweir */ 441*cdf0e10cSrcweir void SAL_CALL rtl_str_replaceChar( sal_Char * str, sal_Char oldChar, sal_Char newChar ) SAL_THROW_EXTERN_C(); 442*cdf0e10cSrcweir 443*cdf0e10cSrcweir /** Replace all occurrences of a single character within a string. 444*cdf0e10cSrcweir 445*cdf0e10cSrcweir If oldChar does not occur within str, then the string is not modified. 446*cdf0e10cSrcweir 447*cdf0e10cSrcweir @param str 448*cdf0e10cSrcweir a string. Need not be null-terminated, but must be at least as long as 449*cdf0e10cSrcweir the specified len. 450*cdf0e10cSrcweir 451*cdf0e10cSrcweir @param len 452*cdf0e10cSrcweir the length of the string. 453*cdf0e10cSrcweir 454*cdf0e10cSrcweir @param oldChar 455*cdf0e10cSrcweir the old character. 456*cdf0e10cSrcweir 457*cdf0e10cSrcweir @param newChar 458*cdf0e10cSrcweir the new character. 459*cdf0e10cSrcweir */ 460*cdf0e10cSrcweir void SAL_CALL rtl_str_replaceChar_WithLength( sal_Char * str, sal_Int32 len, sal_Char oldChar, sal_Char newChar ) SAL_THROW_EXTERN_C(); 461*cdf0e10cSrcweir 462*cdf0e10cSrcweir /** Convert all ASCII uppercase letters to lowercase within a string. 463*cdf0e10cSrcweir 464*cdf0e10cSrcweir The characters with values between 65 and 90 (ASCII A--Z) are replaced 465*cdf0e10cSrcweir with values between 97 and 122 (ASCII a--z). The string must be 466*cdf0e10cSrcweir null-terminated. 467*cdf0e10cSrcweir 468*cdf0e10cSrcweir @param str 469*cdf0e10cSrcweir a null-terminated string. 470*cdf0e10cSrcweir */ 471*cdf0e10cSrcweir void SAL_CALL rtl_str_toAsciiLowerCase( sal_Char * str ) SAL_THROW_EXTERN_C(); 472*cdf0e10cSrcweir 473*cdf0e10cSrcweir /** Convert all ASCII uppercase letters to lowercase within a string. 474*cdf0e10cSrcweir 475*cdf0e10cSrcweir The characters with values between 65 and 90 (ASCII A--Z) are replaced 476*cdf0e10cSrcweir with values between 97 and 122 (ASCII a--z). 477*cdf0e10cSrcweir 478*cdf0e10cSrcweir @param str 479*cdf0e10cSrcweir a string. Need not be null-terminated, but must be at least as long as 480*cdf0e10cSrcweir the specified len. 481*cdf0e10cSrcweir 482*cdf0e10cSrcweir @param len 483*cdf0e10cSrcweir the length of the string. 484*cdf0e10cSrcweir */ 485*cdf0e10cSrcweir void SAL_CALL rtl_str_toAsciiLowerCase_WithLength( sal_Char * str, sal_Int32 len ) SAL_THROW_EXTERN_C(); 486*cdf0e10cSrcweir 487*cdf0e10cSrcweir /** Convert all ASCII lowercase letters to uppercase within a string. 488*cdf0e10cSrcweir 489*cdf0e10cSrcweir The characters with values between 97 and 122 (ASCII a--z) are replaced 490*cdf0e10cSrcweir with values between 65 and 90 (ASCII A--Z). The string must be 491*cdf0e10cSrcweir null-terminated. 492*cdf0e10cSrcweir 493*cdf0e10cSrcweir @param str 494*cdf0e10cSrcweir a null-terminated string. 495*cdf0e10cSrcweir */ 496*cdf0e10cSrcweir void SAL_CALL rtl_str_toAsciiUpperCase( sal_Char * str ) SAL_THROW_EXTERN_C(); 497*cdf0e10cSrcweir 498*cdf0e10cSrcweir /** Convert all ASCII lowercase letters to uppercase within a string. 499*cdf0e10cSrcweir 500*cdf0e10cSrcweir The characters with values between 97 and 122 (ASCII a--z) are replaced 501*cdf0e10cSrcweir with values between 65 and 90 (ASCII A--Z). 502*cdf0e10cSrcweir 503*cdf0e10cSrcweir @param str 504*cdf0e10cSrcweir a string. Need not be null-terminated, but must be at least as long as 505*cdf0e10cSrcweir the specified len. 506*cdf0e10cSrcweir 507*cdf0e10cSrcweir @param len 508*cdf0e10cSrcweir the length of the string. 509*cdf0e10cSrcweir */ 510*cdf0e10cSrcweir void SAL_CALL rtl_str_toAsciiUpperCase_WithLength( sal_Char * str, sal_Int32 len ) SAL_THROW_EXTERN_C(); 511*cdf0e10cSrcweir 512*cdf0e10cSrcweir /** Remove white space from both ends of a string. 513*cdf0e10cSrcweir 514*cdf0e10cSrcweir All characters with values less than or equal to 32 (the space character) 515*cdf0e10cSrcweir are considered to be white space. This function cannot be used for 516*cdf0e10cSrcweir language-specific operations. The string must be null-terminated. 517*cdf0e10cSrcweir 518*cdf0e10cSrcweir @param str 519*cdf0e10cSrcweir a null-terminated string. 520*cdf0e10cSrcweir 521*cdf0e10cSrcweir @return 522*cdf0e10cSrcweir the new length of the string. 523*cdf0e10cSrcweir */ 524*cdf0e10cSrcweir sal_Int32 SAL_CALL rtl_str_trim( sal_Char * str ) SAL_THROW_EXTERN_C(); 525*cdf0e10cSrcweir 526*cdf0e10cSrcweir /** Remove white space from both ends of the string. 527*cdf0e10cSrcweir 528*cdf0e10cSrcweir All characters with values less than or equal to 32 (the space character) 529*cdf0e10cSrcweir are considered to be white space. This function cannot be used for 530*cdf0e10cSrcweir language-specific operations. The string must be null-terminated. 531*cdf0e10cSrcweir 532*cdf0e10cSrcweir @param str 533*cdf0e10cSrcweir a string. Need not be null-terminated, but must be at least as long as 534*cdf0e10cSrcweir the specified len. 535*cdf0e10cSrcweir 536*cdf0e10cSrcweir @param len 537*cdf0e10cSrcweir the original length of the string. 538*cdf0e10cSrcweir 539*cdf0e10cSrcweir @return 540*cdf0e10cSrcweir the new length of the string. 541*cdf0e10cSrcweir */ 542*cdf0e10cSrcweir sal_Int32 SAL_CALL rtl_str_trim_WithLength( sal_Char * str, sal_Int32 len ) SAL_THROW_EXTERN_C(); 543*cdf0e10cSrcweir 544*cdf0e10cSrcweir /** Create the string representation of a boolean. 545*cdf0e10cSrcweir 546*cdf0e10cSrcweir If b is true, the buffer is filled with the string "true" and 5 is 547*cdf0e10cSrcweir returned. If b is false, the buffer is filled with the string "false" and 548*cdf0e10cSrcweir 6 is returned. This function cannot be used for language-specific 549*cdf0e10cSrcweir operations. 550*cdf0e10cSrcweir 551*cdf0e10cSrcweir @param str 552*cdf0e10cSrcweir a buffer that is big enough to hold the result and the terminating NUL 553*cdf0e10cSrcweir character. You should use the RTL_STR_MAX_VALUEOFBOOLEAN define to create 554*cdf0e10cSrcweir a buffer that is big enough. 555*cdf0e10cSrcweir 556*cdf0e10cSrcweir @param b 557*cdf0e10cSrcweir a boolean value. 558*cdf0e10cSrcweir 559*cdf0e10cSrcweir @return 560*cdf0e10cSrcweir the length of the string. 561*cdf0e10cSrcweir */ 562*cdf0e10cSrcweir sal_Int32 SAL_CALL rtl_str_valueOfBoolean( sal_Char * str, sal_Bool b ) SAL_THROW_EXTERN_C(); 563*cdf0e10cSrcweir #define RTL_STR_MAX_VALUEOFBOOLEAN 6 564*cdf0e10cSrcweir 565*cdf0e10cSrcweir /** Create the string representation of a character. 566*cdf0e10cSrcweir 567*cdf0e10cSrcweir @param str 568*cdf0e10cSrcweir a buffer that is big enough to hold the result and the terminating NUL 569*cdf0e10cSrcweir character. You should use the RTL_STR_MAX_VALUEOFCHAR define to create a 570*cdf0e10cSrcweir buffer that is big enough. 571*cdf0e10cSrcweir 572*cdf0e10cSrcweir @param ch 573*cdf0e10cSrcweir a character value. 574*cdf0e10cSrcweir 575*cdf0e10cSrcweir @return 576*cdf0e10cSrcweir the length of the string. 577*cdf0e10cSrcweir */ 578*cdf0e10cSrcweir sal_Int32 SAL_CALL rtl_str_valueOfChar( sal_Char * str, sal_Char ch ) SAL_THROW_EXTERN_C(); 579*cdf0e10cSrcweir #define RTL_STR_MAX_VALUEOFCHAR 2 580*cdf0e10cSrcweir 581*cdf0e10cSrcweir /** Create the string representation of an integer. 582*cdf0e10cSrcweir 583*cdf0e10cSrcweir This function cannot be used for language-specific operations. 584*cdf0e10cSrcweir 585*cdf0e10cSrcweir @param str 586*cdf0e10cSrcweir a buffer that is big enough to hold the result and the terminating NUL 587*cdf0e10cSrcweir character. You should use the RTL_STR_MAX_VALUEOFINT32 define to create a 588*cdf0e10cSrcweir buffer that is big enough. 589*cdf0e10cSrcweir 590*cdf0e10cSrcweir @param i 591*cdf0e10cSrcweir an integer value. 592*cdf0e10cSrcweir 593*cdf0e10cSrcweir @param radix 594*cdf0e10cSrcweir the radix. Must be between RTL_STR_MIN_RADIX (2) and RTL_STR_MAX_RADIX 595*cdf0e10cSrcweir (36), inclusive. 596*cdf0e10cSrcweir 597*cdf0e10cSrcweir @return 598*cdf0e10cSrcweir the length of the string. 599*cdf0e10cSrcweir */ 600*cdf0e10cSrcweir sal_Int32 SAL_CALL rtl_str_valueOfInt32( sal_Char * str, sal_Int32 i, sal_Int16 radix ) SAL_THROW_EXTERN_C(); 601*cdf0e10cSrcweir #define RTL_STR_MIN_RADIX 2 602*cdf0e10cSrcweir #define RTL_STR_MAX_RADIX 36 603*cdf0e10cSrcweir #define RTL_STR_MAX_VALUEOFINT32 33 604*cdf0e10cSrcweir 605*cdf0e10cSrcweir /** Create the string representation of a long integer. 606*cdf0e10cSrcweir 607*cdf0e10cSrcweir This function cannot be used for language-specific operations. 608*cdf0e10cSrcweir 609*cdf0e10cSrcweir @param str 610*cdf0e10cSrcweir a buffer that is big enough to hold the result and the terminating NUL 611*cdf0e10cSrcweir character. You should use the RTL_STR_MAX_VALUEOFINT64 define to create a 612*cdf0e10cSrcweir buffer that is big enough. 613*cdf0e10cSrcweir 614*cdf0e10cSrcweir @param l 615*cdf0e10cSrcweir a long integer value. 616*cdf0e10cSrcweir 617*cdf0e10cSrcweir @param radix 618*cdf0e10cSrcweir the radix. Must be between RTL_STR_MIN_RADIX (2) and RTL_STR_MAX_RADIX 619*cdf0e10cSrcweir (36), inclusive. 620*cdf0e10cSrcweir 621*cdf0e10cSrcweir @return 622*cdf0e10cSrcweir the length of the string. 623*cdf0e10cSrcweir */ 624*cdf0e10cSrcweir sal_Int32 SAL_CALL rtl_str_valueOfInt64( sal_Char * str, sal_Int64 l, sal_Int16 radix ) SAL_THROW_EXTERN_C(); 625*cdf0e10cSrcweir #define RTL_STR_MAX_VALUEOFINT64 65 626*cdf0e10cSrcweir 627*cdf0e10cSrcweir /** Create the string representation of a float. 628*cdf0e10cSrcweir 629*cdf0e10cSrcweir This function cannot be used for language-specific conversion. 630*cdf0e10cSrcweir 631*cdf0e10cSrcweir @param str 632*cdf0e10cSrcweir a buffer that is big enough to hold the result and the terminating NUL 633*cdf0e10cSrcweir character. You should use the RTL_STR_MAX_VALUEOFFLOAT define to create a 634*cdf0e10cSrcweir buffer that is big enough. 635*cdf0e10cSrcweir 636*cdf0e10cSrcweir @param f 637*cdf0e10cSrcweir a float value. 638*cdf0e10cSrcweir 639*cdf0e10cSrcweir @return 640*cdf0e10cSrcweir the length of the string. 641*cdf0e10cSrcweir */ 642*cdf0e10cSrcweir sal_Int32 SAL_CALL rtl_str_valueOfFloat( sal_Char * str, float f ) SAL_THROW_EXTERN_C(); 643*cdf0e10cSrcweir #define RTL_STR_MAX_VALUEOFFLOAT 15 644*cdf0e10cSrcweir 645*cdf0e10cSrcweir /** Create the string representation of a double. 646*cdf0e10cSrcweir 647*cdf0e10cSrcweir This function cannot be used for language-specific conversion. 648*cdf0e10cSrcweir 649*cdf0e10cSrcweir @param str 650*cdf0e10cSrcweir a buffer that is big enough to hold the result and the terminating NUL 651*cdf0e10cSrcweir character. You should use the RTL_STR_MAX_VALUEOFDOUBLE define to create 652*cdf0e10cSrcweir a buffer that is big enough. 653*cdf0e10cSrcweir 654*cdf0e10cSrcweir @param d 655*cdf0e10cSrcweir a double value. 656*cdf0e10cSrcweir 657*cdf0e10cSrcweir @return 658*cdf0e10cSrcweir the length of the string. 659*cdf0e10cSrcweir */ 660*cdf0e10cSrcweir sal_Int32 SAL_CALL rtl_str_valueOfDouble( sal_Char * str, double d ) SAL_THROW_EXTERN_C(); 661*cdf0e10cSrcweir #define RTL_STR_MAX_VALUEOFDOUBLE 25 662*cdf0e10cSrcweir 663*cdf0e10cSrcweir /** Interpret a string as a boolean. 664*cdf0e10cSrcweir 665*cdf0e10cSrcweir This function cannot be used for language-specific conversion. The string 666*cdf0e10cSrcweir must be null-terminated. 667*cdf0e10cSrcweir 668*cdf0e10cSrcweir @param str 669*cdf0e10cSrcweir a null-terminated string. 670*cdf0e10cSrcweir 671*cdf0e10cSrcweir @return 672*cdf0e10cSrcweir true if the string is "1" or "true" in any ASCII case, false otherwise. 673*cdf0e10cSrcweir */ 674*cdf0e10cSrcweir sal_Bool SAL_CALL rtl_str_toBoolean( const sal_Char * str ) SAL_THROW_EXTERN_C(); 675*cdf0e10cSrcweir 676*cdf0e10cSrcweir /** Interpret a string as an integer. 677*cdf0e10cSrcweir 678*cdf0e10cSrcweir This function cannot be used for language-specific conversion. The string 679*cdf0e10cSrcweir must be null-terminated. 680*cdf0e10cSrcweir 681*cdf0e10cSrcweir @param str 682*cdf0e10cSrcweir a null-terminated string. 683*cdf0e10cSrcweir 684*cdf0e10cSrcweir @param radix 685*cdf0e10cSrcweir the radix. Must be between RTL_STR_MIN_RADIX (2) and RTL_STR_MAX_RADIX 686*cdf0e10cSrcweir (36), inclusive. 687*cdf0e10cSrcweir 688*cdf0e10cSrcweir @return 689*cdf0e10cSrcweir the integer value represented by the string, or 0 if the string does not 690*cdf0e10cSrcweir represent an integer. 691*cdf0e10cSrcweir */ 692*cdf0e10cSrcweir sal_Int32 SAL_CALL rtl_str_toInt32( const sal_Char * str, sal_Int16 radix ) SAL_THROW_EXTERN_C(); 693*cdf0e10cSrcweir 694*cdf0e10cSrcweir /** Interpret a string as a long integer. 695*cdf0e10cSrcweir 696*cdf0e10cSrcweir This function cannot be used for language-specific conversion. The string 697*cdf0e10cSrcweir must be null-terminated. 698*cdf0e10cSrcweir 699*cdf0e10cSrcweir @param str 700*cdf0e10cSrcweir a null-terminated string. 701*cdf0e10cSrcweir 702*cdf0e10cSrcweir @param radix 703*cdf0e10cSrcweir the radix. Must be between RTL_STR_MIN_RADIX (2) and RTL_STR_MAX_RADIX 704*cdf0e10cSrcweir (36), inclusive. 705*cdf0e10cSrcweir 706*cdf0e10cSrcweir @return 707*cdf0e10cSrcweir the long integer value represented by the string, or 0 if the string does 708*cdf0e10cSrcweir not represent a long integer. 709*cdf0e10cSrcweir */ 710*cdf0e10cSrcweir sal_Int64 SAL_CALL rtl_str_toInt64( const sal_Char * str, sal_Int16 radix ) SAL_THROW_EXTERN_C(); 711*cdf0e10cSrcweir 712*cdf0e10cSrcweir /** Interpret a string as a float. 713*cdf0e10cSrcweir 714*cdf0e10cSrcweir This function cannot be used for language-specific conversion. The string 715*cdf0e10cSrcweir must be null-terminated. 716*cdf0e10cSrcweir 717*cdf0e10cSrcweir @param str 718*cdf0e10cSrcweir a null-terminated string. 719*cdf0e10cSrcweir 720*cdf0e10cSrcweir @return 721*cdf0e10cSrcweir the float value represented by the string, or 0.0 if the string does not 722*cdf0e10cSrcweir represent a float. 723*cdf0e10cSrcweir */ 724*cdf0e10cSrcweir float SAL_CALL rtl_str_toFloat( const sal_Char * str ) SAL_THROW_EXTERN_C(); 725*cdf0e10cSrcweir 726*cdf0e10cSrcweir /** Interpret a string as a double. 727*cdf0e10cSrcweir 728*cdf0e10cSrcweir This function cannot be used for language-specific conversion. The string 729*cdf0e10cSrcweir must be null-terminated. 730*cdf0e10cSrcweir 731*cdf0e10cSrcweir @param str 732*cdf0e10cSrcweir a null-terminated string. 733*cdf0e10cSrcweir 734*cdf0e10cSrcweir @return 735*cdf0e10cSrcweir the float value represented by the string, or 0.0 if the string does not 736*cdf0e10cSrcweir represent a double. 737*cdf0e10cSrcweir */ 738*cdf0e10cSrcweir double SAL_CALL rtl_str_toDouble( const sal_Char * str ) SAL_THROW_EXTERN_C(); 739*cdf0e10cSrcweir 740*cdf0e10cSrcweir /* ======================================================================= */ 741*cdf0e10cSrcweir 742*cdf0e10cSrcweir #ifdef SAL_W32 743*cdf0e10cSrcweir # pragma pack(push, 8) 744*cdf0e10cSrcweir #elif defined(SAL_OS2) 745*cdf0e10cSrcweir # pragma pack(push, 4) 746*cdf0e10cSrcweir #endif 747*cdf0e10cSrcweir 748*cdf0e10cSrcweir /** The implementation of a byte string. 749*cdf0e10cSrcweir 750*cdf0e10cSrcweir @internal 751*cdf0e10cSrcweir */ 752*cdf0e10cSrcweir typedef struct _rtl_String 753*cdf0e10cSrcweir { 754*cdf0e10cSrcweir oslInterlockedCount refCount; /* opaque */ 755*cdf0e10cSrcweir sal_Int32 length; 756*cdf0e10cSrcweir sal_Char buffer[1]; 757*cdf0e10cSrcweir } rtl_String; 758*cdf0e10cSrcweir 759*cdf0e10cSrcweir #if defined( SAL_W32) || defined(SAL_OS2) 760*cdf0e10cSrcweir #pragma pack(pop) 761*cdf0e10cSrcweir #endif 762*cdf0e10cSrcweir 763*cdf0e10cSrcweir /* ----------------------------------------------------------------------- */ 764*cdf0e10cSrcweir 765*cdf0e10cSrcweir /** Increment the reference count of a string. 766*cdf0e10cSrcweir 767*cdf0e10cSrcweir @param str 768*cdf0e10cSrcweir a string. 769*cdf0e10cSrcweir */ 770*cdf0e10cSrcweir void SAL_CALL rtl_string_acquire( rtl_String * str ) SAL_THROW_EXTERN_C(); 771*cdf0e10cSrcweir 772*cdf0e10cSrcweir /** Decrement the reference count of a string. 773*cdf0e10cSrcweir 774*cdf0e10cSrcweir If the count goes to zero than the string data is deleted. 775*cdf0e10cSrcweir 776*cdf0e10cSrcweir @param str 777*cdf0e10cSrcweir a string. 778*cdf0e10cSrcweir */ 779*cdf0e10cSrcweir void SAL_CALL rtl_string_release( rtl_String * str ) SAL_THROW_EXTERN_C(); 780*cdf0e10cSrcweir 781*cdf0e10cSrcweir /** Allocate a new string containing no characters. 782*cdf0e10cSrcweir 783*cdf0e10cSrcweir @param newStr 784*cdf0e10cSrcweir pointer to the new string. The pointed-to data must be null or a valid 785*cdf0e10cSrcweir string. 786*cdf0e10cSrcweir */ 787*cdf0e10cSrcweir void SAL_CALL rtl_string_new( rtl_String ** newStr ) SAL_THROW_EXTERN_C(); 788*cdf0e10cSrcweir 789*cdf0e10cSrcweir /** Allocate a new string containing space for a given number of characters. 790*cdf0e10cSrcweir 791*cdf0e10cSrcweir If len is greater than zero, the reference count of the new string will be 792*cdf0e10cSrcweir 1. The values of all characters are set to 0 and the length of the string 793*cdf0e10cSrcweir is 0. This function does not handle out-of-memory conditions. 794*cdf0e10cSrcweir 795*cdf0e10cSrcweir @param newStr 796*cdf0e10cSrcweir pointer to the new string. The pointed-to data must be null or a valid 797*cdf0e10cSrcweir string. 798*cdf0e10cSrcweir 799*cdf0e10cSrcweir @param len 800*cdf0e10cSrcweir the number of characters. 801*cdf0e10cSrcweir */ 802*cdf0e10cSrcweir void SAL_CALL rtl_string_new_WithLength( rtl_String ** newStr, sal_Int32 len ) SAL_THROW_EXTERN_C(); 803*cdf0e10cSrcweir 804*cdf0e10cSrcweir /** Allocate a new string that contains a copy of another string. 805*cdf0e10cSrcweir 806*cdf0e10cSrcweir If the length of value is greater than zero, the reference count of the 807*cdf0e10cSrcweir new string will be 1. This function does not handle out-of-memory 808*cdf0e10cSrcweir conditions. 809*cdf0e10cSrcweir 810*cdf0e10cSrcweir @param newStr 811*cdf0e10cSrcweir pointer to the new string. The pointed-to data must be null or a valid 812*cdf0e10cSrcweir string. 813*cdf0e10cSrcweir 814*cdf0e10cSrcweir @param value 815*cdf0e10cSrcweir a valid string. 816*cdf0e10cSrcweir */ 817*cdf0e10cSrcweir void SAL_CALL rtl_string_newFromString( rtl_String ** newStr, const rtl_String * value ) SAL_THROW_EXTERN_C(); 818*cdf0e10cSrcweir 819*cdf0e10cSrcweir /** Allocate a new string that contains a copy of a character array. 820*cdf0e10cSrcweir 821*cdf0e10cSrcweir If the length of value is greater than zero, the reference count of the 822*cdf0e10cSrcweir new string will be 1. This function does not handle out-of-memory 823*cdf0e10cSrcweir conditions. 824*cdf0e10cSrcweir 825*cdf0e10cSrcweir @param newStr 826*cdf0e10cSrcweir pointer to the new string. The pointed-to data must be null or a valid 827*cdf0e10cSrcweir string. 828*cdf0e10cSrcweir 829*cdf0e10cSrcweir @param value 830*cdf0e10cSrcweir a null-terminated character array. 831*cdf0e10cSrcweir */ 832*cdf0e10cSrcweir void SAL_CALL rtl_string_newFromStr( rtl_String ** newStr, const sal_Char * value ) SAL_THROW_EXTERN_C(); 833*cdf0e10cSrcweir 834*cdf0e10cSrcweir /** Allocate a new string that contains a copy of a character array. 835*cdf0e10cSrcweir 836*cdf0e10cSrcweir If the length of value is greater than zero, the reference count of the 837*cdf0e10cSrcweir new string will be 1. This function does not handle out-of-memory 838*cdf0e10cSrcweir conditions. 839*cdf0e10cSrcweir 840*cdf0e10cSrcweir @param newStr 841*cdf0e10cSrcweir pointer to the new string. The pointed-to data must be null or a valid 842*cdf0e10cSrcweir string. 843*cdf0e10cSrcweir 844*cdf0e10cSrcweir @param value 845*cdf0e10cSrcweir a character array. Need not be null-terminated, but must be at least as 846*cdf0e10cSrcweir long as the specified len. 847*cdf0e10cSrcweir 848*cdf0e10cSrcweir @param len 849*cdf0e10cSrcweir the length of the character array. 850*cdf0e10cSrcweir */ 851*cdf0e10cSrcweir void SAL_CALL rtl_string_newFromStr_WithLength( rtl_String ** newStr, const sal_Char * value, sal_Int32 len ) SAL_THROW_EXTERN_C(); 852*cdf0e10cSrcweir 853*cdf0e10cSrcweir /** Assign a new value to a string. 854*cdf0e10cSrcweir 855*cdf0e10cSrcweir First releases any value str might currently hold, then acquires 856*cdf0e10cSrcweir rightValue. 857*cdf0e10cSrcweir 858*cdf0e10cSrcweir @param str 859*cdf0e10cSrcweir pointer to the string. The pointed-to data must be null or a valid 860*cdf0e10cSrcweir string. 861*cdf0e10cSrcweir 862*cdf0e10cSrcweir @param rightValue 863*cdf0e10cSrcweir a valid string. 864*cdf0e10cSrcweir */ 865*cdf0e10cSrcweir void SAL_CALL rtl_string_assign( rtl_String ** str, rtl_String * rightValue ) SAL_THROW_EXTERN_C(); 866*cdf0e10cSrcweir 867*cdf0e10cSrcweir /** Return the length of a string. 868*cdf0e10cSrcweir 869*cdf0e10cSrcweir The length is equal to the number of characters in the string. 870*cdf0e10cSrcweir 871*cdf0e10cSrcweir @param str 872*cdf0e10cSrcweir a valid string. 873*cdf0e10cSrcweir 874*cdf0e10cSrcweir @return 875*cdf0e10cSrcweir the length of the string. 876*cdf0e10cSrcweir */ 877*cdf0e10cSrcweir sal_Int32 SAL_CALL rtl_string_getLength( const rtl_String * str ) SAL_THROW_EXTERN_C(); 878*cdf0e10cSrcweir 879*cdf0e10cSrcweir /** Return a pointer to the underlying character array of a string. 880*cdf0e10cSrcweir 881*cdf0e10cSrcweir @param str 882*cdf0e10cSrcweir a valid string. 883*cdf0e10cSrcweir 884*cdf0e10cSrcweir @return 885*cdf0e10cSrcweir a pointer to the null-terminated character array. 886*cdf0e10cSrcweir */ 887*cdf0e10cSrcweir sal_Char * SAL_CALL rtl_string_getStr( rtl_String * str ) SAL_THROW_EXTERN_C(); 888*cdf0e10cSrcweir 889*cdf0e10cSrcweir /** Create a new string that is the concatenation of two other strings. 890*cdf0e10cSrcweir 891*cdf0e10cSrcweir The new string does not necessarily have a reference count of 1 (in cases 892*cdf0e10cSrcweir where one of the two other strings is empty), so it must not be modified 893*cdf0e10cSrcweir without checking the reference count. This function does not handle 894*cdf0e10cSrcweir out-of-memory conditions. 895*cdf0e10cSrcweir 896*cdf0e10cSrcweir @param newStr 897*cdf0e10cSrcweir pointer to the new string. The pointed-to data must be null or a valid 898*cdf0e10cSrcweir string. 899*cdf0e10cSrcweir 900*cdf0e10cSrcweir @param left 901*cdf0e10cSrcweir a valid string. 902*cdf0e10cSrcweir 903*cdf0e10cSrcweir @param right 904*cdf0e10cSrcweir a valid string. 905*cdf0e10cSrcweir */ 906*cdf0e10cSrcweir void SAL_CALL rtl_string_newConcat( rtl_String ** newStr, rtl_String * left, rtl_String * right ) SAL_THROW_EXTERN_C(); 907*cdf0e10cSrcweir 908*cdf0e10cSrcweir /** Create a new string by replacing a substring of another string. 909*cdf0e10cSrcweir 910*cdf0e10cSrcweir The new string results from replacing a number of characters (count), 911*cdf0e10cSrcweir starting at the specified position (index) in the original string (str), 912*cdf0e10cSrcweir with some new substring (subStr). If subStr is null, than only a number 913*cdf0e10cSrcweir of characters is deleted. 914*cdf0e10cSrcweir 915*cdf0e10cSrcweir The new string does not necessarily have a reference count of 1, so it 916*cdf0e10cSrcweir must not be modified without checking the reference count. This function 917*cdf0e10cSrcweir does not handle out-of-memory conditions. 918*cdf0e10cSrcweir 919*cdf0e10cSrcweir @param newStr 920*cdf0e10cSrcweir pointer to the new string. The pointed-to data must be null or a valid 921*cdf0e10cSrcweir string. 922*cdf0e10cSrcweir 923*cdf0e10cSrcweir @param str 924*cdf0e10cSrcweir a valid string. 925*cdf0e10cSrcweir 926*cdf0e10cSrcweir @param index 927*cdf0e10cSrcweir the index into str at which to start replacement. Must be between 0 and 928*cdf0e10cSrcweir the length of str, inclusive. 929*cdf0e10cSrcweir 930*cdf0e10cSrcweir @param count 931*cdf0e10cSrcweir the number of charcters to remove. Must not be negative, and the sum of 932*cdf0e10cSrcweir index and count must not exceed the length of str. 933*cdf0e10cSrcweir 934*cdf0e10cSrcweir @param subStr 935*cdf0e10cSrcweir either null or a valid string to be inserted. 936*cdf0e10cSrcweir */ 937*cdf0e10cSrcweir 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(); 938*cdf0e10cSrcweir 939*cdf0e10cSrcweir /** Create a new string by replacing all occurrences of a single character 940*cdf0e10cSrcweir within another string. 941*cdf0e10cSrcweir 942*cdf0e10cSrcweir The new string results from replacing all occurrences of oldChar in str 943*cdf0e10cSrcweir with newChar. 944*cdf0e10cSrcweir 945*cdf0e10cSrcweir The new string does not necessarily have a reference count of 1 (in cases 946*cdf0e10cSrcweir where oldChar does not occur in str), so it must not be modified without 947*cdf0e10cSrcweir checking the reference count. This function does not handle out-of-memory 948*cdf0e10cSrcweir conditions. 949*cdf0e10cSrcweir 950*cdf0e10cSrcweir @param newStr 951*cdf0e10cSrcweir pointer to the new string. The pointed-to data must be null or a valid 952*cdf0e10cSrcweir string. 953*cdf0e10cSrcweir 954*cdf0e10cSrcweir @param str 955*cdf0e10cSrcweir a valid string. 956*cdf0e10cSrcweir 957*cdf0e10cSrcweir @param oldChar 958*cdf0e10cSrcweir the old character. 959*cdf0e10cSrcweir 960*cdf0e10cSrcweir @param newChar 961*cdf0e10cSrcweir the new character. 962*cdf0e10cSrcweir */ 963*cdf0e10cSrcweir void SAL_CALL rtl_string_newReplace( rtl_String ** newStr, rtl_String * str, sal_Char oldChar, sal_Char newChar ) SAL_THROW_EXTERN_C(); 964*cdf0e10cSrcweir 965*cdf0e10cSrcweir /** Create a new string by converting all ASCII uppercase letters to lowercase 966*cdf0e10cSrcweir within another string. 967*cdf0e10cSrcweir 968*cdf0e10cSrcweir The new string results from replacing all characters with values between 969*cdf0e10cSrcweir 65 and 90 (ASCII A--Z) by values between 97 and 122 (ASCII a--z). 970*cdf0e10cSrcweir 971*cdf0e10cSrcweir This function cannot be used for language-specific conversion. The new 972*cdf0e10cSrcweir string does not necessarily have a reference count of 1 (in cases where 973*cdf0e10cSrcweir no characters need to be converted), so it must not be modified without 974*cdf0e10cSrcweir checking the reference count. This function does not handle out-of-memory 975*cdf0e10cSrcweir conditions. 976*cdf0e10cSrcweir 977*cdf0e10cSrcweir @param newStr 978*cdf0e10cSrcweir pointer to the new string. The pointed-to data must be null or a valid 979*cdf0e10cSrcweir string. 980*cdf0e10cSrcweir 981*cdf0e10cSrcweir @param str 982*cdf0e10cSrcweir a valid string. 983*cdf0e10cSrcweir */ 984*cdf0e10cSrcweir void SAL_CALL rtl_string_newToAsciiLowerCase( rtl_String ** newStr, rtl_String * str ) SAL_THROW_EXTERN_C(); 985*cdf0e10cSrcweir 986*cdf0e10cSrcweir /** Create a new string by converting all ASCII lowercase letters to uppercase 987*cdf0e10cSrcweir within another string. 988*cdf0e10cSrcweir 989*cdf0e10cSrcweir The new string results from replacing all characters with values between 990*cdf0e10cSrcweir 97 and 122 (ASCII a--z) by values between 65 and 90 (ASCII A--Z). 991*cdf0e10cSrcweir 992*cdf0e10cSrcweir This function cannot be used for language-specific conversion. The new 993*cdf0e10cSrcweir string does not necessarily have a reference count of 1 (in cases where 994*cdf0e10cSrcweir no characters need to be converted), so it must not be modified without 995*cdf0e10cSrcweir checking the reference count. This function does not handle out-of-memory 996*cdf0e10cSrcweir conditions. 997*cdf0e10cSrcweir 998*cdf0e10cSrcweir @param newStr 999*cdf0e10cSrcweir pointer to the new string. The pointed-to data must be null or a valid 1000*cdf0e10cSrcweir string. 1001*cdf0e10cSrcweir 1002*cdf0e10cSrcweir @param str 1003*cdf0e10cSrcweir a valid string. 1004*cdf0e10cSrcweir */ 1005*cdf0e10cSrcweir void SAL_CALL rtl_string_newToAsciiUpperCase( rtl_String ** newStr, rtl_String * str ) SAL_THROW_EXTERN_C(); 1006*cdf0e10cSrcweir 1007*cdf0e10cSrcweir /** Create a new string by removing white space from both ends of another 1008*cdf0e10cSrcweir string. 1009*cdf0e10cSrcweir 1010*cdf0e10cSrcweir The new string results from removing all characters with values less than 1011*cdf0e10cSrcweir or equal to 32 (the space character) form both ends of str. 1012*cdf0e10cSrcweir 1013*cdf0e10cSrcweir This function cannot be used for language-specific conversion. The new 1014*cdf0e10cSrcweir string does not necessarily have a reference count of 1 (in cases where 1015*cdf0e10cSrcweir no characters need to be removed), so it must not be modified without 1016*cdf0e10cSrcweir checking the reference count. This function does not handle out-of-memory 1017*cdf0e10cSrcweir conditions. 1018*cdf0e10cSrcweir 1019*cdf0e10cSrcweir @param newStr 1020*cdf0e10cSrcweir pointer to the new string. The pointed-to data must be null or a valid 1021*cdf0e10cSrcweir string. 1022*cdf0e10cSrcweir 1023*cdf0e10cSrcweir @param str 1024*cdf0e10cSrcweir a valid string. 1025*cdf0e10cSrcweir */ 1026*cdf0e10cSrcweir void SAL_CALL rtl_string_newTrim( rtl_String ** newStr, rtl_String * str ) SAL_THROW_EXTERN_C(); 1027*cdf0e10cSrcweir 1028*cdf0e10cSrcweir /** Create a new string by extracting a single token from another string. 1029*cdf0e10cSrcweir 1030*cdf0e10cSrcweir Starting at index, the token's next token is searched for. If there is no 1031*cdf0e10cSrcweir such token, the result is an empty string. Otherwise, all characters from 1032*cdf0e10cSrcweir the start of that token and up to, but not including the next occurrence 1033*cdf0e10cSrcweir of cTok make up the resulting token. The return value is the position of 1034*cdf0e10cSrcweir the next token, or -1 if no more tokens follow. 1035*cdf0e10cSrcweir 1036*cdf0e10cSrcweir Example code could look like 1037*cdf0e10cSrcweir rtl_String * pToken = NULL; 1038*cdf0e10cSrcweir sal_Int32 nIndex = 0; 1039*cdf0e10cSrcweir do 1040*cdf0e10cSrcweir { 1041*cdf0e10cSrcweir ... 1042*cdf0e10cSrcweir nIndex = rtl_string_getToken(&pToken, pStr, 0, ';', nIndex); 1043*cdf0e10cSrcweir ... 1044*cdf0e10cSrcweir } 1045*cdf0e10cSrcweir while (nIndex >= 0); 1046*cdf0e10cSrcweir 1047*cdf0e10cSrcweir The new string does not necessarily have a reference count of 1, so it 1048*cdf0e10cSrcweir must not be modified without checking the reference count. This function 1049*cdf0e10cSrcweir does not handle out-of-memory conditions. 1050*cdf0e10cSrcweir 1051*cdf0e10cSrcweir @param newStr 1052*cdf0e10cSrcweir pointer to the new string. The pointed-to data must be null or a valid 1053*cdf0e10cSrcweir string. If either token or index is negative, an empty token is stored in 1054*cdf0e10cSrcweir newStr (and -1 is returned). 1055*cdf0e10cSrcweir 1056*cdf0e10cSrcweir @param str 1057*cdf0e10cSrcweir a valid string. 1058*cdf0e10cSrcweir 1059*cdf0e10cSrcweir @param token 1060*cdf0e10cSrcweir the number of the token to return, starting at index. 1061*cdf0e10cSrcweir 1062*cdf0e10cSrcweir @param cTok 1063*cdf0e10cSrcweir the character that seperates the tokens. 1064*cdf0e10cSrcweir 1065*cdf0e10cSrcweir @param index 1066*cdf0e10cSrcweir the position at which searching for the token starts. Must not be greater 1067*cdf0e10cSrcweir than the length of str. 1068*cdf0e10cSrcweir 1069*cdf0e10cSrcweir @return 1070*cdf0e10cSrcweir the index of the next token, or -1 if no more tokens follow. 1071*cdf0e10cSrcweir */ 1072*cdf0e10cSrcweir sal_Int32 SAL_CALL rtl_string_getToken( rtl_String ** newStr , rtl_String * str, sal_Int32 token, sal_Char cTok, sal_Int32 idx ) SAL_THROW_EXTERN_C(); 1073*cdf0e10cSrcweir 1074*cdf0e10cSrcweir /* ======================================================================= */ 1075*cdf0e10cSrcweir 1076*cdf0e10cSrcweir /** Supply an ASCII string literal together with its length. 1077*cdf0e10cSrcweir 1078*cdf0e10cSrcweir This macro can be used to compute (some of) the arguments in function calls 1079*cdf0e10cSrcweir like rtl::OString(RTL_CONSTASCII_STRINGPARAM("foo")) or 1080*cdf0e10cSrcweir rtl::OUString::equalsAsciiL(RTL_CONSTASCII_STRINGPARAM("foo")). 1081*cdf0e10cSrcweir 1082*cdf0e10cSrcweir @param constAsciiStr 1083*cdf0e10cSrcweir must be an expression of type "(possibly cv-qualified reference to) array of 1084*cdf0e10cSrcweir (possibly cv-qualified) char." Each element of the referenced array must 1085*cdf0e10cSrcweir represent an ASCII value in the range 0x00--0x7F. The last element of the 1086*cdf0e10cSrcweir referenced array is not considered part of the represented ASCII string, and 1087*cdf0e10cSrcweir its value should be 0x00. Depending on where this macro is used, the nature 1088*cdf0e10cSrcweir of the supplied expression might be further restricted. 1089*cdf0e10cSrcweir */ 1090*cdf0e10cSrcweir #define RTL_CONSTASCII_STRINGPARAM( constAsciiStr ) constAsciiStr, ((sal_Int32)sizeof(constAsciiStr)-1) 1091*cdf0e10cSrcweir 1092*cdf0e10cSrcweir /** Supply the length of an ASCII string literal. 1093*cdf0e10cSrcweir 1094*cdf0e10cSrcweir This macro can be used to compute arguments in function calls like 1095*cdf0e10cSrcweir rtl::OUString::match(other, RTL_CONSTASCII_LENGTH("prefix")). 1096*cdf0e10cSrcweir 1097*cdf0e10cSrcweir @param constAsciiStr 1098*cdf0e10cSrcweir must be an expression of type "(possibly cv-qualified reference to) array of 1099*cdf0e10cSrcweir (possibly cv-qualified) char." Each element of the referenced array must 1100*cdf0e10cSrcweir represent an ASCII value in the range 0x00--0x7F. The last element of the 1101*cdf0e10cSrcweir referenced array is not considered part of the represented ASCII string, and 1102*cdf0e10cSrcweir its value should be 0x00. Depending on where this macro is used, the nature 1103*cdf0e10cSrcweir of the supplied expression might be further restricted. 1104*cdf0e10cSrcweir */ 1105*cdf0e10cSrcweir #define RTL_CONSTASCII_LENGTH( constAsciiStr ) ((sal_Int32)(sizeof(constAsciiStr)-1)) 1106*cdf0e10cSrcweir 1107*cdf0e10cSrcweir /* ======================================================================= */ 1108*cdf0e10cSrcweir 1109*cdf0e10cSrcweir /* predefined constants for String-Conversion */ 1110*cdf0e10cSrcweir #define OUSTRING_TO_OSTRING_CVTFLAGS (RTL_UNICODETOTEXT_FLAGS_UNDEFINED_DEFAULT |\ 1111*cdf0e10cSrcweir RTL_UNICODETOTEXT_FLAGS_INVALID_DEFAULT |\ 1112*cdf0e10cSrcweir RTL_UNICODETOTEXT_FLAGS_UNDEFINED_REPLACE |\ 1113*cdf0e10cSrcweir RTL_UNICODETOTEXT_FLAGS_PRIVATE_MAPTO0 |\ 1114*cdf0e10cSrcweir RTL_UNICODETOTEXT_FLAGS_NOCOMPOSITE) 1115*cdf0e10cSrcweir 1116*cdf0e10cSrcweir /* ----------------------------------------------------------------------- */ 1117*cdf0e10cSrcweir 1118*cdf0e10cSrcweir /** Create a new byte string by converting a Unicode string, using a specific 1119*cdf0e10cSrcweir text encoding. 1120*cdf0e10cSrcweir 1121*cdf0e10cSrcweir The lengths of the byte string and the Unicode string may differ (e.g., 1122*cdf0e10cSrcweir for double-byte encodings, UTF-7, UTF-8). 1123*cdf0e10cSrcweir 1124*cdf0e10cSrcweir If the length of the Unicode string is greater than zero, the reference 1125*cdf0e10cSrcweir count of the new string will be 1. 1126*cdf0e10cSrcweir 1127*cdf0e10cSrcweir If an out-of-memory condition occurs, newStr will point to a null pointer 1128*cdf0e10cSrcweir upon return. 1129*cdf0e10cSrcweir 1130*cdf0e10cSrcweir @param newStr 1131*cdf0e10cSrcweir pointer to the new string. The pointed-to data must be null or a valid 1132*cdf0e10cSrcweir string. 1133*cdf0e10cSrcweir 1134*cdf0e10cSrcweir @param str 1135*cdf0e10cSrcweir a Unicode character array. Need not be null-terminated, but must be at 1136*cdf0e10cSrcweir least as long as the specified len. 1137*cdf0e10cSrcweir 1138*cdf0e10cSrcweir @param len 1139*cdf0e10cSrcweir the length of the Unicode character array. 1140*cdf0e10cSrcweir 1141*cdf0e10cSrcweir @param encoding 1142*cdf0e10cSrcweir the text encoding to use for conversion. 1143*cdf0e10cSrcweir 1144*cdf0e10cSrcweir @param convertFlags 1145*cdf0e10cSrcweir flags which control the conversion. Either use 1146*cdf0e10cSrcweir OUSTRING_TO_OSTRING_CVTFLAGS, or see 1147*cdf0e10cSrcweir <http://udk.openoffice.org/cpp/man/spec/textconversion.html> for more 1148*cdf0e10cSrcweir details. 1149*cdf0e10cSrcweir */ 1150*cdf0e10cSrcweir void SAL_CALL rtl_uString2String( rtl_String ** newStr, const sal_Unicode * str, sal_Int32 len, rtl_TextEncoding encoding, sal_uInt32 convertFlags ) SAL_THROW_EXTERN_C(); 1151*cdf0e10cSrcweir 1152*cdf0e10cSrcweir /** 1153*cdf0e10cSrcweir Converts a Unicode string to a byte string, signalling failure. 1154*cdf0e10cSrcweir 1155*cdf0e10cSrcweir @param pTarget 1156*cdf0e10cSrcweir An out parameter receiving the converted string. Must not be null itself, and 1157*cdf0e10cSrcweir must contain either null or a pointer to a valid rtl_String; the contents are 1158*cdf0e10cSrcweir not modified if conversion fails (rtl_convertUStringToString returns false). 1159*cdf0e10cSrcweir 1160*cdf0e10cSrcweir @param pSource 1161*cdf0e10cSrcweir The Unicode string. May only be null if nLength is zero. 1162*cdf0e10cSrcweir 1163*cdf0e10cSrcweir @param nLength 1164*cdf0e10cSrcweir The length of the Unicode string. Must be non-negative. 1165*cdf0e10cSrcweir 1166*cdf0e10cSrcweir @param nEncoding 1167*cdf0e10cSrcweir The text encoding to convert into. Must be an octet encoding (i.e., 1168*cdf0e10cSrcweir rtl_isOctetTextEncoding(nEncoding) must return true). 1169*cdf0e10cSrcweir 1170*cdf0e10cSrcweir @param nFlags 1171*cdf0e10cSrcweir A combination of RTL_UNICODETOTEXT_FLAGS that detail how to do the conversion 1172*cdf0e10cSrcweir (see rtl_convertUnicodeToText). RTL_UNICODETOTEXT_FLAGS_FLUSH need not be 1173*cdf0e10cSrcweir included, it is implicitly assumed. Typical uses are either 1174*cdf0e10cSrcweir RTL_UNICODETOTEXT_FLAGS_UNDEFINED_ERROR | 1175*cdf0e10cSrcweir RTL_UNICODETOTEXT_FLAGS_INVALID_ERROR (fail if a Unicode character cannot be 1176*cdf0e10cSrcweir converted to the target nEncoding) or OUSTRING_TO_OSTRING_CVTFLAGS (make a 1177*cdf0e10cSrcweir best efforts conversion). 1178*cdf0e10cSrcweir 1179*cdf0e10cSrcweir @return 1180*cdf0e10cSrcweir True if the conversion succeeded, false otherwise. 1181*cdf0e10cSrcweir */ 1182*cdf0e10cSrcweir sal_Bool SAL_CALL rtl_convertUStringToString(rtl_String ** pTarget, 1183*cdf0e10cSrcweir sal_Unicode const * pSource, 1184*cdf0e10cSrcweir sal_Int32 nLength, 1185*cdf0e10cSrcweir rtl_TextEncoding nEncoding, 1186*cdf0e10cSrcweir sal_uInt32 nFlags) 1187*cdf0e10cSrcweir SAL_THROW_EXTERN_C(); 1188*cdf0e10cSrcweir 1189*cdf0e10cSrcweir #ifdef __cplusplus 1190*cdf0e10cSrcweir } 1191*cdf0e10cSrcweir #endif 1192*cdf0e10cSrcweir 1193*cdf0e10cSrcweir #endif /* _RTL_STRING_H_ */ 1194