Avoid potential negative array index access to cached text.
[LibreOffice.git] / include / uno / sequence2.h
blobbf74a6170d1eba1b61c9fd25513122832dc1e604
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
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 .
21 * This file is part of LibreOffice published API.
23 #ifndef INCLUDED_UNO_SEQUENCE2_H
24 #define INCLUDED_UNO_SEQUENCE2_H
26 #include "cppu/cppudllapi.h"
27 #include "uno/data.h"
29 #ifdef __cplusplus
30 extern "C"
32 #endif
34 struct _typelib_TypeDescriptionReference;
35 struct _typelib_TypeDescription;
36 typedef sal_Sequence uno_Sequence;
38 /** Assigns a sequence.
40 @param ppDest destination sequence
41 @param pSource source sequence
42 @param pTypeDescr type description of the sequence and NOT of an element
43 @param release function called each time an interface needs to
44 be released; defaults (0) to uno
46 CPPU_DLLPUBLIC void SAL_CALL uno_sequence_assign(
47 uno_Sequence ** ppDest,
48 uno_Sequence * pSource,
49 struct _typelib_TypeDescription * pTypeDescr,
50 uno_ReleaseFunc release )
51 SAL_THROW_EXTERN_C();
52 /** Assigns a sequence.
54 @param ppDest destination sequence
55 @param pSource source sequence
56 @param pType type of the sequence and NOT of an element
57 @param release function called each time an interface needs to
58 be released; defaults (0) to uno
60 CPPU_DLLPUBLIC void SAL_CALL uno_type_sequence_assign(
61 uno_Sequence ** ppDest,
62 uno_Sequence * pSource,
63 struct _typelib_TypeDescriptionReference * pType,
64 uno_ReleaseFunc release )
65 SAL_THROW_EXTERN_C();
67 /** Constructs a new sequence with given elements.
69 @param ppSequence out parameter sequence;
70 0 if memory allocation has failed
71 @param pTypeDescr type description of the sequence and NOT of an
72 element
73 @param pElements if 0, then all elements are default constructed
74 @param len number of elements
75 @param acquire function called each time an interface needs to
76 be acquired; defaults (0) to uno
77 @return false, if memoray allocation has failed
79 CPPU_DLLPUBLIC sal_Bool SAL_CALL uno_sequence_construct(
80 uno_Sequence ** ppSequence,
81 struct _typelib_TypeDescription * pTypeDescr,
82 void * pElements, sal_Int32 len,
83 uno_AcquireFunc acquire )
84 SAL_THROW_EXTERN_C();
85 /** Constructs a new sequence with given elements.
87 @param ppSequence out parameter sequence;
88 0 if memory allocation has failed
89 @param pType type of the sequence and NOT of an element
90 @param pElements if 0, then all elements are default constructed
91 @param len number of elements
92 @param acquire function called each time an interface needs to
93 be acquired; defaults (0) to uno
94 @return false, if memoray allocation has failed
96 CPPU_DLLPUBLIC sal_Bool SAL_CALL uno_type_sequence_construct(
97 uno_Sequence ** ppSequence,
98 struct _typelib_TypeDescriptionReference * pType,
99 void * pElements, sal_Int32 len,
100 uno_AcquireFunc acquire )
101 SAL_THROW_EXTERN_C();
103 /** Assures that the reference count of the given sequence is one.
104 Otherwise a new copy of the sequence is created with a reference count
105 of one.
107 @param ppSequence inout sequence
108 @param pTypeDescr type description of sequence
109 @param acquire function called each time an interface needs to
110 be acquired; defaults (0) to uno
111 @param release function called each time an interface needs to
112 be released; defaults (0) to uno
113 @return false, if memoray allocation has failed
115 CPPU_DLLPUBLIC sal_Bool SAL_CALL uno_sequence_reference2One(
116 uno_Sequence ** ppSequence,
117 struct _typelib_TypeDescription * pTypeDescr,
118 uno_AcquireFunc acquire,
119 uno_ReleaseFunc release )
120 SAL_THROW_EXTERN_C();
121 /** Assures that the reference count of the given sequence is one.
122 Otherwise a new copy of the sequence is created with a reference count
123 of one.
125 @param ppSequence inout sequence
126 @param pType type of sequence
127 @param acquire function called each time an interface needs to
128 be acquired; defaults (0) to uno
129 @param release function called each time an interface needs to
130 be released; defaults (0) to uno
131 @return false, if memoray allocation has failed
133 CPPU_DLLPUBLIC sal_Bool SAL_CALL uno_type_sequence_reference2One(
134 uno_Sequence ** ppSequence,
135 struct _typelib_TypeDescriptionReference * pType,
136 uno_AcquireFunc acquire,
137 uno_ReleaseFunc release )
138 SAL_THROW_EXTERN_C();
140 /** Reallocates length of a sequence. This truncates a sequence or enlarges
141 it default constructing appended elements.
143 @param ppSequence inout sequence
144 @param pTypeDescr type description of sequence
145 @param nSize new size of sequence
146 @param acquire function called each time an interface needs to
147 be acquired; defaults (0) to uno
148 @param release function called each time an interface needs to
149 be released; defaults (0) to uno
150 @return false, if memoray allocation has failed
152 CPPU_DLLPUBLIC sal_Bool SAL_CALL uno_sequence_realloc(
153 uno_Sequence ** ppSequence,
154 struct _typelib_TypeDescription * pTypeDescr,
155 sal_Int32 nSize,
156 uno_AcquireFunc acquire,
157 uno_ReleaseFunc release )
158 SAL_THROW_EXTERN_C();
159 /** Reallocates length of a sequence. This truncates a sequence or enlarges
160 it default constructing appended elements.
162 @param ppSequence inout sequence
163 @param pType type of sequence
164 @param nSize new size of sequence
165 @param acquire function called each time an interface needs to
166 be acquired; defaults (0) to uno
167 @param release function called each time an interface needs to
168 be released; defaults (0) to uno
169 @return false, if memoray allocation has failed
171 CPPU_DLLPUBLIC sal_Bool SAL_CALL uno_type_sequence_realloc(
172 uno_Sequence ** ppSequence,
173 struct _typelib_TypeDescriptionReference * pType,
174 sal_Int32 nSize,
175 uno_AcquireFunc acquire,
176 uno_ReleaseFunc release )
177 SAL_THROW_EXTERN_C();
179 /** Destroy a sequence whose reference count has dropped to zero.
181 @param sequence must be non-null, sequence->nRefCount must be zero
182 @param type the type of the sequence, must be non-null
183 @param release function called each time an interface needs to be release,
184 must be non-null
186 @since LibreOffice 4.4
188 CPPU_DLLPUBLIC void SAL_CALL uno_type_sequence_destroy(
189 uno_Sequence * sequence, struct _typelib_TypeDescriptionReference * type,
190 uno_ReleaseFunc release)
191 SAL_THROW_EXTERN_C();
193 #ifdef __cplusplus
195 #endif
197 #endif
199 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */