1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
3 * This file is part of the LibreOffice project.
5 * This Source Code Form is subject to the terms of the Mozilla Public
6 * License, v. 2.0. If a copy of the MPL was not distributed with this
7 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
9 * This file incorporates work covered by the following license notice:
11 * Licensed to the Apache Software Foundation (ASF) under one or more
12 * contributor license agreements. See the NOTICE file distributed
13 * with this work for additional information regarding copyright
14 * ownership. The ASF licenses this file to you under the Apache
15 * License, Version 2.0 (the "License"); you may not use this file
16 * except in compliance with the License. You may obtain a copy of
17 * the License at http://www.apache.org/licenses/LICENSE-2.0 .
20 #ifndef INCLUDED_RTL_USTRBUF_H
21 #define INCLUDED_RTL_USTRBUF_H
23 #include <sal/config.h>
25 #include <rtl/ustring.h>
26 #include <sal/saldllapi.h>
32 /** Allocates a new <code>String</code> that contains characters from
33 the character array argument.
35 The <code>count</code> argument specifies
36 the length of the array. The initial capacity of the string buffer is
37 <code>16</code> plus the length of the string argument.
39 @param newStr out parameter, contains the new string. The reference count is 1.
40 @param value the initial value of the string.
41 @param count the length of value.
43 SAL_DLLPUBLIC
void SAL_CALL
rtl_uStringbuffer_newFromStr_WithLength(
44 rtl_uString
** newStr
,
45 const sal_Unicode
* value
,
49 Allocates a new <code>String</code> that contains the same sequence of
50 characters as the string argument.
52 The initial capacity is the larger of:
54 <li> The <code>bufferLen</code> argument.
55 <li> The <code>length</code> of the string argument.
58 @param newStr out parameter, contains the new string. The reference count is 1.
59 @param capacity the initial len of the string buffer.
60 @param oldStr the initial value of the string.
61 @return the new capacity of the string buffer
63 SAL_DLLPUBLIC sal_Int32 SAL_CALL
rtl_uStringbuffer_newFromStringBuffer(
64 rtl_uString
** newStr
,
66 rtl_uString
* oldStr
);
69 Ensures that the capacity of the buffer is at least equal to the
72 If the current capacity of this string buffer is less than the
73 argument, then a new internal buffer is allocated with greater
74 capacity. The new capacity is the larger of:
76 <li>The <code>minimumCapacity</code> argument.
77 <li>Twice the old capacity, plus <code>2</code>.
79 If the <code>minimumCapacity</code> argument is nonpositive, this
80 method takes no action and simply returns.
82 @param[in,out] This the String to operate on.
83 @param[in,out] capacity in: old capacity, out: new capacity.
84 @param[in] minimumCapacity the minimum desired capacity.
86 SAL_DLLPUBLIC
void SAL_CALL
rtl_uStringbuffer_ensureCapacity(
89 sal_Int32 minimumCapacity
);
92 Inserts the string representation of the <code>str</code> array
93 argument into this string buffer.
95 The characters of the array argument are inserted into the
96 contents of this string buffer at the position indicated by
97 <code>offset</code>. The length of this string buffer increases by
98 the length of the argument.
100 @param This The string, on that the operation should take place
101 @param capacity the capacity of the string buffer
102 @param offset the offset.
103 @param str a character array.
104 @param len the number of characters to append.
106 SAL_DLLPUBLIC
void SAL_CALL
rtl_uStringbuffer_insert(
107 /*inout*/rtl_uString
** This
,
108 /*inout*/sal_Int32
* capacity
,
110 const sal_Unicode
* str
,
114 Inserts a single UTF-32 character into this string buffer.
116 <p>The single UTF-32 character will be represented within the string buffer
117 as either one or two UTF-16 code units.</p>
119 @param pThis the string buffer on which the operation is performed
121 @param capacity the capacity of the string buffer
123 @param offset the offset into this string buffer (from zero to the length
124 of this string buffer, inclusive)
126 @param c a well-formed UTF-32 code unit (that is, a value in the range
127 <code>0</code>–<code>0x10FFFF</code>, but excluding
128 <code>0xD800</code>–<code>0xDFFF</code>)
130 SAL_DLLPUBLIC
void SAL_CALL
rtl_uStringbuffer_insertUtf32(
131 rtl_uString
** pThis
, sal_Int32
* capacity
, sal_Int32 offset
, sal_uInt32 c
)
132 SAL_THROW_EXTERN_C();
135 Inserts the 8-Bit ASCII string representation of the <code>str</code>
136 array argument into this string buffer.
138 Since this function is optimized
139 for performance, the ASCII character values are not converted in any way.
140 The caller has to make sure that all ASCII characters are in the allowed
141 range between 0 and 127.
143 The characters of the array argument are inserted into the
144 contents of this string buffer at the position indicated by
145 <code>offset</code>. The length of this string buffer increases by
146 the length of the argument.
148 @param This The string, on that the operation should take place
149 @param capacity the capacity of the string buffer
150 @param offset the offset.
151 @param str a character array.
152 @param len the number of characters to append.
154 SAL_DLLPUBLIC
void SAL_CALL
rtl_uStringbuffer_insert_ascii(
155 /*inout*/rtl_uString
** This
,
156 /*inout*/sal_Int32
* capacity
,
158 const sal_Char
* str
,
162 Removes the characters in a substring of this sequence.
164 The substring begins at the specified <code>start</code> and
165 is <code>len</code> characters long.
167 start must be >= 0 && <= This->length
169 @param[in,out] This The String to operate on.
170 @param[in] start The beginning index, inclusive
171 @param[in] len The substring length
173 SAL_DLLPUBLIC
void SAL_CALL
rtl_uStringbuffer_remove(
179 Returns an immutable rtl_uString object, while clearing the string buffer.
181 This method is primarily used to allow these completed
182 string allocation events to be traced.
184 @param ppThis The string, on that the operation should take place
185 @param nCapacity pointer to the capacity of the string buffer
187 @since LibreOffice 3.6
189 SAL_DLLPUBLIC rtl_uString
* SAL_CALL
rtl_uStringBuffer_makeStringAndClear(
190 /*inout*/ rtl_uString
** ppThis
,
191 sal_Int32
*nCapacity
);
194 References and returns an immutable rtl_uString object, from a mutable
195 string-buffer object.
197 This method is primarily used to allow legacy 'String' class
198 conversions to OUString to be accurately traced.
200 @param pThis The string, on that the operation should take place
202 @since LibreOffice 3.6
204 SAL_DLLPUBLIC rtl_uString
* SAL_CALL
rtl_uStringBuffer_refReturn( rtl_uString
*pThis
);
210 #endif // INCLUDED_RTL_USTRBUF_H
212 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */