xref: /trunk/main/cppu/inc/uno/sequence2.h (revision cdf0e10c4e3984b49a9502b011690b615761d4a3)
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 #ifndef _UNO_SEQUENCE2_H_
28 #define _UNO_SEQUENCE2_H_
29 
30 #include <sal/types.h>
31 #include <uno/data.h>
32 
33 #ifdef __cplusplus
34 extern "C"
35 {
36 #endif
37 
38 struct _typelib_TypeDescriptionReference;
39 struct _typelib_TypeDescription;
40 typedef sal_Sequence uno_Sequence;
41 
42 /** Assigns a sequence.
43 
44     @param ppDest       destinstaion sequence
45     @param pSource      source sequence
46     @param pTypeDescr   type description of the sequence and NOT of an element
47     @param release      function called each time an interface needs to
48                         be released; defaults (0) to uno
49 */
50 void SAL_CALL uno_sequence_assign(
51     uno_Sequence ** ppDest,
52     uno_Sequence * pSource,
53     struct _typelib_TypeDescription * pTypeDescr,
54     uno_ReleaseFunc release )
55     SAL_THROW_EXTERN_C();
56 /** Assigns a sequence.
57 
58     @param ppDest       destinstaion sequence
59     @param pSource      source sequence
60     @param pType        type of the sequence and NOT of an element
61     @param release      function called each time an interface needs to
62                         be released; defaults (0) to uno
63 */
64 void SAL_CALL uno_type_sequence_assign(
65     uno_Sequence ** ppDest,
66     uno_Sequence * pSource,
67     struct _typelib_TypeDescriptionReference * pType,
68     uno_ReleaseFunc release )
69     SAL_THROW_EXTERN_C();
70 
71 /** Constructs a new sequence with given elements.
72 
73     @param ppSequence         out parameter sequence;
74                               0 if memory allocation has failed
75     @param pTypeDescr         type description of the sequence and NOT of an
76                               element
77     @param pElements          if 0, then all elements are default constructed
78     @param len                number of elements
79     @param acquire            function called each time an interface needs to
80                               be acquired; defaults (0) to uno
81     @return                   false, if memoray allocation has failed
82 */
83 sal_Bool SAL_CALL uno_sequence_construct(
84     uno_Sequence ** ppSequence,
85     struct _typelib_TypeDescription * pTypeDescr,
86     void * pElements, sal_Int32 len,
87     uno_AcquireFunc acquire )
88     SAL_THROW_EXTERN_C();
89 /** Constructs a new sequence with given elements.
90 
91     @param ppSequence         out parameter sequence;
92                               0 if memory allocation has failed
93     @param pType              type of the sequence and NOT of an element
94     @param pElements          if 0, then all elements are default constructed
95     @param len                number of elements
96     @param acquire            function called each time an interface needs to
97                               be acquired; defaults (0) to uno
98     @return                   false, if memoray allocation has failed
99 */
100 sal_Bool SAL_CALL uno_type_sequence_construct(
101     uno_Sequence ** ppSequence,
102     struct _typelib_TypeDescriptionReference * pType,
103     void * pElements, sal_Int32 len,
104     uno_AcquireFunc acquire )
105     SAL_THROW_EXTERN_C();
106 
107 /** Assures that the reference count of the given sequence is one.
108     Otherwise a new copy of the sequence is created with a reference count
109     of one.
110 
111     @param ppSequence       inout sequence
112     @param pTypeDescr       type description of sequence
113     @param acquire          function called each time an interface needs to
114                             be acquired; defaults (0) to uno
115     @param release          function called each time an interface needs to
116                             be released; defaults (0) to uno
117     @return                 false, if memoray allocation has failed
118 */
119 sal_Bool SAL_CALL uno_sequence_reference2One(
120     uno_Sequence ** ppSequence,
121     struct _typelib_TypeDescription * pTypeDescr,
122     uno_AcquireFunc acquire,
123     uno_ReleaseFunc release )
124     SAL_THROW_EXTERN_C();
125 /** Assures that the reference count of the given sequence is one.
126     Otherwise a new copy of the sequence is created with a reference count
127     of one.
128 
129     @param ppSequence       inout sequence
130     @param pType            type of sequence
131     @param acquire          function called each time an interface needs to
132                             be acquired; defaults (0) to uno
133     @param release          function called each time an interface needs to
134                             be released; defaults (0) to uno
135     @return                 false, if memoray allocation has failed
136 */
137 sal_Bool SAL_CALL uno_type_sequence_reference2One(
138     uno_Sequence ** ppSequence,
139     struct _typelib_TypeDescriptionReference * pType,
140     uno_AcquireFunc acquire,
141     uno_ReleaseFunc release )
142     SAL_THROW_EXTERN_C();
143 
144 /** Reallocates length of a sequence. This truncates a sequence or enlarges
145     it default constructing appended elements.
146 
147     @param ppSequence       inout sequence
148     @param pTypeDescr       type description of sequence
149     @param nSize            new size of sequence
150     @param acquire          function called each time an interface needs to
151                             be acquired; defaults (0) to uno
152     @param release          function called each time an interface needs to
153                             be released; defaults (0) to uno
154     @return                 false, if memoray allocation has failed
155 */
156 sal_Bool SAL_CALL uno_sequence_realloc(
157     uno_Sequence ** ppSequence,
158     struct _typelib_TypeDescription * pTypeDescr,
159     sal_Int32 nSize,
160     uno_AcquireFunc acquire,
161     uno_ReleaseFunc release )
162     SAL_THROW_EXTERN_C();
163 /** Reallocates length of a sequence. This truncates a sequence or enlarges
164     it default constructing appended elements.
165 
166     @param ppSequence       inout sequence
167     @param pType            type of sequence
168     @param nSize            new size of sequence
169     @param acquire          function called each time an interface needs to
170                             be acquired; defaults (0) to uno
171     @param release          function called each time an interface needs to
172                             be released; defaults (0) to uno
173     @return                 false, if memoray allocation has failed
174 */
175 sal_Bool SAL_CALL uno_type_sequence_realloc(
176     uno_Sequence ** ppSequence,
177     struct _typelib_TypeDescriptionReference * pType,
178     sal_Int32 nSize,
179     uno_AcquireFunc acquire,
180     uno_ReleaseFunc release )
181     SAL_THROW_EXTERN_C();
182 
183 #ifdef __cplusplus
184 }
185 #endif
186 
187 #endif
188