xref: /trunk/main/registry/inc/registry/reader.h (revision f006f9b4)
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 
24 #ifndef INCLUDED_registry_reader_h
25 #define INCLUDED_registry_reader_h
26 
27 #include "registry/types.h"
28 #include "registry/version.h"
29 #include "registry/registrydllapi.h"
30 
31 #include "rtl/ustring.h"
32 #include "sal/types.h"
33 
34 #ifdef __cplusplus
35 extern "C" {
36 #endif
37 
38 /// @HTML
39 
40 /**
41    Creates a type reader working on a binary blob that represents a UNOIDL type.
42 
43    <p>If a non-null handle is returned through <code>result</code>, its
44    reference count will be one.  Operations on a non-null handle are not
45    multi-thread&ndash;safe.</p>
46 
47    @param buffer the binary blob representing the type; must point to at least
48    <code>length</code> bytes, and need only be byte-aligned
49 
50    @param length the size in bytes of the binary blob representing the type
51 
52    @param copy if true, the type reader creates an internal copy of the given
53    buffer, and the given buffer is not accessed after this function returns; if
54    false, the type reader works directly on the given buffer, which must remain
55    available unmodified until the type reader is destroyed
56 
57    @param maxVersion the maximum binary blob version the client is prepared to
58    handle; must not be negative
59 
60    @param result an out-parameter obtaining a handle on the type reader; must
61    not be null; if the given binary blob is malformed, or of a version larger
62    than <code>maxVersion</code>, null is returned
63 
64    @return false iff an out-of-memory condition occurred, in which case
65    <code>result</code> is left unchanged, and no type reader is created
66 
67    @since UDK 3.2.0
68  */
69 REGISTRY_DLLPUBLIC sal_Bool SAL_CALL typereg_reader_create(
70     void const * buffer, sal_uInt32 length, sal_Bool copy,
71     enum typereg_Version maxVersion, void ** result)
72     SAL_THROW_EXTERN_C();
73 
74 /**
75    Increments the reference count of a type reader.
76 
77    @param handle a handle on a type reader; may be null
78 
79    @since UDK 3.2.0
80  */
81 REGISTRY_DLLPUBLIC void SAL_CALL typereg_reader_acquire(void * handle) SAL_THROW_EXTERN_C();
82 
83 /**
84    Decrements the reference count of a type reader.
85 
86    <p>If the reference count drops to zero, the type reader is destroyed.</p>
87 
88    @param handle a handle on a type reader; may be null
89 
90    @since UDK 3.2.0
91  */
92 REGISTRY_DLLPUBLIC void SAL_CALL typereg_reader_release(void * handle) SAL_THROW_EXTERN_C();
93 
94 /**
95    Returns the binary blob version of a type reader.
96 
97    @param handle a handle on a type reader; may be null
98 
99    @return the version of the binary blob from which the type reader was
100    constructed; if <code>handle</code> is null, <code>TYPEREG_VERSION_0</code>
101    is returned
102 
103    @since UDK 3.2.0
104  */
105 REGISTRY_DLLPUBLIC enum typereg_Version SAL_CALL typereg_reader_getVersion(void * handle)
106     SAL_THROW_EXTERN_C();
107 
108 /**
109    Returns the documentation of a type reader.
110 
111    @param handle a handle on a type reader; may be null
112 
113    @param result an out-parameter obtaining the documentation string; must not
114    be null; if <code>handle</code> is null, an empty string is returned; if an
115    out-of-memory condition occurs, a pointer to a null pointer is returned
116 
117    @since UDK 3.2.0
118  */
119 REGISTRY_DLLPUBLIC void SAL_CALL typereg_reader_getDocumentation(
120     void * handle, rtl_uString ** result) SAL_THROW_EXTERN_C();
121 
122 /**
123    Returns the file name of a type reader.
124 
125    @param handle a handle on a type reader; may be null
126 
127    @param result an out-parameter obtaining the file name string; must not be
128    null; if <code>handle</code> is null, an empty string is returned; if an
129    out-of-memory condition occurs, a pointer to a null pointer is returned
130 
131    @since UDK 3.2.0
132    @deprecated
133  */
134 REGISTRY_DLLPUBLIC void SAL_CALL typereg_reader_getFileName(void * handle, rtl_uString ** result)
135     SAL_THROW_EXTERN_C();
136 
137 /**
138    Returns the type class of a type reader.
139 
140    <p>This function will always return the type class without the internal
141    <code>RT_TYPE_PUBLISHED</code> flag set.  Use
142    <code>typereg_reader_isPublished</code> to determine whether a type reader is
143    published.</p>
144 
145    @param handle a handle on a type reader; may be null
146 
147    @return the type class of the type reader; if <code>handle</code> is null,
148    <code>RT_TYPE_INVALID</code> is returned
149 
150    @since UDK 3.2.0
151  */
152 REGISTRY_DLLPUBLIC enum RTTypeClass SAL_CALL typereg_reader_getTypeClass(void * handle)
153     SAL_THROW_EXTERN_C();
154 
155 /**
156    Returns whether a type reader is published.
157 
158    @param handle a handle on a type reader; may be null
159 
160    @return whether the type reader is published; if <code>handle</code> is null,
161    <code>sal_False</code> is returned
162 
163    @since UDK 3.2.0
164  */
165 REGISTRY_DLLPUBLIC sal_Bool SAL_CALL typereg_reader_isPublished(void * handle)
166     SAL_THROW_EXTERN_C();
167 
168 /**
169    Returns the type name of a type reader.
170 
171    @param handle a handle on a type reader; may be null
172 
173    @param result an out-parameter obtaining the type name string; must not be
174    null; if <code>handle</code> is null, an empty string is returned; if an
175    out-of-memory condition occurs, a pointer to a null pointer is returned
176 
177    @since UDK 3.2.0
178  */
179 REGISTRY_DLLPUBLIC void SAL_CALL typereg_reader_getTypeName(void * handle, rtl_uString ** result)
180     SAL_THROW_EXTERN_C();
181 
182 /**
183    Returns the number of super types of a type reader.
184 
185    @param handle a handle on a type reader; may be null
186 
187    @return the number of super types of the type reader; if <code>handle</code>
188    is null, zero is returned
189 
190    @since UDK 3.2.0
191  */
192 REGISTRY_DLLPUBLIC sal_uInt16 SAL_CALL typereg_reader_getSuperTypeCount(void * handle)
193     SAL_THROW_EXTERN_C();
194 
195 /**
196    Returns the type name of a super type of a type reader.
197 
198    @param handle a handle on a type reader; must not be null
199 
200    @param result an out-parameter obtaining the super type's type name string;
201    must not be null; if an out-of-memory condition occurs, a pointer to a null
202    pointer is returned
203 
204    @param index a valid index into the range of super types of the given type
205    reader
206 
207    @since UDK 3.2.0
208  */
209 REGISTRY_DLLPUBLIC void SAL_CALL typereg_reader_getSuperTypeName(
210     void * handle, rtl_uString ** result, sal_uInt16 index)
211     SAL_THROW_EXTERN_C();
212 
213 /**
214    Returns the number of fields of a type reader.
215 
216    @param handle a handle on a type reader; may be null
217 
218    @return the number of fields of the type reader; if <code>handle</code> is
219    null, zero is returned
220 
221    @since UDK 3.2.0
222  */
223 REGISTRY_DLLPUBLIC sal_uInt16 SAL_CALL typereg_reader_getFieldCount(void * handle)
224     SAL_THROW_EXTERN_C();
225 
226 /**
227    Returns the documentation of a field of a type reader.
228 
229    @param handle a handle on a type reader; must not be null
230 
231    @param result an out-parameter obtaining the field's documentation string;
232    must not be null; if an out-of-memory condition occurs, a pointer to a null
233    pointer is returned
234 
235    @param index a valid index into the range of fields of the given type reader
236 
237    @since UDK 3.2.0
238  */
239 REGISTRY_DLLPUBLIC void SAL_CALL typereg_reader_getFieldDocumentation(
240     void * handle, rtl_uString ** result, sal_uInt16 index)
241     SAL_THROW_EXTERN_C();
242 
243 /**
244    Returns the file name of a field of a type reader.
245 
246    @param handle a handle on a type reader; must not be null
247 
248    @param result an out-parameter obtaining the field's file name string; must
249    not be null; if an out-of-memory condition occurs, a pointer to a null
250    pointer is returned
251 
252    @param index a valid index into the range of fields of the given type reader
253 
254    @since UDK 3.2.0
255    @deprecated
256  */
257 REGISTRY_DLLPUBLIC void SAL_CALL typereg_reader_getFieldFileName(
258     void * handle, rtl_uString ** result, sal_uInt16 index)
259     SAL_THROW_EXTERN_C();
260 
261 /**
262    Returns the flags of a field of a type reader.
263 
264    @param handle a handle on a type reader; must not be null
265 
266    @param index a valid index into the range of fields of the given type reader
267 
268    @return the flags of the given field of the type reader
269 
270    @since UDK 3.2.0
271  */
272 REGISTRY_DLLPUBLIC RTFieldAccess SAL_CALL typereg_reader_getFieldFlags(
273     void * handle, sal_uInt16 index) SAL_THROW_EXTERN_C();
274 
275 /**
276    Returns the name of a field of a type reader.
277 
278    @param handle a handle on a type reader; must not be null
279 
280    @param result an out-parameter obtaining the field's name string; must not be
281    null; if an out-of-memory condition occurs, a pointer to a null pointer is
282    returned
283 
284    @param index a valid index into the range of fields of the given type reader
285 
286    @since UDK 3.2.0
287  */
288 REGISTRY_DLLPUBLIC void SAL_CALL typereg_reader_getFieldName(
289     void * handle, rtl_uString ** result, sal_uInt16 index)
290     SAL_THROW_EXTERN_C();
291 
292 /**
293    Returns the type name of a field of a type reader.
294 
295    @param handle a handle on a type reader; must not be null
296 
297    @param result an out-parameter obtaining the field's type name string; must
298    not be null; if an out-of-memory condition occurs, a pointer to a null
299    pointer is returned
300 
301    @param index a valid index into the range of fields of the given type reader
302 
303    @since UDK 3.2.0
304  */
305 REGISTRY_DLLPUBLIC void SAL_CALL typereg_reader_getFieldTypeName(
306     void * handle, rtl_uString ** result, sal_uInt16 index)
307     SAL_THROW_EXTERN_C();
308 
309 /**
310    Returns the value of a field of a type reader.
311 
312    @param handle a handle on a type reader; must not be null
313 
314    @param index a valid index into the range of fields of the given type reader
315 
316    @param type an out-parameter obtaining the field value's type; must not be
317    null
318 
319    @param result an out-parameter obtaining the field value's value; must not be
320    null
321 
322    @return false iff an out-of-memory condition occurred, in which case
323    <code>type</code> and <code>value</code> are left unchanged
324 
325    @since UDK 3.2.0
326  */
327 REGISTRY_DLLPUBLIC sal_Bool SAL_CALL typereg_reader_getFieldValue(
328     void * handle, sal_uInt16 index, enum RTValueType * type,
329     union RTConstValueUnion * value)
330     SAL_THROW_EXTERN_C();
331 
332 /**
333    Returns the number of methods of a type reader.
334 
335    @param handle a handle on a type reader; may be null
336 
337    @return the number of methods of the type reader; if <code>handle</code> is
338    null, zero is returned
339 
340    @since UDK 3.2.0
341  */
342 REGISTRY_DLLPUBLIC sal_uInt16 SAL_CALL typereg_reader_getMethodCount(void * handle)
343     SAL_THROW_EXTERN_C();
344 
345 /**
346    Returns the documentation of a method of a type reader.
347 
348    @param handle a handle on a type reader; must not be null
349 
350    @param result an out-parameter obtaining the methods's documentation string;
351    must not be null; if an out-of-memory condition occurs, a pointer to a null
352    pointer is returned
353 
354    @param index a valid index into the range of methods of the given type reader
355 
356    @since UDK 3.2.0
357  */
358 REGISTRY_DLLPUBLIC void SAL_CALL typereg_reader_getMethodDocumentation(
359     void * handle, rtl_uString ** result, sal_uInt16 index)
360     SAL_THROW_EXTERN_C();
361 
362 /**
363    Returns the flags of a method of a type reader.
364 
365    @param handle a handle on a type reader; must not be null
366 
367    @param index a valid index into the range of methods of the given type reader
368 
369    @return the flags of the given method of the type reader
370 
371    @since UDK 3.2.0
372  */
373 REGISTRY_DLLPUBLIC enum RTMethodMode SAL_CALL typereg_reader_getMethodFlags(
374     void * handle, sal_uInt16 index) SAL_THROW_EXTERN_C();
375 
376 /**
377    Returns the name of a method of a type reader.
378 
379    @param handle a handle on a type reader; must not be null
380 
381    @param result an out-parameter obtaining the methods's name string; must not
382    be null; if an out-of-memory condition occurs, a pointer to a null pointer is
383    returned
384 
385    @param index a valid index into the range of methods of the given type reader
386 
387    @since UDK 3.2.0
388  */
389 REGISTRY_DLLPUBLIC void SAL_CALL typereg_reader_getMethodName(
390     void * handle, rtl_uString ** result, sal_uInt16 index)
391     SAL_THROW_EXTERN_C();
392 
393 /**
394    Returns the return type name of a method of a type reader.
395 
396    @param handle a handle on a type reader; must not be null
397 
398    @param result an out-parameter obtaining the methods's return type name
399    string; must not be null; if an out-of-memory condition occurs, a pointer to
400    a null pointer is returned
401 
402    @param index a valid index into the range of methods of the given type reader
403 
404    @since UDK 3.2.0
405  */
406 REGISTRY_DLLPUBLIC void SAL_CALL typereg_reader_getMethodReturnTypeName(
407     void * handle, rtl_uString ** result, sal_uInt16 index)
408     SAL_THROW_EXTERN_C();
409 
410 /**
411    Returns the number of parameters of a method of a type reader.
412 
413    @param handle a handle on a type reader; must not be null
414 
415    @param index a valid index into the range of methods of the given type reader
416 
417    @return the number of parameters of the given method of the type reader
418 
419    @since UDK 3.2.0
420  */
421 REGISTRY_DLLPUBLIC sal_uInt16 SAL_CALL typereg_reader_getMethodParameterCount(
422     void * handle, sal_uInt16 index) SAL_THROW_EXTERN_C();
423 
424 /**
425    Returns the flags of a parameter of a method of a type reader.
426 
427    @param handle a handle on a type reader; must not be null
428 
429    @param methodIndex a valid index into the range of methods of the given type
430    reader
431 
432    @param parameterIndex a valid index into the range of parameters of the given
433    method
434 
435    @return the flags of the given parameter of the given method of the type
436    reader
437 
438    @since UDK 3.2.0
439  */
440 REGISTRY_DLLPUBLIC enum RTParamMode SAL_CALL typereg_reader_getMethodParameterFlags(
441     void * handle, sal_uInt16 methodIndex, sal_uInt16 parameterIndex)
442     SAL_THROW_EXTERN_C();
443 
444 /**
445    Returns the name of a parameter of a method of a type reader.
446 
447    @param handle a handle on a type reader; must not be null
448 
449    @param result an out-parameter obtaining the parameter's name string; must
450    not be null; if an out-of-memory condition occurs, a pointer to a null
451    pointer is returned
452 
453    @param methodIndex a valid index into the range of methods of the given type
454    reader
455 
456    @param parameterIndex a valid index into the range of parameters of the given
457    method
458 
459    @since UDK 3.2.0
460  */
461 REGISTRY_DLLPUBLIC void SAL_CALL typereg_reader_getMethodParameterName(
462     void * handle, rtl_uString ** result, sal_uInt16 methodIndex,
463     sal_uInt16 parameterIndex)
464     SAL_THROW_EXTERN_C();
465 
466 /**
467    Returns the type name of a parameter of a method of a type reader.
468 
469    @param handle a handle on a type reader; must not be null
470 
471    @param result an out-parameter obtaining the parameter's type name string;
472    must not be null; if an out-of-memory condition occurs, a pointer to a null
473    pointer is returned
474 
475    @param methodIndex a valid index into the range of methods of the given type
476    reader
477 
478    @param parameterIndex a valid index into the range of parameters of the given
479    method
480 
481    @since UDK 3.2.0
482  */
483 REGISTRY_DLLPUBLIC void SAL_CALL typereg_reader_getMethodParameterTypeName(
484     void * handle, rtl_uString ** result, sal_uInt16 methodIndex,
485     sal_uInt16 parameterIndex)
486     SAL_THROW_EXTERN_C();
487 
488 /**
489    Returns the number of exceptions of a method of a type reader.
490 
491    @param handle a handle on a type reader; must not be null
492 
493    @param index a valid index into the range of methods of the given type reader
494 
495    @return the number of exceptions of the given method of the type reader
496 
497    @since UDK 3.2.0
498  */
499 REGISTRY_DLLPUBLIC sal_uInt16 SAL_CALL typereg_reader_getMethodExceptionCount(
500     void * handle, sal_uInt16 index) SAL_THROW_EXTERN_C();
501 
502 /**
503    Returns the type name of an exception of a method of a type reader.
504 
505    @param handle a handle on a type reader; must not be null
506 
507    @param result an out-parameter obtaining the exception's type name string;
508    must not be null; if an out-of-memory condition occurs, a pointer to a null
509    pointer is returned
510 
511    @param methodIndex a valid index into the range of methods of the given type
512    reader
513 
514    @param exceptionIndex a valid index into the range of exceptions of the given
515    method
516 
517    @since UDK 3.2.0
518  */
519 REGISTRY_DLLPUBLIC void SAL_CALL typereg_reader_getMethodExceptionTypeName(
520     void * handle, rtl_uString ** result, sal_uInt16 methodIndex,
521     sal_uInt16 exceptionIndex)
522     SAL_THROW_EXTERN_C();
523 
524 /**
525    Returns the number of references of a type reader.
526 
527    @param handle a handle on a type reader; may be null
528 
529    @return the number of references of the type reader; if <code>handle</code>
530    is null, zero is returned
531 
532    @since UDK 3.2.0
533  */
534 REGISTRY_DLLPUBLIC sal_uInt16 SAL_CALL typereg_reader_getReferenceCount(void * handle)
535     SAL_THROW_EXTERN_C();
536 
537 /**
538    Returns the documentation of a reference of a type reader.
539 
540    @param handle a handle on a type reader; must not be null
541 
542    @param result an out-parameter obtaining the reference's documentation
543    string; must not be null; if an out-of-memory condition occurs, a pointer to
544    a null pointer is returned
545 
546    @param index a valid index into the range of references of the given type
547    reader
548 
549    @since UDK 3.2.0
550  */
551 REGISTRY_DLLPUBLIC void SAL_CALL typereg_reader_getReferenceDocumentation(
552     void * handle, rtl_uString ** result, sal_uInt16 index)
553     SAL_THROW_EXTERN_C();
554 
555 /**
556    Returns the flags of a reference of a type reader.
557 
558    @param handle a handle on a type reader; must not be null
559 
560    @param index a valid index into the range of references of the given type
561    reader
562 
563    @return the flags of the given reference of the type reader
564 
565    @since UDK 3.2.0
566  */
567 REGISTRY_DLLPUBLIC RTFieldAccess SAL_CALL typereg_reader_getReferenceFlags(
568     void * handle, sal_uInt16 index) SAL_THROW_EXTERN_C();
569 
570 /**
571    Returns the sort of a reference of a type reader.
572 
573    @param handle a handle on a type reader; must not be null
574 
575    @param index a valid index into the range of references of the given type
576    reader
577 
578    @return the sort of the given reference of the type reader
579 
580    @since UDK 3.2.0
581  */
582 REGISTRY_DLLPUBLIC enum RTReferenceType SAL_CALL typereg_reader_getReferenceSort(
583     void * handle, sal_uInt16 index) SAL_THROW_EXTERN_C();
584 
585 /**
586    Returns the type name of a reference of a type reader.
587 
588    @param handle a handle on a type reader; must not be null
589 
590    @param result an out-parameter obtaining the reference's type name string;
591    must not be null; if an out-of-memory condition occurs, a pointer to a null
592    pointer is returned
593 
594    @param index a valid index into the range of references of the given type
595    reader
596 
597    @since UDK 3.2.0
598  */
599 REGISTRY_DLLPUBLIC void SAL_CALL typereg_reader_getReferenceTypeName(
600     void * handle, rtl_uString ** result, sal_uInt16 index)
601     SAL_THROW_EXTERN_C();
602 
603 #ifdef __cplusplus
604 }
605 #endif
606 
607 #endif
608