1 /************************************************************************* 2 * 3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 4 * 5 * Copyright 2000, 2010 Oracle and/or its affiliates. 6 * 7 * OpenOffice.org - a multi-platform office productivity suite 8 * 9 * This file is part of OpenOffice.org. 10 * 11 * OpenOffice.org is free software: you can redistribute it and/or modify 12 * it under the terms of the GNU Lesser General Public License version 3 13 * only, as published by the Free Software Foundation. 14 * 15 * OpenOffice.org is distributed in the hope that it will be useful, 16 * but WITHOUT ANY WARRANTY; without even the implied warranty of 17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 18 * GNU Lesser General Public License version 3 for more details 19 * (a copy is included in the LICENSE file that accompanied this code). 20 * 21 * You should have received a copy of the GNU Lesser General Public License 22 * version 3 along with OpenOffice.org. If not, see 23 * <http://www.openoffice.org/license.html> 24 * for a copy of the LGPLv3 License. 25 * 26 ************************************************************************/ 27 28 #ifndef _RTL_USTRBUF_H_ 29 #define _RTL_USTRBUF_H_ 30 31 #include <rtl/ustring.h> 32 33 #ifdef __cplusplus 34 extern "C" { 35 #endif 36 37 /** @HTML 38 Allocates a new <code>String</code> that contains characters from 39 the character array argument. 40 41 The <code>count</code> argument specifies 42 the length of the array. The initial capacity of the string buffer is 43 <code>16</code> plus the length of the string argument. 44 45 @param newStr out parameter, contains the new string. The reference count is 1. 46 @param value the initial value of the string. 47 @param count the length of value. 48 */ 49 void SAL_CALL rtl_uStringbuffer_newFromStr_WithLength( rtl_uString ** newStr, 50 const sal_Unicode * value, 51 sal_Int32 count ); 52 53 /** 54 Allocates a new <code>String</code> that contains the same sequence of 55 characters as the string argument. 56 57 The initial capacity is the larger of: 58 <ul> 59 <li> The <code>bufferLen</code> argument. 60 <li> The <code>length</code> of the string argument. 61 </ul> 62 63 @param newStr out parameter, contains the new string. The reference count is 1. 64 @param capacity the initial len of the string buffer. 65 @param oldStr the initial value of the string. 66 @return the new capacity of the string buffer 67 */ 68 sal_Int32 SAL_CALL rtl_uStringbuffer_newFromStringBuffer( rtl_uString ** newStr, 69 sal_Int32 capacity, 70 rtl_uString * olsStr ); 71 72 /** 73 Ensures that the capacity of the buffer is at least equal to the 74 specified minimum. 75 76 If the current capacity of this string buffer is less than the 77 argument, then a new internal buffer is allocated with greater 78 capacity. The new capacity is the larger of: 79 <ul> 80 <li>The <code>minimumCapacity</code> argument. 81 <li>Twice the old capacity, plus <code>2</code>. 82 </ul> 83 If the <code>minimumCapacity</code> argument is nonpositive, this 84 method takes no action and simply returns. 85 86 @param capacity in: old capicity, out: new capacity. 87 @param minimumCapacity the minimum desired capacity. 88 */ 89 void SAL_CALL rtl_uStringbuffer_ensureCapacity( /*inout*/rtl_uString ** This, 90 /*inout*/sal_Int32* capacity, 91 sal_Int32 minimumCapacity); 92 93 /** 94 Inserts the string representation of the <code>str</code> array 95 argument into this string buffer. 96 97 The characters of the array argument are inserted into the 98 contents of this string buffer at the position indicated by 99 <code>offset</code>. The length of this string buffer increases by 100 the length of the argument. 101 102 @param This The string, on that the operation should take place 103 @param capacity the capacity of the string buffer 104 @param offset the offset. 105 @param str a character array. 106 @param len the number of characters to append. 107 */ 108 void SAL_CALL rtl_uStringbuffer_insert( /*inout*/rtl_uString ** This, 109 /*inout*/sal_Int32 * capacity, 110 sal_Int32 offset, 111 const sal_Unicode * str, 112 sal_Int32 len); 113 114 /** 115 Inserts a single UTF-32 character into this string buffer. 116 117 <p>The single UTF-32 character will be represented within the string buffer 118 as either one or two UTF-16 code units.</p> 119 120 @param pThis the string buffer on which the operation is performed 121 122 @param capacity the capacity of the string buffer 123 124 @param offset the offset into this string buffer (from zero to the length 125 of this string buffer, inclusive) 126 127 @param c a well-formed UTF-32 code unit (that is, a value in the range 128 <code>0</code>–<code>0x10FFFF</code>, but excluding 129 <code>0xD800</code>–<code>0xDFFF</code>) 130 */ 131 void SAL_CALL rtl_uStringbuffer_insertUtf32( 132 rtl_uString ** pThis, sal_Int32 * capacity, sal_Int32 offset, sal_uInt32 c) 133 SAL_THROW_EXTERN_C(); 134 135 /** 136 Inserts the 8-Bit ASCII string representation of the <code>str</code> 137 array argument into this string buffer. 138 139 Since this function is optimized 140 for performance, the ASCII character values are not converted in any way. 141 The caller has to make sure that all ASCII characters are in the allowed 142 range between 0 and 127. 143 <p> 144 The characters of the array argument are inserted into the 145 contents of this string buffer at the position indicated by 146 <code>offset</code>. The length of this string buffer increases by 147 the length of the argument. 148 149 @param This The string, on that the operation should take place 150 @param capacity the capacity of the string buffer 151 @param offset the offset. 152 @param str a character array. 153 @param len the number of characters to append. 154 */ 155 void SAL_CALL rtl_uStringbuffer_insert_ascii( /*inout*/rtl_uString ** This, 156 /*inout*/sal_Int32 * capacity, 157 sal_Int32 offset, 158 const sal_Char * str, 159 sal_Int32 len); 160 161 #ifdef __cplusplus 162 } 163 #endif 164 165 #endif /* _RTL_USTRBUF_H_ */ 166