xref: /AOO41X/main/cppu/inc/uno/sequence2.h (revision 514f4c20bcebc1639918b6975cc4300e4484c27c)
1 /**************************************************************
2  *
3  * Licensed to the Apache Software Foundation (ASF) under one
4  * or more contributor license agreements.  See the NOTICE file
5  * distributed with this work for additional information
6  * regarding copyright ownership.  The ASF licenses this file
7  * to you under the Apache License, Version 2.0 (the
8  * "License"); you may not use this file except in compliance
9  * with the License.  You may obtain a copy of the License at
10  *
11  *   http://www.apache.org/licenses/LICENSE-2.0
12  *
13  * Unless required by applicable law or agreed to in writing,
14  * software distributed under the License is distributed on an
15  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16  * KIND, either express or implied.  See the License for the
17  * specific language governing permissions and limitations
18  * under the License.
19  *
20  *************************************************************/
21 
22 
23 #ifndef _UNO_SEQUENCE2_H_
24 #define _UNO_SEQUENCE2_H_
25 
26 #include <sal/types.h>
27 #include <uno/data.h>
28 
29 #ifdef __cplusplus
30 extern "C"
31 {
32 #endif
33 
34 struct _typelib_TypeDescriptionReference;
35 struct _typelib_TypeDescription;
36 typedef sal_Sequence uno_Sequence;
37 
38 /** Assigns a sequence.
39 
40     @param ppDest       destinstaion 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
45 */
46 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.
53 
54     @param ppDest       destinstaion 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
59 */
60 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();
66 
67 /** Constructs a new sequence with given elements.
68 
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
78 */
79 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.
86 
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
95 */
96 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();
102 
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.
106 
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
114 */
115 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.
124 
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
132 */
133 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();
139 
140 /** Reallocates length of a sequence. This truncates a sequence or enlarges
141     it default constructing appended elements.
142 
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
151 */
152 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.
161 
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
170 */
171 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();
178 
179 #ifdef __cplusplus
180 }
181 #endif
182 
183 #endif
184