merge the formfield patch from ooo-build
[ooovba.git] / sal / inc / rtl / strbuf.h
blob0044429887cc222db707527050fbb773b8711740
1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 *
5 * Copyright 2008 by Sun Microsystems, Inc.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * $RCSfile: strbuf.h,v $
10 * $Revision: 1.5 $
12 * This file is part of OpenOffice.org.
14 * OpenOffice.org is free software: you can redistribute it and/or modify
15 * it under the terms of the GNU Lesser General Public License version 3
16 * only, as published by the Free Software Foundation.
18 * OpenOffice.org is distributed in the hope that it will be useful,
19 * but WITHOUT ANY WARRANTY; without even the implied warranty of
20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 * GNU Lesser General Public License version 3 for more details
22 * (a copy is included in the LICENSE file that accompanied this code).
24 * You should have received a copy of the GNU Lesser General Public License
25 * version 3 along with OpenOffice.org. If not, see
26 * <http://www.openoffice.org/license.html>
27 * for a copy of the LGPLv3 License.
29 ************************************************************************/
31 #ifndef _RTL_STRBUF_H_
32 #define _RTL_STRBUF_H_
34 #include <rtl/string.h>
36 #ifdef __cplusplus
37 extern "C" {
38 #endif
40 /** @HTML
41 Allocates a new <code>String</code> that contains characters from
42 the character array argument.
44 The <code>count</code> argument specifies
45 the length of the array. The initial capacity of the string buffer is
46 <code>16</code> plus the length of the string argument.
48 @param newStr out parameter, contains the new string. The reference count is 1.
49 @param value the initial value of the string.
50 @param count the length of value.
52 void SAL_CALL rtl_stringbuffer_newFromStr_WithLength( rtl_String ** newStr,
53 const sal_Char * value,
54 sal_Int32 count);
56 /**
57 Allocates a new <code>String</code> that contains the same sequence of
58 characters as the string argument.
60 The initial capacity is the larger of:
61 <ul>
62 <li> The <code>bufferLen</code> argument.
63 <li> The <code>length</code> of the string argument.
64 </ul>
66 @param newStr out parameter, contains the new string. The reference count is 1.
67 @param capacity the initial len of the string buffer.
68 @param oldStr the initial value of the string.
69 @return the new capacity of the string buffer
71 sal_Int32 SAL_CALL rtl_stringbuffer_newFromStringBuffer( rtl_String ** newStr,
72 sal_Int32 capacity,
73 rtl_String * olsStr );
75 /**
76 Ensures that the capacity of the buffer is at least equal to the
77 specified minimum.
79 If the current capacity of this string buffer is less than the
80 argument, then a new internal buffer is allocated with greater
81 capacity. The new capacity is the larger of:
82 <ul>
83 <li>The <code>minimumCapacity</code> argument.
84 <li>Twice the old capacity, plus <code>2</code>.
85 </ul>
86 If the <code>minimumCapacity</code> argument is nonpositive, this
87 method takes no action and simply returns.
89 @param capacity in: old capicity, out: new capacity.
90 @param minimumCapacity the minimum desired capacity.
92 void SAL_CALL rtl_stringbuffer_ensureCapacity( /*inout*/rtl_String ** This,
93 /*inout*/sal_Int32* capacity,
94 sal_Int32 minimumCapacity);
97 /**
98 Inserts the string representation of the <code>char</code> array
99 argument into this string buffer.
101 The characters of the array argument are inserted into the
102 contents of this string buffer at the position indicated by
103 <code>offset</code>. The length of this string buffer increases by
104 the length of the argument.
106 @param capacity the capacity of the string buffer
107 @param offset the offset.
108 @param ch a character array.
109 @param len the number of characters to append.
110 @return this string buffer.
112 void SAL_CALL rtl_stringbuffer_insert( /*inout*/rtl_String ** This,
113 /*inout*/sal_Int32 * capacity,
114 sal_Int32 offset,
115 const sal_Char * str,
116 sal_Int32 len);
118 #ifdef __cplusplus
120 #endif
122 #endif /* _RTL_STRBUF_H_ */