PageRenderTime 66ms CodeModel.GetById 34ms RepoModel.GetById 0ms app.codeStats 0ms

/sal/inc/rtl/ustring.h

https://bitbucket.org/jorgenio/libreoffice
C Header | 1901 lines | 217 code | 98 blank | 1586 comment | 0 complexity | 07b9d2c4cda4c48be719faf395a9e03c MD5 | raw file
Possible License(s): GPL-3.0, LGPL-3.0, MPL-2.0-no-copyleft-exception, LGPL-2.1, BSD-3-Clause-No-Nuclear-License-2014

Large files files are truncated, but you can click here to view the full file

  1. /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
  2. /*************************************************************************
  3. *
  4. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  5. *
  6. * Copyright 2000, 2010 Oracle and/or its affiliates.
  7. *
  8. * OpenOffice.org - a multi-platform office productivity suite
  9. *
  10. * This file is part of OpenOffice.org.
  11. *
  12. * OpenOffice.org is free software: you can redistribute it and/or modify
  13. * it under the terms of the GNU Lesser General Public License version 3
  14. * only, as published by the Free Software Foundation.
  15. *
  16. * OpenOffice.org is distributed in the hope that it will be useful,
  17. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  18. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  19. * GNU Lesser General Public License version 3 for more details
  20. * (a copy is included in the LICENSE file that accompanied this code).
  21. *
  22. * You should have received a copy of the GNU Lesser General Public License
  23. * version 3 along with OpenOffice.org. If not, see
  24. * <http://www.openoffice.org/license.html>
  25. * for a copy of the LGPLv3 License.
  26. *
  27. ************************************************************************/
  28. #ifndef _RTL_USTRING_H_
  29. #define _RTL_USTRING_H_
  30. #include <sal/types.h>
  31. #include <osl/interlck.h>
  32. #include <rtl/string.h>
  33. #include <rtl/textenc.h>
  34. #ifdef __cplusplus
  35. extern "C" {
  36. #endif
  37. /* ======================================================================= */
  38. /** Return the length of a string.
  39. The length is equal to the number of 16-bit Unicode characters in the
  40. string, without the terminating NUL character.
  41. @param str
  42. a null-terminated string.
  43. @return
  44. the length of the sequence of characters represented by this string,
  45. excluding the terminating NUL character.
  46. */
  47. SAL_DLLPUBLIC sal_Int32 SAL_CALL rtl_ustr_getLength(
  48. const sal_Unicode * str ) SAL_THROW_EXTERN_C();
  49. /** Compare two strings.
  50. The comparison is based on the numeric value of each character in the
  51. strings and returns a value indicating their relationship. This function
  52. cannot be used for language-specific sorting. Both strings must be
  53. null-terminated.
  54. @param first
  55. the first null-terminated string to be compared.
  56. @param second
  57. the second null-terminated string which is compared with the first one.
  58. @return
  59. 0 if both strings are equal, a value less than 0 if the first string is
  60. less than the second string, and a value greater than 0 if the first
  61. string is greater than the second string.
  62. */
  63. SAL_DLLPUBLIC sal_Int32 SAL_CALL rtl_ustr_compare(
  64. const sal_Unicode * first, const sal_Unicode * second ) SAL_THROW_EXTERN_C();
  65. /** Compare two strings.
  66. The comparison is based on the numeric value of each character in the
  67. strings and returns a value indicating their relationship. This function
  68. cannot be used for language-specific sorting.
  69. @param first
  70. the first string to be compared. Need not be null-terminated, but must be
  71. at least as long as the specified firstLen.
  72. @param firstLen
  73. the length of the first string.
  74. @param second
  75. the second string which is compared with the first one. Need not be
  76. null-terminated, but must be at least as long as the specified secondLen.
  77. @param secondLen
  78. the length of the second string.
  79. @return
  80. 0 if both strings are equal, a value less than 0 if the first string is
  81. less than the second string, and a value greater than 0 if the first
  82. string is greater than the second string.
  83. */
  84. SAL_DLLPUBLIC sal_Int32 SAL_CALL rtl_ustr_compare_WithLength(
  85. const sal_Unicode * first, sal_Int32 firstLen, const sal_Unicode * second, sal_Int32 secondLen ) SAL_THROW_EXTERN_C();
  86. /** Compare two strings with a maximum count of characters.
  87. The comparison is based on the numeric value of each character in the
  88. strings and returns a value indicating their relationship. This function
  89. cannot be used for language-specific sorting.
  90. @param first
  91. the first string to be compared. Need not be null-terminated, but must be
  92. at least as long as the specified firstLen.
  93. @param firstLen
  94. the length of the first string.
  95. @param second
  96. the second string which is compared with the first one. Need not be
  97. null-terminated, but must be at least as long as the specified secondLen.
  98. @param secondLen
  99. the length of the second string.
  100. @param shortenedLen
  101. the maximum number of characters to compare. This length can be greater
  102. or smaller than the lengths of the two strings.
  103. @return
  104. 0 if both substrings are equal, a value less than 0 if the first substring
  105. is less than the second substring, and a value greater than 0 if the first
  106. substring is greater than the second substring.
  107. */
  108. SAL_DLLPUBLIC sal_Int32 SAL_CALL rtl_ustr_shortenedCompare_WithLength(
  109. const sal_Unicode * first, sal_Int32 firstLen, const sal_Unicode * second, sal_Int32 secondLen, sal_Int32 shortenedLen ) SAL_THROW_EXTERN_C();
  110. /** Compare two strings from back to front.
  111. The comparison is based on the numeric value of each character in the
  112. strings and returns a value indicating their relationship. This function
  113. cannot be used for language-specific sorting.
  114. @param first
  115. the first string to be compared. Need not be null-terminated, but must be
  116. at least as long as the specified firstLen.
  117. @param firstLen
  118. the length of the first string.
  119. @param second
  120. the second string which is compared with the first one. Need not be
  121. null-terminated, but must be at least as long as the specified secondLen.
  122. @param secondLen
  123. the length of the second string.
  124. @return
  125. 0 if both strings are equal, a value less than 0 if the first string
  126. compares less than the second string, and a value greater than 0 if the
  127. first string compares greater than the second string.
  128. */
  129. SAL_DLLPUBLIC sal_Int32 SAL_CALL rtl_ustr_reverseCompare_WithLength(
  130. const sal_Unicode * first, sal_Int32 firstLen, const sal_Unicode * second, sal_Int32 secondLen ) SAL_THROW_EXTERN_C();
  131. /** Compare two strings from back to front for equality.
  132. The comparison is based on the numeric value of each character in the
  133. strings and returns 'true' if, ans only if, both strings are equal.
  134. This function cannot be used for language-specific sorting.
  135. @param first
  136. the first string to be compared. Need not be null-terminated, but must be
  137. at least as long as the specified len.
  138. @param second
  139. the second string which is compared with the first one. Need not be
  140. null-terminated, but must be at least as long as the specified len.
  141. @param len
  142. the length of both strings.
  143. @return
  144. true if both strings are equal, false if they are not equal.
  145. */
  146. SAL_DLLPUBLIC sal_Bool SAL_CALL rtl_ustr_asciil_reverseEquals_WithLength(
  147. const sal_Unicode * first, const sal_Char * second, sal_Int32 len ) SAL_THROW_EXTERN_C();
  148. /** Compare two strings, ignoring the case of ASCII characters.
  149. The comparison is based on the numeric value of each character in the
  150. strings and returns a value indicating their relationship. Character
  151. values between 65 and 90 (ASCII A--Z) are interpreted as values between 97
  152. and 122 (ASCII a--z). This function cannot be used for language-specific
  153. sorting. Both strings must be null-terminated.
  154. @param first
  155. the first null-terminated string to be compared.
  156. @param second
  157. the second null-terminated string which is compared with the first one.
  158. @return
  159. 0 if both strings are equal, a value less than 0 if the first string is
  160. less than the second string, and a value greater than 0 if the first
  161. string is greater than the second string.
  162. */
  163. SAL_DLLPUBLIC sal_Int32 SAL_CALL rtl_ustr_compareIgnoreAsciiCase(
  164. const sal_Unicode * first, const sal_Unicode * second ) SAL_THROW_EXTERN_C();
  165. /** Compare two strings, ignoring the case of ASCII characters.
  166. The comparison is based on the numeric value of each character in the
  167. strings and returns a value indicating their relationship. Character
  168. values between 65 and 90 (ASCII A--Z) are interpreted as values between 97
  169. and 122 (ASCII a--z). This function cannot be used for language-specific
  170. sorting.
  171. @param first
  172. the first string to be compared. Need not be null-terminated, but must be
  173. at least as long as the specified firstLen.
  174. @param firstLen
  175. the length of the first string.
  176. @param second
  177. the second string which is compared with the first one. Need not be
  178. null-terminated, but must be at least as long as the specified secondLen.
  179. @param secondLen
  180. the length of the second string.
  181. @return
  182. 0 if both strings are equal, a value less than 0 if the first string is
  183. less than the second string, and a value greater than 0 if the first
  184. string is greater than the second string.
  185. */
  186. SAL_DLLPUBLIC sal_Int32 SAL_CALL rtl_ustr_compareIgnoreAsciiCase_WithLength(
  187. const sal_Unicode * first, sal_Int32 firstLen, const sal_Unicode * second, sal_Int32 secondLen ) SAL_THROW_EXTERN_C();
  188. /** Compare two strings with a maximum count of characters, ignoring the case
  189. of ASCII characters.
  190. The comparison is based on the numeric value of each character in the
  191. strings and returns a value indicating their relationship. Character
  192. values between 65 and 90 (ASCII A--Z) are interpreted as values between 97
  193. and 122 (ASCII a--z). This function cannot be used for language-specific
  194. sorting.
  195. @param first
  196. the first string to be compared. Need not be null-terminated, but must be
  197. at least as long as the specified firstLen.
  198. @param firstLen
  199. the length of the first string.
  200. @param second
  201. the second string which is compared with the first one. Need not be
  202. null-terminated, but must be at least as long as the specified secondLen.
  203. @param secondLen
  204. the length of the second string.
  205. @param shortenedLen
  206. the maximum number of characters to compare. This length can be greater
  207. or smaller than the lengths of the two strings.
  208. @return
  209. 0 if both substrings are equal, a value less than 0 if the first substring
  210. is less than the second substring, and a value greater than 0 if the first
  211. substring is greater than the second substring.
  212. */
  213. SAL_DLLPUBLIC sal_Int32 SAL_CALL rtl_ustr_shortenedCompareIgnoreAsciiCase_WithLength(
  214. const sal_Unicode * first, sal_Int32 firstLen, const sal_Unicode * second, sal_Int32 secondLen, sal_Int32 shortenedLen ) SAL_THROW_EXTERN_C();
  215. /** Compare two strings.
  216. The comparison is based on the numeric value of each character in the
  217. strings and returns a value indicating their relationship. This function
  218. cannot be used for language-specific sorting. Both strings must be
  219. null-terminated.
  220. Since this function is optimized for performance, the ASCII character
  221. values are not converted in any way. The caller has to make sure that
  222. all ASCII characters are in the allowed range of 0 and 127, inclusive.
  223. @param first
  224. the first null-terminated string to be compared.
  225. @param second
  226. the second null-terminated ASCII string which is compared with the first
  227. one.
  228. @return
  229. 0 if both substrings are equal, a value less than 0 if the first substring
  230. is less than the second substring, and a value greater than 0 if the first
  231. substring is greater than the second substring.
  232. */
  233. SAL_DLLPUBLIC sal_Int32 SAL_CALL rtl_ustr_ascii_compare(
  234. const sal_Unicode * first, const sal_Char * second ) SAL_THROW_EXTERN_C();
  235. /** Compare two strings.
  236. The comparison is based on the numeric value of each character in the
  237. strings and returns a value indicating their relationship. This function
  238. cannot be used for language-specific sorting.
  239. Since this function is optimized for performance, the ASCII character
  240. values are not converted in any way. The caller has to make sure that
  241. all ASCII characters are in the allowed range of 0 and 127, inclusive.
  242. @param first
  243. the first string to be compared. Need not be null-terminated, but must be
  244. at least as long as the specified firstLen.
  245. @param firstLen
  246. the length of the first string.
  247. @param second
  248. the second null-terminated ASCII string which is compared with the first
  249. one.
  250. @return
  251. 0 if both substrings are equal, a value less than 0 if the first substring
  252. is less than the second substring, and a value greater than 0 if the first
  253. substring is greater than the second substring.
  254. */
  255. SAL_DLLPUBLIC sal_Int32 SAL_CALL rtl_ustr_ascii_compare_WithLength(
  256. const sal_Unicode * first, sal_Int32 firstLen, const sal_Char * second ) SAL_THROW_EXTERN_C();
  257. /** Compare two strings with a maximum count of characters.
  258. The comparison is based on the numeric value of each character in the
  259. strings and returns a value indicating their relationship. This function
  260. cannot be used for language-specific sorting.
  261. Since this function is optimized for performance, the ASCII character
  262. values are not converted in any way. The caller has to make sure that
  263. all ASCII characters are in the allowed range of 0 and 127, inclusive.
  264. @param first
  265. the first string to be compared. Need not be null-terminated, but must be
  266. at least as long as the specified firstLen.
  267. @param firstLen
  268. the length of the first string.
  269. @param second
  270. the second null-terminated ASCII string which is compared with the first
  271. one.
  272. @param shortenedLen
  273. the maximum number of characters to compare. This length can be greater
  274. or smaller than the lengths of the two strings.
  275. @return
  276. 0 if both substrings are equal, a value less than 0 if the first substring
  277. is less than the second substring, and a value greater than 0 if the first
  278. substring is greater than the second substring.
  279. */
  280. SAL_DLLPUBLIC sal_Int32 SAL_CALL rtl_ustr_ascii_shortenedCompare_WithLength(
  281. const sal_Unicode * first, sal_Int32 firstLen, const sal_Char * second, sal_Int32 shortenedLen ) SAL_THROW_EXTERN_C();
  282. /** Compare two strings from back to front.
  283. The comparison is based on the numeric value of each character in the
  284. strings and returns a value indicating their relationship. This function
  285. cannot be used for language-specific sorting.
  286. Since this function is optimized for performance, the ASCII character
  287. values are not converted in any way. The caller has to make sure that
  288. all ASCII characters are in the allowed range of 0 and 127, inclusive.
  289. @param first
  290. the first string to be compared. Need not be null-terminated, but must be
  291. at least as long as the specified firstLen.
  292. @param firstLen
  293. the length of the first string.
  294. @param second
  295. the second ASCII string which is compared with the first one. Need not be
  296. null-terminated, but must be at least as long as the specified secondLen.
  297. @param secondLen
  298. the length of the second string.
  299. @return
  300. 0 if both strings are equal, a value less than 0 if the first string
  301. compares less than the second string, and a value greater than 0 if the
  302. first string compares greater than the second string.
  303. */
  304. SAL_DLLPUBLIC sal_Int32 SAL_CALL rtl_ustr_asciil_reverseCompare_WithLength(
  305. const sal_Unicode * first, sal_Int32 firstLen, const sal_Char * second, sal_Int32 secondLen ) SAL_THROW_EXTERN_C();
  306. /** Compare two strings, ignoring the case of ASCII characters.
  307. The comparison is based on the numeric value of each character in the
  308. strings and returns a value indicating their relationship. Character
  309. values between 65 and 90 (ASCII A--Z) are interpreted as values between 97
  310. and 122 (ASCII a--z). This function cannot be used for language-specific
  311. sorting. Both strings must be null-terminated.
  312. Since this function is optimized for performance, the ASCII character
  313. values are not converted in any way. The caller has to make sure that
  314. all ASCII characters are in the allowed range of 0 and 127, inclusive.
  315. @param first
  316. the first null-terminated string to be compared.
  317. @param second
  318. the second null-terminated ASCII string which is compared with the first
  319. one.
  320. @return
  321. 0 if both strings are equal, a value less than 0 if the first string is
  322. less than the second string, and a value greater than 0 if the first
  323. string is greater than the second string.
  324. */
  325. SAL_DLLPUBLIC sal_Int32 SAL_CALL rtl_ustr_ascii_compareIgnoreAsciiCase(
  326. const sal_Unicode * first, const sal_Char * second ) SAL_THROW_EXTERN_C();
  327. /** Compare two strings, ignoring the case of ASCII characters.
  328. The comparison is based on the numeric value of each character in the
  329. strings and returns a value indicating their relationship. Character
  330. values between 65 and 90 (ASCII A--Z) are interpreted as values between 97
  331. and 122 (ASCII a--z). This function cannot be used for language-specific
  332. sorting.
  333. Since this function is optimized for performance, the ASCII character
  334. values are not converted in any way. The caller has to make sure that
  335. all ASCII characters are in the allowed range of 0 and 127, inclusive.
  336. @param first
  337. the first string to be compared. Need not be null-terminated, but must be
  338. at least as long as the specified firstLen.
  339. @param firstLen
  340. the length of the first string.
  341. @param second
  342. the second null-terminated ASCII string which is compared with the first
  343. one.
  344. @return
  345. 0 if both strings are equal, a value less than 0 if the first string is
  346. less than the second string, and a value greater than 0 if the first
  347. string is greater than the second string.
  348. */
  349. SAL_DLLPUBLIC sal_Int32 SAL_CALL rtl_ustr_ascii_compareIgnoreAsciiCase_WithLength(
  350. const sal_Unicode * first, sal_Int32 firstLen, const sal_Char * second ) SAL_THROW_EXTERN_C();
  351. /** Compare two strings, ignoring the case of ASCII characters.
  352. The comparison is based on the numeric value of each character in the
  353. strings and returns a value indicating their relationship. Character
  354. values between 65 and 90 (ASCII A--Z) are interpreted as values between 97
  355. and 122 (ASCII a--z). This function cannot be used for language-specific
  356. sorting.
  357. Since this function is optimized for performance, the ASCII character
  358. values are not converted in any way. The caller has to make sure that
  359. all ASCII characters are in the allowed range of 0 and 127, inclusive.
  360. @param first
  361. the first string to be compared. Need not be null-terminated, but must be
  362. at least as long as the specified firstLen.
  363. @param firstLen
  364. the length of the first string.
  365. @param second
  366. the second string which is compared with the first one. Need not be
  367. null-terminated, but must be at least as long as the specified secondLen.
  368. @param secondLen
  369. the length of the second string.
  370. @return
  371. 0 if both strings are equal, a value less than 0 if the first string is
  372. less than the second string, and a value greater than 0 if the first
  373. string is greater than the second string.
  374. */
  375. SAL_DLLPUBLIC sal_Int32 SAL_CALL rtl_ustr_ascii_compareIgnoreAsciiCase_WithLengths(
  376. sal_Unicode const * first, sal_Int32 firstLen,
  377. char const * second, sal_Int32 secondLen) SAL_THROW_EXTERN_C();
  378. /** Compare two strings with a maximum count of characters, ignoring the case
  379. of ASCII characters.
  380. The comparison is based on the numeric value of each character in the
  381. strings and returns a value indicating their relationship. Character
  382. values between 65 and 90 (ASCII A--Z) are interpreted as values between 97
  383. and 122 (ASCII a--z). This function cannot be used for language-specific
  384. sorting.
  385. Since this function is optimized for performance, the ASCII character
  386. values are not converted in any way. The caller has to make sure that
  387. all ASCII characters are in the allowed range of 0 and 127, inclusive.
  388. @param first
  389. the first string to be compared. Need not be null-terminated, but must be
  390. at least as long as the specified firstLen.
  391. @param firstLen
  392. the length of the first string.
  393. @param second
  394. the second null-terminated ASCII string which is compared with the first
  395. one.
  396. @param shortenedLen
  397. the maximum number of characters to compare. This length can be greater
  398. or smaller than the lengths of the two strings.
  399. @return
  400. 0 if both substrings are equal, a value less than 0 if the first substring
  401. is less than the second substring, and a value greater than 0 if the first
  402. substring is greater than the second substring.
  403. */
  404. SAL_DLLPUBLIC sal_Int32 SAL_CALL rtl_ustr_ascii_shortenedCompareIgnoreAsciiCase_WithLength(
  405. const sal_Unicode * first, sal_Int32 firstLen, const sal_Char * second, sal_Int32 shortenedLen ) SAL_THROW_EXTERN_C();
  406. /** Return a hash code for a string.
  407. It is not allowed to store the hash code persistently, because later
  408. versions could return other hash codes. The string must be
  409. null-terminated.
  410. @param str
  411. a null-terminated string.
  412. @return
  413. a hash code for the given string.
  414. */
  415. SAL_DLLPUBLIC sal_Int32 SAL_CALL rtl_ustr_hashCode(
  416. const sal_Unicode * str ) SAL_THROW_EXTERN_C();
  417. /** Return a hash code for a string.
  418. It is not allowed to store the hash code persistently, because later
  419. versions could return other hash codes.
  420. @param str
  421. a string. Need not be null-terminated, but must be at least as long as
  422. the specified len.
  423. @param len
  424. the length of the string.
  425. @return
  426. a hash code for the given string.
  427. */
  428. SAL_DLLPUBLIC sal_Int32 SAL_CALL rtl_ustr_hashCode_WithLength(
  429. const sal_Unicode * str, sal_Int32 len ) SAL_THROW_EXTERN_C();
  430. /** Search for the first occurrence of a character within a string.
  431. The string must be null-terminated.
  432. @param str
  433. a null-terminated string.
  434. @param ch
  435. the character to be searched for.
  436. @return
  437. the index (starting at 0) of the first occurrence of the character in the
  438. string, or -1 if the character does not occur.
  439. */
  440. SAL_DLLPUBLIC sal_Int32 SAL_CALL rtl_ustr_indexOfChar(
  441. const sal_Unicode * str, sal_Unicode ch ) SAL_THROW_EXTERN_C();
  442. /** Search for the first occurrence of a character within a string.
  443. @param str
  444. a string. Need not be null-terminated, but must be at least as long as
  445. the specified len.
  446. @param len
  447. the length of the string.
  448. @param ch
  449. the character to be searched for.
  450. @return
  451. the index (starting at 0) of the first occurrence of the character in the
  452. string, or -1 if the character does not occur.
  453. */
  454. SAL_DLLPUBLIC sal_Int32 SAL_CALL rtl_ustr_indexOfChar_WithLength(
  455. const sal_Unicode * str, sal_Int32 len, sal_Unicode ch ) SAL_THROW_EXTERN_C();
  456. /** Search for the last occurrence of a character within a string.
  457. The string must be null-terminated.
  458. @param str
  459. a null-terminated string.
  460. @param ch
  461. the character to be searched for.
  462. @return
  463. the index (starting at 0) of the last occurrence of the character in the
  464. string, or -1 if the character does not occur. The returned value is
  465. always smaller than the string length.
  466. */
  467. SAL_DLLPUBLIC sal_Int32 SAL_CALL rtl_ustr_lastIndexOfChar(
  468. const sal_Unicode * str, sal_Unicode ch ) SAL_THROW_EXTERN_C();
  469. /** Search for the last occurrence of a character within a string.
  470. @param str
  471. a string. Need not be null-terminated, but must be at least as long as
  472. the specified len.
  473. @param len
  474. the length of the string.
  475. @param ch
  476. the character to be searched for.
  477. @return
  478. the index (starting at 0) of the last occurrence of the character in the
  479. string, or -1 if the character does not occur. The returned value is
  480. always smaller than the string length.
  481. */
  482. SAL_DLLPUBLIC sal_Int32 SAL_CALL rtl_ustr_lastIndexOfChar_WithLength(
  483. const sal_Unicode * str, sal_Int32 len, sal_Unicode ch ) SAL_THROW_EXTERN_C();
  484. /** Search for the first occurrence of a substring within a string.
  485. If subStr is empty, or both str and subStr are empty, -1 is returned.
  486. Both strings must be null-terminated.
  487. @param str
  488. a null-terminated string.
  489. @param subStr
  490. the null-terminated substring to be searched for.
  491. @return
  492. the index (starting at 0) of the first character of the first occurrence
  493. of the substring within the string, or -1 if the substring does not occur.
  494. */
  495. SAL_DLLPUBLIC sal_Int32 SAL_CALL rtl_ustr_indexOfStr(
  496. const sal_Unicode * str, const sal_Unicode * subStr ) SAL_THROW_EXTERN_C();
  497. /** Search for the first occurrence of a substring within a string.
  498. If subStr is empty, or both str and subStr are empty, -1 is returned.
  499. @param str
  500. a string. Need not be null-terminated, but must be at least as long as
  501. the specified len.
  502. @param len
  503. the length of the string.
  504. @param subStr
  505. the substring to be searched for. Need not be null-terminated, but must
  506. be at least as long as the specified subLen.
  507. @param subLen
  508. the length of the substring.
  509. @return
  510. the index (starting at 0) of the first character of the first occurrence
  511. of the substring within the string, or -1 if the substring does not occur.
  512. */
  513. SAL_DLLPUBLIC sal_Int32 SAL_CALL rtl_ustr_indexOfStr_WithLength(
  514. const sal_Unicode * str, sal_Int32 len, const sal_Unicode * subStr, sal_Int32 subLen ) SAL_THROW_EXTERN_C();
  515. /** Search for the first occurrence of an ASCII substring within a string.
  516. @param str
  517. a string. Need not be null-terminated, but must be at least as long as
  518. the specified len.
  519. @param len
  520. the length of the string; must be non-negative.
  521. @param subStr
  522. the substring to be searched for. Need not be null-terminated, but must
  523. be at least as long as the specified subLen. Must only contain characters
  524. in the ASCII range 0x00--7F.
  525. @param subLen
  526. the length of the substring; must be non-negative.
  527. @return
  528. the index (starting at 0) of the first character of the first occurrence
  529. of the substring within the string, or -1 if the substring does not occur.
  530. If subLen is zero, -1 is returned.
  531. @since UDK 3.2.7
  532. */
  533. SAL_DLLPUBLIC sal_Int32 SAL_CALL rtl_ustr_indexOfAscii_WithLength(
  534. sal_Unicode const * str, sal_Int32 len,
  535. char const * subStr, sal_Int32 subLen) SAL_THROW_EXTERN_C();
  536. /** Search for the last occurrence of a substring within a string.
  537. If subStr is empty, or both str and subStr are empty, -1 is returned.
  538. Both strings must be null-terminated.
  539. @param str
  540. a null-terminated string.
  541. @param subStr
  542. the null-terminated substring to be searched for.
  543. @return
  544. the index (starting at 0) of the first character of the last occurrence
  545. of the substring within the string, or -1 if the substring does not occur.
  546. */
  547. SAL_DLLPUBLIC sal_Int32 SAL_CALL rtl_ustr_lastIndexOfStr(
  548. const sal_Unicode * str, const sal_Unicode * subStr ) SAL_THROW_EXTERN_C();
  549. /** Search for the last occurrence of a substring within a string.
  550. If subStr is empty, or both str and subStr are empty, -1 is returned.
  551. @param str
  552. a string. Need not be null-terminated, but must be at least as long as
  553. the specified len.
  554. @param len
  555. the length of the string.
  556. @param subStr
  557. the substring to be searched for. Need not be null-terminated, but must
  558. be at least as long as the specified subLen.
  559. @param subLen
  560. the length of the substring.
  561. @return
  562. the index (starting at 0) of the first character of the first occurrence
  563. of the substring within the string, or -1 if the substring does not occur.
  564. */
  565. SAL_DLLPUBLIC sal_Int32 SAL_CALL rtl_ustr_lastIndexOfStr_WithLength(
  566. const sal_Unicode * str, sal_Int32 len, const sal_Unicode * subStr, sal_Int32 subLen ) SAL_THROW_EXTERN_C();
  567. /** Search for the last occurrence of an ASCII substring within a string.
  568. @param str
  569. a string. Need not be null-terminated, but must be at least as long as
  570. the specified len.
  571. @param len
  572. the length of the string; must be non-negative.
  573. @param subStr
  574. the substring to be searched for. Need not be null-terminated, but must
  575. be at least as long as the specified subLen. Must only contain characters
  576. in the ASCII range 0x00--7F.
  577. @param subLen
  578. the length of the substring; must be non-negative.
  579. @return
  580. the index (starting at 0) of the first character of the last occurrence
  581. of the substring within the string, or -1 if the substring does not occur.
  582. If subLen is zero, -1 is returned.
  583. @since UDK 3.2.7
  584. */
  585. SAL_DLLPUBLIC sal_Int32 SAL_CALL rtl_ustr_lastIndexOfAscii_WithLength(
  586. sal_Unicode const * str, sal_Int32 len,
  587. char const * subStr, sal_Int32 subLen) SAL_THROW_EXTERN_C();
  588. /** Replace all occurrences of a single character within a string.
  589. If oldChar does not occur within str, then the string is not modified.
  590. The string must be null-terminated.
  591. @param str
  592. a null-terminated string.
  593. @param oldChar
  594. the old character.
  595. @param newChar
  596. the new character.
  597. */
  598. SAL_DLLPUBLIC void SAL_CALL rtl_ustr_replaceChar(
  599. sal_Unicode * str, sal_Unicode oldChar, sal_Unicode newChar ) SAL_THROW_EXTERN_C();
  600. /** Replace all occurrences of a single character within a string.
  601. If oldChar does not occur within str, then the string is not modified.
  602. @param str
  603. a string. Need not be null-terminated, but must be at least as long as
  604. the specified len.
  605. @param len
  606. the length of the string.
  607. @param oldChar
  608. the old character.
  609. @param newChar
  610. the new character.
  611. */
  612. SAL_DLLPUBLIC void SAL_CALL rtl_ustr_replaceChar_WithLength(
  613. sal_Unicode * str, sal_Int32 len, sal_Unicode oldChar, sal_Unicode newChar ) SAL_THROW_EXTERN_C();
  614. /** Convert all ASCII uppercase letters to lowercase within a string.
  615. The characters with values between 65 and 90 (ASCII A--Z) are replaced
  616. with values between 97 and 122 (ASCII a--z). The string must be
  617. null-terminated.
  618. @param str
  619. a null-terminated string.
  620. */
  621. SAL_DLLPUBLIC void SAL_CALL rtl_ustr_toAsciiLowerCase(
  622. sal_Unicode * str ) SAL_THROW_EXTERN_C();
  623. /** Convert all ASCII uppercase letters to lowercase within a string.
  624. The characters with values between 65 and 90 (ASCII A--Z) are replaced
  625. with values between 97 and 122 (ASCII a--z).
  626. @param str
  627. a string. Need not be null-terminated, but must be at least as long as
  628. the specified len.
  629. @param len
  630. the length of the string.
  631. */
  632. SAL_DLLPUBLIC void SAL_CALL rtl_ustr_toAsciiLowerCase_WithLength(
  633. sal_Unicode * str, sal_Int32 len ) SAL_THROW_EXTERN_C();
  634. /** Convert all ASCII lowercase letters to uppercase within a string.
  635. The characters with values between 97 and 122 (ASCII a--z) are replaced
  636. with values between 65 and 90 (ASCII A--Z). The string must be
  637. null-terminated.
  638. @param str
  639. a null-terminated string.
  640. */
  641. SAL_DLLPUBLIC void SAL_CALL rtl_ustr_toAsciiUpperCase(
  642. sal_Unicode * str ) SAL_THROW_EXTERN_C();
  643. /** Convert all ASCII lowercase letters to uppercase within a string.
  644. The characters with values between 97 and 122 (ASCII a--z) are replaced
  645. with values between 65 and 90 (ASCII A--Z).
  646. @param str
  647. a string. Need not be null-terminated, but must be at least as long as
  648. the specified len.
  649. @param len
  650. the length of the string.
  651. */
  652. SAL_DLLPUBLIC void SAL_CALL rtl_ustr_toAsciiUpperCase_WithLength(
  653. sal_Unicode * str, sal_Int32 len ) SAL_THROW_EXTERN_C();
  654. /** Remove white space from both ends of a string.
  655. All characters with values less than or equal to 32 (the space character)
  656. are considered to be white space. This function cannot be used for
  657. language-specific operations. The string must be null-terminated.
  658. @param str
  659. a null-terminated string.
  660. @return
  661. the new length of the string.
  662. */
  663. SAL_DLLPUBLIC sal_Int32 SAL_CALL rtl_ustr_trim(
  664. sal_Unicode * str ) SAL_THROW_EXTERN_C();
  665. /** Remove white space from both ends of the string.
  666. All characters with values less than or equal to 32 (the space character)
  667. are considered to be white space. This function cannot be used for
  668. language-specific operations. The string must be null-terminated.
  669. @param str
  670. a string. Need not be null-terminated, but must be at least as long as
  671. the specified len.
  672. @param len
  673. the original length of the string.
  674. @return
  675. the new length of the string.
  676. */
  677. SAL_DLLPUBLIC sal_Int32 SAL_CALL rtl_ustr_trim_WithLength(
  678. sal_Unicode * str, sal_Int32 len ) SAL_THROW_EXTERN_C();
  679. /** Create the string representation of a boolean.
  680. If b is true, the buffer is filled with the string "true" and 5 is
  681. returned. If b is false, the buffer is filled with the string "false" and
  682. 6 is returned. This function cannot be used for language-specific
  683. operations.
  684. @param str
  685. a buffer that is big enough to hold the result and the terminating NUL
  686. character. You should use the RTL_USTR_MAX_VALUEOFBOOLEAN define to
  687. create a buffer that is big enough.
  688. @param b
  689. a boolean value.
  690. @return
  691. the length of the string.
  692. */
  693. SAL_DLLPUBLIC sal_Int32 SAL_CALL rtl_ustr_valueOfBoolean(
  694. sal_Unicode * str, sal_Bool b ) SAL_THROW_EXTERN_C();
  695. #define RTL_USTR_MAX_VALUEOFBOOLEAN RTL_STR_MAX_VALUEOFBOOLEAN
  696. /** Create the string representation of a character.
  697. @param str
  698. a buffer that is big enough to hold the result and the terminating NUL
  699. character. You should use the RTL_USTR_MAX_VALUEOFCHAR define to create a
  700. buffer that is big enough.
  701. @param ch
  702. a character value.
  703. @return
  704. the length of the string.
  705. */
  706. SAL_DLLPUBLIC sal_Int32 SAL_CALL rtl_ustr_valueOfChar(
  707. sal_Unicode * str, sal_Unicode ch ) SAL_THROW_EXTERN_C();
  708. #define RTL_USTR_MAX_VALUEOFCHAR RTL_STR_MAX_VALUEOFCHAR
  709. /** Create the string representation of an integer.
  710. This function cannot be used for language-specific operations.
  711. @param str
  712. a buffer that is big enough to hold the result and the terminating NUL
  713. character. You should use the RTL_USTR_MAX_VALUEOFINT32 define to create
  714. a buffer that is big enough.
  715. @param i
  716. an integer value.
  717. @param radix
  718. the radix. Must be between RTL_USTR_MIN_RADIX (2) and RTL_USTR_MAX_RADIX
  719. (36), inclusive.
  720. @return
  721. the length of the string.
  722. */
  723. SAL_DLLPUBLIC sal_Int32 SAL_CALL rtl_ustr_valueOfInt32(
  724. sal_Unicode * str, sal_Int32 i, sal_Int16 radix ) SAL_THROW_EXTERN_C();
  725. #define RTL_USTR_MIN_RADIX RTL_STR_MIN_RADIX
  726. #define RTL_USTR_MAX_RADIX RTL_STR_MAX_RADIX
  727. #define RTL_USTR_MAX_VALUEOFINT32 RTL_STR_MAX_VALUEOFINT32
  728. /** Create the string representation of a long integer.
  729. This function cannot be used for language-specific operations.
  730. @param str
  731. a buffer that is big enough to hold the result and the terminating NUL
  732. character. You should use the RTL_USTR_MAX_VALUEOFINT64 define to create
  733. a buffer that is big enough.
  734. @param l
  735. a long integer value.
  736. @param radix
  737. the radix. Must be between RTL_USTR_MIN_RADIX (2) and RTL_USTR_MAX_RADIX
  738. (36), inclusive.
  739. @return
  740. the length of the string.
  741. */
  742. SAL_DLLPUBLIC sal_Int32 SAL_CALL rtl_ustr_valueOfInt64(
  743. sal_Unicode * str, sal_Int64 l, sal_Int16 radix ) SAL_THROW_EXTERN_C();
  744. #define RTL_USTR_MAX_VALUEOFINT64 RTL_STR_MAX_VALUEOFINT64
  745. /** Create the string representation of a float.
  746. This function cannot be used for language-specific conversion.
  747. @param str
  748. a buffer that is big enough to hold the result and the terminating NUL
  749. character. You should use the RTL_USTR_MAX_VALUEOFFLOAT define to create
  750. a buffer that is big enough.
  751. @param f
  752. a float value.
  753. @return
  754. the length of the string.
  755. */
  756. SAL_DLLPUBLIC sal_Int32 SAL_CALL rtl_ustr_valueOfFloat(
  757. sal_Unicode * str, float f ) SAL_THROW_EXTERN_C();
  758. #define RTL_USTR_MAX_VALUEOFFLOAT RTL_STR_MAX_VALUEOFFLOAT
  759. /** Create the string representation of a double.
  760. This function cannot be used for language-specific conversion.
  761. @param str
  762. a buffer that is big enough to hold the result and the terminating NUL
  763. character. You should use the RTL_USTR_MAX_VALUEOFDOUBLE define to create
  764. a buffer that is big enough.
  765. @param d
  766. a double value.
  767. @return
  768. the length of the string.
  769. */
  770. SAL_DLLPUBLIC sal_Int32 SAL_CALL rtl_ustr_valueOfDouble(
  771. sal_Unicode * str, double d ) SAL_THROW_EXTERN_C();
  772. #define RTL_USTR_MAX_VALUEOFDOUBLE RTL_STR_MAX_VALUEOFDOUBLE
  773. /** Interpret a string as a boolean.
  774. This function cannot be used for language-specific conversion. The string
  775. must be null-terminated.
  776. @param str
  777. a null-terminated string.
  778. @return
  779. true if the string is "1" or "true" in any ASCII case, false otherwise.
  780. */
  781. SAL_DLLPUBLIC sal_Bool SAL_CALL rtl_ustr_toBoolean(
  782. const sal_Unicode * str ) SAL_THROW_EXTERN_C();
  783. /** Interpret a string as an integer.
  784. This function cannot be used for language-specific conversion. The string
  785. must be null-terminated.
  786. @param str
  787. a null-terminated string.
  788. @param radix
  789. the radix. Must be between RTL_USTR_MIN_RADIX (2) and RTL_USTR_MAX_RADIX
  790. (36), inclusive.
  791. @return
  792. the integer value represented by the string, or 0 if the string does not
  793. represent an integer.
  794. */
  795. SAL_DLLPUBLIC sal_Int32 SAL_CALL rtl_ustr_toInt32(
  796. const sal_Unicode * str, sal_Int16 radix ) SAL_THROW_EXTERN_C();
  797. /** Interpret a string as a long integer.
  798. This function cannot be used for language-specific conversion. The string
  799. must be null-terminated.
  800. @param str
  801. a null-terminated string.
  802. @param radix
  803. the radix. Must be between RTL_USTR_MIN_RADIX (2) and RTL_USTR_MAX_RADIX
  804. (36), inclusive.
  805. @return
  806. the long integer value represented by the string, or 0 if the string does
  807. not represent a long integer.
  808. */
  809. SAL_DLLPUBLIC sal_Int64 SAL_CALL rtl_ustr_toInt64(
  810. const sal_Unicode * str, sal_Int16 radix ) SAL_THROW_EXTERN_C();
  811. /** Interpret a string as a float.
  812. This function cannot be used for language-specific conversion. The string
  813. must be null-terminated.
  814. @param str
  815. a null-terminated string.
  816. @return
  817. the float value represented by the string, or 0.0 if the string does not
  818. represent a float.
  819. */
  820. SAL_DLLPUBLIC float SAL_CALL rtl_ustr_toFloat(
  821. const sal_Unicode * str ) SAL_THROW_EXTERN_C();
  822. /** Interpret a string as a double.
  823. This function cannot be used for language-specific conversion. The string
  824. must be null-terminated.
  825. @param str
  826. a null-terminated string.
  827. @return
  828. the float value represented by the string, or 0.0 if the string does not
  829. represent a double.
  830. */
  831. SAL_DLLPUBLIC double SAL_CALL rtl_ustr_toDouble(
  832. const sal_Unicode * str ) SAL_THROW_EXTERN_C();
  833. /* ======================================================================= */
  834. #if defined(SAL_W32)
  835. #pragma pack(push, 4)
  836. #endif
  837. /** @cond INTERNAL */
  838. /** The implementation of a Unicode string.
  839. */
  840. typedef struct _rtl_uString
  841. {
  842. oslInterlockedCount refCount; /* opaque */
  843. sal_Int32 length;
  844. sal_Unicode buffer[1];
  845. } rtl_uString;
  846. /** @endcond */
  847. #if defined(SAL_W32)
  848. #pragma pack(pop)
  849. #endif
  850. /* ----------------------------------------------------------------------- */
  851. /** Increment the reference count of a string.
  852. @param str
  853. a string.
  854. */
  855. SAL_DLLPUBLIC void SAL_CALL rtl_uString_acquire(
  856. rtl_uString * str ) SAL_THROW_EXTERN_C();
  857. /** Decrement the reference count of a string.
  858. If the count goes to zero than the string data is deleted.
  859. @param str
  860. a string.
  861. */
  862. SAL_DLLPUBLIC void SAL_CALL rtl_uString_release(
  863. rtl_uString * str ) SAL_THROW_EXTERN_C();
  864. /** Allocate a new string containing no characters.
  865. @param newStr
  866. pointer to the new string. The pointed-to data must be null or a valid
  867. string.
  868. */
  869. SAL_DLLPUBLIC void SAL_CALL rtl_uString_new(
  870. rtl_uString ** newStr ) SAL_THROW_EXTERN_C();
  871. /** Allocate a new string containing space for a given number of characters.
  872. If len is greater than zero, the reference count of the new string will be
  873. 1. The values of all characters are set to 0 and the length of the string
  874. is 0. This function does not handle out-of-memory conditions.
  875. @param newStr
  876. pointer to the new string. The pointed-to data must be null or a valid
  877. string.
  878. @param nLen
  879. the number of characters.
  880. */
  881. SAL_DLLPUBLIC void SAL_CALL rtl_uString_new_WithLength(
  882. rtl_uString ** newStr, sal_Int32 nLen ) SAL_THROW_EXTERN_C();
  883. /** Allocate a new string that contains a copy of another string.
  884. If the length of value is greater than zero, the reference count of the
  885. new string will be 1. This function does not handle out-of-memory
  886. conditions.
  887. @param newStr
  888. pointer to the new string. The pointed-to data must be null or a valid
  889. string.
  890. @param value
  891. a valid string.
  892. */
  893. SAL_DLLPUBLIC void SAL_CALL rtl_uString_newFromString(
  894. rtl_uString ** newStr, const rtl_uString * value ) SAL_THROW_EXTERN_C();
  895. /** Allocate a new string that contains a copy of a character array.
  896. If the length of value is greater than zero, the reference count of the
  897. new string will be 1. This function does not handle out-of-memory
  898. conditions.
  899. @param newStr
  900. pointer to the new string. The pointed-to data must be null or a valid
  901. string.
  902. @param value
  903. a null-terminated character array.
  904. */
  905. SAL_DLLPUBLIC void SAL_CALL rtl_uString_newFromStr(
  906. rtl_uString ** newStr, const sal_Unicode * value ) SAL_THROW_EXTERN_C();
  907. /** Allocate a new string that contains a copy of a character array.
  908. If the length of value is greater than zero, the reference count of the
  909. new string will be 1. This function does not handle out-of-memory
  910. conditions.
  911. @param newStr
  912. pointer to the new string. The pointed-to data must be null or a valid
  913. string.
  914. @param value
  915. a character array. Need not be null-terminated, but must be at least as
  916. long as the specified len.
  917. @param len
  918. the length of the character array.
  919. */
  920. SAL_DLLPUBLIC void SAL_CALL rtl_uString_newFromStr_WithLength(
  921. rtl_uString ** newStr, const sal_Unicode * value, sal_Int32 len ) SAL_THROW_EXTERN_C();
  922. /** Allocate a new string that contains a copy of a character array.
  923. If the length of value is greater than zero, the reference count of the
  924. new string will be 1. This function does not handle out-of-memory
  925. conditions.
  926. Since this function is optimized for performance, the ASCII character
  927. values are not converted in any way. The caller has to make sure that
  928. all ASCII characters are in the allowed range of 0 and 127, inclusive.
  929. @param newStr
  930. pointer to the new string. The pointed-to data must be null or a valid
  931. string.
  932. @param value
  933. a null-terminated ASCII character array.
  934. */
  935. SAL_DLLPUBLIC void SAL_CALL rtl_uString_newFromAscii(
  936. rtl_uString ** newStr, const sal_Char * value ) SAL_THROW_EXTERN_C();
  937. /**
  938. @internal
  939. @since LibreOffice 3.6
  940. */
  941. SAL_DLLPUBLIC void SAL_CALL rtl_uString_newFromLiteral(
  942. rtl_uString ** newStr, const sal_Char * value, sal_Int32 len,
  943. sal_Int32 allocExtra ) SAL_THROW_EXTERN_C();
  944. /** Allocate a new string from an array of Unicode code points.
  945. @param newString
  946. a non-null pointer to a (possibly null) rtl_uString pointer, which (if
  947. non-null) will have been passed to rtl_uString_release before the function
  948. returns. Upon return, points to the newly allocated string or to null if
  949. there was either an out-of-memory condition or the resulting number of
  950. UTF-16 code units would have been larger than SAL_MAX_INT32. The newly
  951. allocated string (if any) must ultimately be passed to rtl_uString_release.
  952. @param codePoints
  953. an array of at least codePointCount code points, which each must be in the
  954. range from 0 to 0x10FFFF, inclusive. May be null if codePointCount is zero.
  955. @param codePointCount
  956. the non-negative number of code points.
  957. @since UDK 3.2.7
  958. */
  959. SAL_DLLPUBLIC void SAL_CALL rtl_uString_newFromCodePoints(
  960. rtl_uString ** newString, sal_uInt32 const * codePoints,
  961. sal_Int32 codePointCount) SAL_THROW_EXTERN_C();
  962. /** Assign a new value to a string.
  963. First releases any value str might currently hold, then acquires
  964. rightValue.
  965. @param str
  966. pointer to the string. The pointed-to data must be null or a valid
  967. string.
  968. @param rightValue
  969. a valid string.
  970. */
  971. SAL_DLLPUBLIC void SAL_CALL rtl_uString_assign(
  972. rtl_uString ** str, rtl_uString * rightValue ) SAL_THROW_EXTERN_C();
  973. /** Return the length of a string.
  974. The length is equal to the number of characters in the string.
  975. @param str
  976. a valid string.
  977. @return
  978. the length of the string.
  979. */
  980. SAL_DLLPUBLIC sal_Int32 SAL_CALL rtl_uString_getLength(
  981. const rtl_uString * str ) SAL_THROW_EXTERN_C();
  982. /** Return a pointer to the underlying character array of a string.
  983. @param str
  984. a valid string.
  985. @return
  986. a pointer to the null-terminated character array.
  987. */
  988. SAL_DLLPUBLIC sal_Unicode * SAL_CALL rtl_uString_getStr(
  989. rtl_uString * str ) SAL_THROW_EXTERN_C();
  990. /** Create a new string that is the concatenation of two other strings.
  991. The new string does not necessarily have a reference count of 1 (in cases
  992. where one of the two other strings is empty), so it must not be modified
  993. without checking the reference count. This function does not handle
  994. out-of-memory conditions.
  995. @param newStr
  996. pointer to the new string. The pointed-to data must be null or a valid
  997. string.
  998. @param left
  999. a valid string.
  1000. @param right
  1001. a valid string.
  1002. */
  1003. SAL_DLLPUBLIC void SAL_CALL rtl_uString_newConcat(
  1004. rtl_uString ** newStr, rtl_uString * left, rtl_uString * right ) SAL_THROW_EXTERN_C();
  1005. /** Create a new string by replacing a substring of another string.
  1006. The new string results from replacing a number of characters (count),
  1007. starting at the specified position (index) in the original string (str),
  1008. with some new substring (subStr). If subStr is null, than only a number
  1009. of characters is deleted.
  1010. The new string does not necessarily have a reference count of 1, so it
  1011. must not be modified without checking the reference count. This function
  1012. does not handle out-of-memory conditions.
  1013. @param newStr
  1014. pointer to the new string. The pointed-to data must be null or a valid
  1015. string.
  1016. @param str
  1017. a valid string.
  1018. @param idx
  1019. the index into str at which to start replacement. Must be between 0 and
  1020. the length of str, inclusive.
  1021. @param count
  1022. the number of charcters to remove. Must not be negative, and the sum of
  1023. index and count must not exceed the length of str.
  1024. @param subStr
  1025. either null or a valid string to be inserted.
  1026. */
  1027. SAL_DLLPUBLIC void SAL_CALL rtl_uString_newReplaceStrAt(
  1028. rtl_uString ** newStr, rtl_uString * str, sal_Int32 idx, sal_Int32 count, rtl_uString * subStr ) SAL_THROW_EXTERN_C();
  1029. /** Create a new string by replacing all occurrences of a single character
  1030. within another string.
  1031. The new string results from replacing all occurrences of oldChar in str
  1032. with newChar.
  1033. The new string does not necessarily have a reference count of 1 (in cases
  1034. where oldChar does not occur in str), so it must not be modified without
  1035. checking the reference count. This function does not handle out-of-memory
  1036. conditions.
  1037. @param newStr
  1038. pointer to the new string. The pointed-to data must be null or a valid
  1039. string.
  1040. @param str
  1041. a valid string.
  1042. @param oldChar
  1043. the old character.
  1044. @param newChar
  1045. the new character.
  1046. */
  1047. SAL_DLLPUBLIC void SAL_CALL rtl_uString_newReplace(
  1048. rtl_uString ** newStr, rtl_uString * str, sal_Unicode oldChar, sal_Unicode newChar ) SAL_THROW_EXTERN_C();
  1049. /** Create a new string by replacing the first occurrence of a given substring
  1050. with another substring.
  1051. @param[in, out] newStr pointer to the new string; must not be null; must
  1052. point to null or a valid rtl_uString
  1053. @param str pointer to the original string; must not be null
  1054. @param from pointer to the substring to be replaced; must not be null
  1055. @param to pointer to the replacing substring; must not be null
  1056. @param[in,out] index pointer to a start index, must not be null; upon entry
  1057. to the function its value is the index into the original string at which to
  1058. start searching for the \p from substring, the value must be non-negative
  1059. and not greater than the original string's length; upon exit from the
  1060. function its value is the index into the original string at which the
  1061. replacement took place or -1 if no replacement took place
  1062. @since LibreOffice 3.6
  1063. */
  1064. SAL_DLLPUBLIC void SAL_CALL rtl_uString_newReplaceFirst(
  1065. rtl_uString ** newStr, rtl_uString * str, rtl_uString const * from,
  1066. rtl_uString const * to, sal_Int32 * index) SAL_THROW_EXTERN_C();
  1067. /** Create a new string by replacing the first occurrence of a given substring
  1068. with another substring.
  1069. @param[in, out] newStr pointer to the new string; must not be null; must
  1070. point to null or a valid rtl_uString
  1071. @param str pointer to the original string; must not be null

Large files files are truncated, but you can click here to view the full file