xref: /AOO41X/main/cppu/inc/typelib/typedescription.h (revision ca62e2c2083b5d0995f1245bad6c2edfb455fbec)
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 _TYPELIB_TYPEDESCRIPTION_H_
24 #define _TYPELIB_TYPEDESCRIPTION_H_
25 
26 #include <sal/types.h>
27 #include <typelib/uik.h>
28 #include <typelib/typeclass.h>
29 #include <rtl/ustring.h>
30 
31 #ifdef __cplusplus
32 extern "C"
33 {
34 #endif
35 
36 struct _typelib_TypeDescription;
37 
38 #if defined( SAL_W32)
39 #pragma pack(push, 8)
40 #elif defined(SAL_OS2)
41 #pragma pack(push, 8)
42 #endif
43 
44 /** Holds a weak reference to a type description.
45 */
46 typedef struct _typelib_TypeDescriptionReference
47 {
48     /** reference count of type; don't ever modify this by yourself, use
49         typelib_typedescriptionreference_acquire() and typelib_typedescriptionreference_release()
50     */
51     sal_Int32                           nRefCount;
52     /** number of static references of type, because of the fact that some types are needed
53         until program termination and are commonly held static.
54     */
55     sal_Int32                           nStaticRefCount;
56     /** type class of type
57     */
58     typelib_TypeClass                   eTypeClass;
59     /** fully qualified name of type
60     */
61     rtl_uString *                       pTypeName;
62     /** pointer to full typedescription; this value is only valid if the type is never swapped out
63     */
64     struct _typelib_TypeDescription *   pType;
65     /** pointer to optimize the runtime; not for public use
66     */
67     void *                              pUniqueIdentifier;
68     /** reserved for future use; 0 if not used
69     */
70     void *                              pReserved;
71 } typelib_TypeDescriptionReference;
72 
73 /** Full type description of a type. Memory layout of this struct is identical to the
74     typelib_TypeDescriptionReference for the first six members.
75     So a typedescription can be used as type reference.
76 */
77 typedef struct _typelib_TypeDescription
78 {
79     /** reference count; don't ever modify this by yourself, use
80         typelib_typedescription_acquire() and typelib_typedescription_release()
81     */
82     sal_Int32                           nRefCount;
83     /** number of static references of type, because of the fact that some types are needed
84         until program termination and are commonly held static.
85     */
86     sal_Int32                           nStaticRefCount;
87     /** type class of type
88     */
89     typelib_TypeClass                   eTypeClass;
90     /** fully qualified name of type
91     */
92     rtl_uString *                       pTypeName;
93     /** pointer to self to distinguish reference from description; for internal use only
94     */
95     struct _typelib_TypeDescription *   pSelf;
96     /** pointer to optimize the runtime; not for public use
97     */
98     void *                              pUniqueIdentifier;
99     /** reserved for future use; 0 if not used
100     */
101     void *                              pReserved;
102 
103     /** flag to determine whether the description is complete:
104         compound and union types lack of member names, enums lack of member types and names,
105         interfaces lack of members and table init.
106         Call typelib_typedescription_complete() if false.
107     */
108     sal_Bool                            bComplete;
109     /** size of type
110     */
111     sal_Int32                           nSize;
112     /** alignment of type
113     */
114     sal_Int32                           nAlignment;
115     /** pointer to weak reference
116     */
117     typelib_TypeDescriptionReference *  pWeakRef;
118     /** determines, if type can be unloaded (and it is possible to reloaded it)
119     */
120     sal_Bool                            bOnDemand;
121 } typelib_TypeDescription;
122 
123 /** Type description for exception types.
124 */
125 typedef struct _typelib_CompoundTypeDescription
126 {
127     /** inherits all members of typelib_TypeDescription
128     */
129     typelib_TypeDescription             aBase;
130 
131     /** pointer to base type description, else 0
132     */
133     struct _typelib_CompoundTypeDescription * pBaseTypeDescription;
134 
135     /** number of members
136     */
137     sal_Int32                           nMembers;
138     /** byte offsets of each member including the size the base type
139     */
140     sal_Int32 *                         pMemberOffsets;
141     /** members of the struct or exception
142     */
143     typelib_TypeDescriptionReference ** ppTypeRefs;
144     /** member names of the struct or exception
145     */
146     rtl_uString **                      ppMemberNames;
147 } typelib_CompoundTypeDescription;
148 
149 /**
150    Type description for struct types.
151 
152    This is only used to represent plain struct types and instantiated
153    polymorphic struct types; there is no representation of polymorphic struct
154    type templates at this level.
155 
156    @since UDK 3.2.0
157  */
158 typedef struct _typelib_StructTypeDescription
159 {
160     /**
161        Derived from typelib_CompoundTypeDescription.
162      */
163     typelib_CompoundTypeDescription aBase;
164 
165     /**
166        Flags for direct members, specifying whether they are of parameterized
167        type (true) or explict type (false).
168 
169        For a plain struct type, this is a null pointer.
170      */
171     sal_Bool * pParameterizedTypes;
172 } typelib_StructTypeDescription;
173 
174 /** Type description of a union. The type class of this description is typelib_TypeClass_UNION.
175 */
176 typedef struct _typelib_UnionTypeDescription
177 {
178     /** inherits all members of typelib_TypeDescription
179     */
180     typelib_TypeDescription             aBase;
181 
182     /** type of the discriminant
183     */
184     typelib_TypeDescriptionReference *  pDiscriminantTypeRef;
185 
186     /** union default descriminant
187     */
188     sal_Int64                           nDefaultDiscriminant;
189     /** union default member type (may be 0)
190      */
191     typelib_TypeDescriptionReference *  pDefaultTypeRef;
192     /** number of union member types
193     */
194     sal_Int32                           nMembers;
195     /** union member discriminant values (same order as idl declaration)
196     */
197     sal_Int64 *                         pDiscriminants;
198     /** union member value types (same order as idl declaration)
199     */
200     typelib_TypeDescriptionReference ** ppTypeRefs;
201     /** union member value names (same order as idl declaration)
202     */
203     rtl_uString **                      ppMemberNames;
204     /** union value offset for data access
205     */
206     sal_Int32                           nValueOffset;
207 } typelib_UnionTypeDescription;
208 
209 /** Type description of an array or sequence.
210 */
211 typedef struct _typelib_IndirectTypeDescription
212 {
213     /** inherits all members of typelib_TypeDescription
214     */
215     typelib_TypeDescription             aBase;
216 
217     /** array, sequence: pointer to element type
218     */
219     typelib_TypeDescriptionReference *  pType;
220 } typelib_IndirectTypeDescription;
221 
222 /** Type description of an array.
223 */
224 typedef struct _typelib_ArrayTypeDescription
225 {
226     /** inherits all members of typelib_IndirectTypeDescription
227     */
228     typelib_IndirectTypeDescription     aBase;
229 
230     /** number of dimensions
231     */
232     sal_Int32                           nDimensions;
233     /** number of total array elements
234     */
235     sal_Int32                           nTotalElements;
236     /** array of dimensions
237     */
238     sal_Int32 *                         pDimensions;
239 } typelib_ArrayTypeDescription;
240 
241 /** Type description of an enum. The type class of this description is typelib_TypeClass_ENUM.
242 */
243 typedef struct _typelib_EnumTypeDescription
244 {
245     /** inherits all members of typelib_TypeDescription
246     */
247     typelib_TypeDescription             aBase;
248 
249     /** first value of the enum
250     */
251     sal_Int32                           nDefaultEnumValue;
252     /** number of enum values
253     */
254     sal_Int32                           nEnumValues;
255     /** names of enum values
256     */
257     rtl_uString **                      ppEnumNames;
258     /** values of enum (corresponding to names in similar order)
259     */
260     sal_Int32 *                         pEnumValues;
261 } typelib_EnumTypeDescription;
262 
263 /** Description of an interface method parameter.
264 */
265 typedef struct _typelib_MethodParameter
266 {
267     /** name of parameter
268     */
269     rtl_uString *                       pName;
270     /** type of parameter
271     */
272     typelib_TypeDescriptionReference *  pTypeRef;
273     /** true: the call type of this parameter is [in] or [inout]
274         false: the call type of this parameter is [out]
275     */
276     sal_Bool                            bIn;
277     /** true: the call type of this parameter is [out] or [inout]
278         false: the call type of this parameter is [in]
279     */
280     sal_Bool                            bOut;
281 } typelib_MethodParameter;
282 
283 /** Common base type description of typelib_InterfaceMethodTypeDescription and
284     typelib_InterfaceAttributeTypeDescription.
285 */
286 typedef struct _typelib_InterfaceMemberTypeDescription
287 {
288     /** inherits all members of typelib_TypeDescription
289     */
290     typelib_TypeDescription             aBase;
291 
292     /** position of member in the interface including the number of members of
293         any base interfaces
294     */
295     sal_Int32                           nPosition;
296     /** name of member
297     */
298     rtl_uString *                       pMemberName;
299 } typelib_InterfaceMemberTypeDescription;
300 
301 /** Type description of an interface method. The type class of this description is
302     typelib_TypeClass_INTERFACE_METHOD. The size and the alignment are 0.
303 */
304 typedef struct _typelib_InterfaceMethodTypeDescription
305 {
306     /** inherits all members of typelib_InterfaceMemberTypeDescription
307     */
308     typelib_InterfaceMemberTypeDescription      aBase;
309 
310     /** type of the return value
311     */
312     typelib_TypeDescriptionReference *          pReturnTypeRef;
313     /** number of parameters
314     */
315     sal_Int32                                   nParams;
316     /** array of parameters
317     */
318     typelib_MethodParameter *                   pParams;
319     /** number of exceptions
320     */
321     sal_Int32                                   nExceptions;
322     /** array of exception types
323     */
324     typelib_TypeDescriptionReference **         ppExceptions;
325     /** determines whether method is declared oneway
326     */
327     sal_Bool                                    bOneWay;
328 
329     /** the interface description this method is a member of
330 
331         @since #i21150#
332     */
333     struct _typelib_InterfaceTypeDescription *  pInterface;
334     /** the inherited direct base method (null for a method that is not
335         inherited)
336 
337         @since UDK 3.2.0
338     */
339     typelib_TypeDescriptionReference *          pBaseRef;
340     /** if pBaseRef is null, the member position of this method within
341         pInterface, not counting members inherited from bases; if pBaseRef is
342         not null, the index of the direct base within pInterface from which this
343         method is inherited
344 
345         @since UDK 3.2.0
346     */
347     sal_Int32                                   nIndex;
348 } typelib_InterfaceMethodTypeDescription;
349 
350 /** The description of an interface attribute. The type class of this description is
351     typelib_TypeClass_INTERFACE_ATTRIBUTE. The size and the alignment are 0.
352 */
353 typedef struct _typelib_InterfaceAttributeTypeDescription
354 {
355     /** inherits all members of typelib_InterfaceMemberTypeDescription
356     */
357     typelib_InterfaceMemberTypeDescription      aBase;
358 
359     /** determines whether attribute is read only
360     */
361     sal_Bool                                    bReadOnly;
362     /** type of the attribute
363     */
364     typelib_TypeDescriptionReference *          pAttributeTypeRef;
365 
366     /** the interface description this attribute is a member of
367 
368         @since #i21150#
369     */
370     struct _typelib_InterfaceTypeDescription *  pInterface;
371     /** the inherited direct base attribute (null for an attribute that is not
372         inherited)
373 
374         @since UDK 3.2.0
375     */
376     typelib_TypeDescriptionReference *          pBaseRef;
377     /** if pBaseRef is null, the member position of this attribute within
378         pInterface, not counting members inherited from bases; if pBaseRef is
379         not null, the index of the direct base within pInterface from which this
380         attribute is inherited
381 
382         @since UDK 3.2.0
383     */
384     sal_Int32                                   nIndex;
385     /** number of getter exceptions
386 
387         @since UDK 3.2.0
388     */
389     sal_Int32                                   nGetExceptions;
390     /** array of getter exception types
391 
392         @since UDK 3.2.0
393     */
394     typelib_TypeDescriptionReference **         ppGetExceptions;
395     /** number of setter exceptions
396 
397         @since UDK 3.2.0
398     */
399     sal_Int32                                   nSetExceptions;
400     /** array of setter exception types
401 
402         @since UDK 3.2.0
403     */
404     typelib_TypeDescriptionReference **         ppSetExceptions;
405 } typelib_InterfaceAttributeTypeDescription;
406 
407 /// @HTML
408 /** Type description of an interface.
409 
410     <p>Not all members are always initialized (not yet initialized members being
411     null); there are three levels:</p>
412     <ul>
413         <li>Minimally, only <code>aBase</code>,
414         <code>pBaseTypeDescription</code>, <code>aUik</code>,
415         <code>nBaseTypes</code>, and <code>ppBaseTypes</code> are initialized;
416         <code>aBase.bComplete</code> is false.  This only happens when an
417         interface type description is created with
418         <code>typelib_static_mi_interface_type_init</code> or
419         <code>typelib_static_interface_type_init</code>.</li>
420 
421         <li>At the next level, <code>nMembers</code>, <code>ppMembers</code>,
422         <code>nAllMembers</code>, <code>ppAllMembers</code> are also
423         initialized; <code>aBase.bComplete</code> is still false.  This happens
424         when an interface type description is created with
425         <code>typelib_typedescription_newMIInterface</cocde> or
426         <code>typelib_typedescription_newInterface</code>.</li>
427 
428         <li>At the final level, <code>pMapMemberIndexToFunctionIndex</code>,
429         <code>nMapFunctionIndexToMemberIndex</code>, and
430         <code>pMapFunctionIndexToMemberIndex</code> are also initialized;
431         <code>aBase.bComplete</code> is true.  This happens after a call to
432         <code>typelib_typedescription_complete</code>.</li>
433     </ul>
434 */
435 typedef struct _typelib_InterfaceTypeDescription
436 /// @NOHTML
437 {
438     /** inherits all members of typelib_TypeDescription
439     */
440     typelib_TypeDescription                     aBase;
441 
442     /** pointer to base type description, else 0
443 
444         @deprecated
445         use nBaseTypes and ppBaseTypes instead
446     */
447     struct _typelib_InterfaceTypeDescription *  pBaseTypeDescription;
448     /** unique identifier of interface
449     */
450     typelib_Uik                                 aUik;
451     /** number of members
452     */
453     sal_Int32                                   nMembers;
454     /** array of members; references attributes or methods
455     */
456     typelib_TypeDescriptionReference **         ppMembers;
457     /** number of members including members of base interface
458     */
459     sal_Int32                                   nAllMembers;
460     /** array of members including members of base interface; references attributes or methods
461     */
462     typelib_TypeDescriptionReference **         ppAllMembers;
463     /** array mapping index of the member description to an index doubling for read-write
464         attributes (called function index); size of array is nAllMembers
465     */
466     sal_Int32 *                                 pMapMemberIndexToFunctionIndex;
467     /** number of members plus number of read-write attributes
468     */
469     sal_Int32                                   nMapFunctionIndexToMemberIndex;
470     /** array mapping function index to member index; size of arry is nMapFunctionIndexToMemberIndex
471     */
472     sal_Int32 *                                 pMapFunctionIndexToMemberIndex;
473     /** number of base types
474 
475         @since UDK 3.2.0
476     */
477     sal_Int32                                   nBaseTypes;
478     /** array of base type descriptions
479 
480         @since UDK 3.2.0
481     */
482     struct _typelib_InterfaceTypeDescription ** ppBaseTypes;
483 } typelib_InterfaceTypeDescription;
484 
485 /** Init struct of compound members for typelib_typedescription_new().
486 */
487 typedef struct _typelib_CompoundMember_Init
488 {
489     /** type class of compound member
490     */
491     typelib_TypeClass   eTypeClass;
492     /** name of type of compound member
493 
494         For a member of an instantiated polymorphic struct type that is of
495         parameterized type, this will be a null pointer.
496     */
497     rtl_uString *       pTypeName;
498     /** name of compound member
499     */
500     rtl_uString *       pMemberName;
501 } typelib_CompoundMember_Init;
502 
503 /**
504    Init struct of members for typelib_typedescription_newStruct().
505 
506    @since UDK 3.2.0
507  */
508 typedef struct _typelib_StructMember_Init
509 {
510     /**
511        Derived from typelib_CompoundMember_Init;
512      */
513     typelib_CompoundMember_Init aBase;
514 
515     /**
516        Flag specifying whether the member is of parameterized type (true) or
517        explict type (false).
518      */
519     sal_Bool bParameterizedType;
520 } typelib_StructMember_Init;
521 
522 /** Init struct of interface methods for typelib_typedescription_new().
523 */
524 typedef struct _typelib_Parameter_Init
525 {
526     /** type class of parameter
527     */
528     typelib_TypeClass   eTypeClass;
529     /** name of parameter
530     */
531     rtl_uString *       pTypeName;
532     /** name of parameter
533     */
534     rtl_uString *       pParamName;
535     /** true, if parameter is [in] or [inout]
536     */
537     sal_Bool            bIn;
538     /** true, if parameter is [out] or [inout]
539     */
540     sal_Bool            bOut;
541 } typelib_Parameter_Init;
542 
543 /** Init struct of union types for typelib_typedescription_newUnion().
544 */
545 typedef struct _typelib_Union_Init
546 {
547     /** union member discriminant
548     */
549     sal_Int64           nDiscriminant;
550     /** union member name
551     */
552     rtl_uString *       pMemberName;
553     /** union member type
554     */
555     typelib_TypeDescriptionReference* pTypeRef;
556 } typelib_Union_Init;
557 
558 #if defined( SAL_W32) ||  defined(SAL_OS2)
559 #pragma pack(pop)
560 #endif
561 
562 
563 /** Creates a union type description. All discriminants are handled as int64 values.
564     The pDiscriminantTypeRef must be of type byte, short, ..., up to hyper.
565 
566     @param ppRet inout union type description
567     @param pTypeName name of union type
568     @param pDiscriminantTypeRef discriminant type
569     @param nDefaultDiscriminant default discriminant
570     @param pDefaultTypeRef default value type of union
571     @param nMembers number of union members
572     @param pMembers init members
573 */
574 void SAL_CALL typelib_typedescription_newUnion(
575     typelib_TypeDescription ** ppRet,
576     rtl_uString * pTypeName,
577     typelib_TypeDescriptionReference * pDiscriminantTypeRef,
578     sal_Int64 nDefaultDiscriminant,
579     typelib_TypeDescriptionReference * pDefaultTypeRef,
580     sal_Int32 nMembers,
581     typelib_Union_Init * pMembers )
582     SAL_THROW_EXTERN_C();
583 
584 /** Creates an enum type description.
585 
586     @param ppRet inout enum type description
587     @param pTypeName name of enum
588     @param nDefaultEnumValue default enum value
589     @param nEnumValues number of enum values
590     @param ppEnumNames names of enum values
591     @param pEnumValues enum values
592 */
593 void SAL_CALL typelib_typedescription_newEnum(
594     typelib_TypeDescription ** ppRet,
595     rtl_uString * pTypeName,
596     sal_Int32 nDefaultValue,
597     sal_Int32 nEnumValues,
598     rtl_uString ** ppEnumNames,
599     sal_Int32 * pEnumValues )
600     SAL_THROW_EXTERN_C();
601 
602 /** Creates an array type description.
603 
604     @param ppRet inout enum type description
605     @param pElementTypeRef element type
606     @param nDimensions number of dimensions
607     @param pDimensions dimensions
608 */
609 void SAL_CALL typelib_typedescription_newArray(
610     typelib_TypeDescription ** ppRet,
611     typelib_TypeDescriptionReference * pElementTypeRef,
612     sal_Int32 nDimensions,
613     sal_Int32 * pDimensions )
614     SAL_THROW_EXTERN_C ();
615 
616 /** Creates a new type description.
617 
618     Since this function can only be used to create type descriptions for plain
619     struct types, not for instantiated polymorphic struct types, the function
620     typelib_typedescription_newStruct should be used instead for all struct
621     types.
622 
623     @param ppRet inout type description
624     @param eTypeClass type class
625     @param pTypeName name of type
626     @param pType sequence, array: element type;
627                  struct, Exception: base type;
628     @param nMembers number of members if struct, exception
629     @param pMember array of members if struct, exception
630 */
631 void SAL_CALL typelib_typedescription_new(
632     typelib_TypeDescription ** ppRet,
633     typelib_TypeClass eTypeClass,
634     rtl_uString * pTypeName,
635     typelib_TypeDescriptionReference * pType,
636     sal_Int32 nMembers,
637     typelib_CompoundMember_Init * pMembers )
638     SAL_THROW_EXTERN_C();
639 
640 /** Creates a new struct type description.
641 
642     @param ppRet inout type description
643     @param pTypeName name of type
644     @param pType base type;
645     @param nMembers number of members
646     @param pMember array of members
647 
648     @since UDK 3.2.0
649 */
650 void SAL_CALL typelib_typedescription_newStruct(
651     typelib_TypeDescription ** ppRet,
652     rtl_uString * pTypeName,
653     typelib_TypeDescriptionReference * pType,
654     sal_Int32 nMembers,
655     typelib_StructMember_Init * pMembers )
656     SAL_THROW_EXTERN_C();
657 
658 /** Creates an interface type description.
659 
660     @param ppRet inout interface type description
661     @param pTypeName the fully qualified name of the interface.
662     @param nUik1 uik part
663     @param nUik2 uik part
664     @param nUik3 uik part
665     @param nUik4 uik part
666     @param nUik5 uik part
667     @param pBaseInterface base interface type, else 0
668     @param nMembers number of members
669     @param ppMembers members; attributes or methods
670 
671     @deprecated
672     use typelib_typedescription_newMIInterface instead
673 */
674 void SAL_CALL typelib_typedescription_newInterface(
675     typelib_InterfaceTypeDescription ** ppRet,
676     rtl_uString * pTypeName,
677     sal_uInt32 nUik1, sal_uInt16 nUik2, sal_uInt16 nUik3, sal_uInt32 nUik4, sal_uInt32 nUik5,
678     typelib_TypeDescriptionReference * pBaseInterface,
679     sal_Int32 nMembers,
680     typelib_TypeDescriptionReference ** ppMembers )
681     SAL_THROW_EXTERN_C();
682 
683 /** Creates a multiple-inheritance interface type description.
684 
685     @param ppRet inout interface type description
686     @param pTypeName the fully qualified name of the interface.
687     @param nUik1 uik part
688     @param nUik2 uik part
689     @param nUik3 uik part
690     @param nUik4 uik part
691     @param nUik5 uik part
692     @param nBaseInterfaces number of base interface types
693     @param ppBaseInterface base interface types
694     @param nMembers number of members
695     @param ppMembers members; attributes or methods
696 
697     @since UDK 3.2.0
698 */
699 void SAL_CALL typelib_typedescription_newMIInterface(
700     typelib_InterfaceTypeDescription ** ppRet,
701     rtl_uString * pTypeName,
702     sal_uInt32 nUik1, sal_uInt16 nUik2, sal_uInt16 nUik3, sal_uInt32 nUik4, sal_uInt32 nUik5,
703     sal_Int32 nBaseInterfaces,
704     typelib_TypeDescriptionReference ** ppBaseInterfaces,
705     sal_Int32 nMembers,
706     typelib_TypeDescriptionReference ** ppMembers )
707     SAL_THROW_EXTERN_C();
708 
709 /** Creates an interface method type description.
710 
711     @param ppRet inout method type description
712     @param nAbsolutePosition position of member including all members of base interfaces
713     @param bOneWay determines whether method is declared oneway
714     @param pTypeName fully qualified name of method including interface name
715     @param eReturnTypeClass type class of return type
716     @param pReturnTypeName type name of the return type
717     @param nParams number of parameters
718     @param pParams parameter types
719     @param nExceptions number of exceptions
720     @param ppExceptionNames type names of exceptions
721 */
722 void SAL_CALL typelib_typedescription_newInterfaceMethod(
723     typelib_InterfaceMethodTypeDescription ** ppRet,
724     sal_Int32 nAbsolutePosition,
725     sal_Bool bOneWay,
726     rtl_uString * pMethodName,
727     typelib_TypeClass eReturnTypeClass,
728     rtl_uString * pReturnTypeName,
729     sal_Int32 nParams,
730     typelib_Parameter_Init * pParams,
731     sal_Int32 nExceptions,
732     rtl_uString ** ppExceptionNames )
733     SAL_THROW_EXTERN_C();
734 
735 /** Creates an interface attribute type description.
736 
737     @param ppRet inout attribute type description
738     @param nAbsolutePosition position of this attribute including all members of base interfaces
739     @param pAttributeName fully qualified name of attribute including interface
740     name
741     @param eAttributeTypeClass type class of attribute type
742     @param pAttributeTypeName type name of attribute type
743     @param bReadOnly determines whether attribute is read-only
744 
745     @deprecated
746     use typelib_typedescription_newExtendedInterfaceAttribute instead
747 */
748 void SAL_CALL typelib_typedescription_newInterfaceAttribute(
749     typelib_InterfaceAttributeTypeDescription ** ppRet,
750     sal_Int32 nAbsolutePosition,
751     rtl_uString * pAttributeName,
752     typelib_TypeClass eAttributeTypeClass,
753     rtl_uString * pAttributeTypeName,
754     sal_Bool bReadOnly )
755     SAL_THROW_EXTERN_C();
756 
757 /** Creates an extended interface attribute type description.
758 
759     @param ppRet inout attribute type description
760     @param nAbsolutePosition position of this attribute including all members of
761     base interfaces
762     @param pAttributeName fully qualified name of attribute including interface
763     name
764     @param eAttributeTypeClass type class of attribute type
765     @param pAttributeTypeName type name of attribute type
766     @param bReadOnly determines whether attribute is read-only
767     @param nGetExceptions number of getter exceptions
768     @param ppGetExceptionNames type names of getter exceptions
769     @param nSetExceptions number of setter exceptions
770     @param ppSetExceptionNames type names of setter exceptions
771 
772     @since UDK 3.2.0
773 */
774 void SAL_CALL typelib_typedescription_newExtendedInterfaceAttribute(
775     typelib_InterfaceAttributeTypeDescription ** ppRet,
776     sal_Int32 nAbsolutePosition,
777     rtl_uString * pAttributeName,
778     typelib_TypeClass eAttributeTypeClass,
779     rtl_uString * pAttributeTypeName,
780     sal_Bool bReadOnly,
781     sal_Int32 nGetExceptions, rtl_uString ** ppGetExceptionNames,
782     sal_Int32 nSetExceptions, rtl_uString ** ppSetExceptionNames )
783     SAL_THROW_EXTERN_C();
784 
785 /** Increments reference count of given type description.
786 
787     @param pDesc type description
788 */
789 void SAL_CALL typelib_typedescription_acquire(
790     typelib_TypeDescription * pDesc )
791     SAL_THROW_EXTERN_C();
792 
793 /** Decrements reference count of given type. If reference count reaches 0, the trype description
794     is deleted.
795 
796     @param pDesc type description
797 */
798 void SAL_CALL typelib_typedescription_release(
799     typelib_TypeDescription * pDesc )
800     SAL_THROW_EXTERN_C();
801 
802 /** Registers a type description and creates a type description reference. Type descriptions
803     will be registered automatically if they are provided via the callback chain.
804 
805     @param ppNewDescription inout description to be registered;
806 */
807 void SAL_CALL typelib_typedescription_register(
808     typelib_TypeDescription ** ppNewDescription )
809     SAL_THROW_EXTERN_C();
810 
811 /** Tests whether two types descriptions are equal, i.e. type class and names are equal.
812 
813     @param p1 a type description
814     @param p2 another type description
815     @return true, if type descriptions are equal
816 */
817 sal_Bool SAL_CALL typelib_typedescription_equals(
818     const typelib_TypeDescription * p1, const typelib_TypeDescription * p2 )
819     SAL_THROW_EXTERN_C();
820 
821 /** Retrieves a type description via its fully qualified name.
822 
823     @param ppRet inout type description; *ppRet is 0, if type description was not found
824     @param pName name demanded type description
825 */
826 void SAL_CALL typelib_typedescription_getByName(
827     typelib_TypeDescription ** ppRet, rtl_uString * pName )
828     SAL_THROW_EXTERN_C();
829 
830 /** Sets size of type description cache.
831 
832     @param nNewSize new size of cache
833 */
834 void SAL_CALL typelib_setCacheSize(
835     sal_Int32 nNewSize )
836     SAL_THROW_EXTERN_C();
837 
838 /** Function pointer declaration of callback function get additional descriptions. Callbacks
839     must provide complete type descriptions (see typelib_typedescription_complete())!
840 
841     @param pContext callback context
842     @param ppRet inout type description
843     @param pTypeName  name of demanded type description
844 */
845 typedef void (SAL_CALL * typelib_typedescription_Callback)(
846     void * pContext, typelib_TypeDescription ** ppRet, rtl_uString * pTypeName );
847 
848 /** Registers callback function providing additional type descriptions.
849 
850     @param pContext callback context
851     @param pCallback callback function
852 */
853 void SAL_CALL typelib_typedescription_registerCallback(
854     void * pContext, typelib_typedescription_Callback pCallback )
855     SAL_THROW_EXTERN_C();
856 
857 /** Revokes a previously registered callback function.
858 
859     @param pContext callback context
860     @param pCallback registered callback function
861 */
862 void SAL_CALL typelib_typedescription_revokeCallback(
863     void * pContext, typelib_typedescription_Callback pCallback )
864     SAL_THROW_EXTERN_C();
865 
866 
867 /*----------------------------------------------------------------------------*/
868 /*----------------------------------------------------------------------------*/
869 /*----------------------------------------------------------------------------*/
870 
871 /** Creates a type description reference. This is a weak reference not holding the description.
872     If the description is already registered, the previous one is returned.
873 
874     @param ppTDR inout type description reference
875     @param eTypeClass type class of type
876     @param pTypeName name of type
877 */
878 void SAL_CALL typelib_typedescriptionreference_new(
879     typelib_TypeDescriptionReference ** ppTDR,
880     typelib_TypeClass eTypeClass,
881     rtl_uString * pTypeName )
882     SAL_THROW_EXTERN_C();
883 
884 /** Creates a type description reference. This is a weak reference not holding the description.
885     If the description is already registered, the previous one is returned.
886 
887     @param ppTDR inout type description reference
888     @param eTypeClass type class of type
889     @param pTypeName ascii name of type
890 */
891 void SAL_CALL typelib_typedescriptionreference_newByAsciiName(
892     typelib_TypeDescriptionReference ** ppTDR,
893     typelib_TypeClass eTypeClass,
894     const sal_Char * pTypeName )
895     SAL_THROW_EXTERN_C();
896 
897 /** Increments reference count of type description reference.
898 
899     @param pRef type description reference
900 */
901 void SAL_CALL typelib_typedescriptionreference_acquire(
902     typelib_TypeDescriptionReference * pRef )
903     SAL_THROW_EXTERN_C();
904 
905 /** Increments reference count of type description reference. If the reference count reaches 0,
906     then the reference is deleted.
907 
908     @param pRef type description reference
909 */
910 void SAL_CALL typelib_typedescriptionreference_release(
911     typelib_TypeDescriptionReference * pRef )
912     SAL_THROW_EXTERN_C();
913 
914 /** Retrieves the type description for a given reference. If it is not possible to resolve the
915     reference, null is returned.
916 
917     @param ppRet inout type description
918 */
919 void SAL_CALL typelib_typedescriptionreference_getDescription(
920     typelib_TypeDescription ** ppRet, typelib_TypeDescriptionReference * pRef )
921     SAL_THROW_EXTERN_C();
922 
923 /** Tests whether two types description references are equal, i.e. type class and names are equal.
924 
925     @param p1 a type description reference
926     @param p2 another type description reference
927     @return true, if type description references are equal
928 */
929 sal_Bool SAL_CALL typelib_typedescriptionreference_equals(
930     const typelib_TypeDescriptionReference * p1, const typelib_TypeDescriptionReference * p2 )
931     SAL_THROW_EXTERN_C();
932 
933 /** Assigns a type.
934 
935     @param ppDest destination type
936     @param pSource source type
937 */
938 void SAL_CALL typelib_typedescriptionreference_assign(
939     typelib_TypeDescriptionReference ** ppDest,
940     typelib_TypeDescriptionReference * pSource )
941     SAL_THROW_EXTERN_C();
942 
943 /** Tests if values of type pAssignable can be assigned by values of type pFrom. This includes
944     widening conversion (e.g., long assignable from short), as long as there is no data loss.
945 
946     @param pAssignable type description of value to be assigned
947     @param pFrom type description of value
948 */
949 sal_Bool SAL_CALL typelib_typedescription_isAssignableFrom(
950     typelib_TypeDescription * pAssignable,
951     typelib_TypeDescription * pFrom )
952     SAL_THROW_EXTERN_C();
953 
954 /** Tests if values of type pAssignable can be assigned by values of type pFrom. This includes
955     widening conversion (e.g., long assignable from short), as long as there is no data loss.
956 
957     @param pAssignable type of value to be assigned
958     @param pFrom type of value
959 */
960 sal_Bool SAL_CALL typelib_typedescriptionreference_isAssignableFrom(
961     typelib_TypeDescriptionReference * pAssignable,
962     typelib_TypeDescriptionReference * pFrom )
963     SAL_THROW_EXTERN_C();
964 
965 /** Gets static type reference of standard types by type class.
966     ADDITIONAL OPT: provides Type com.sun.star.uno.Exception for typelib_TypeClass_EXCEPTION
967                     and com.sun.star.uno.XInterface for typelib_TypeClass_INTERFACE.
968 
969     Thread synchronizes on typelib mutex.
970 
971     @param eTypeClass type class of basic type
972     @return pointer to type reference pointer
973 */
974 typelib_TypeDescriptionReference ** SAL_CALL typelib_static_type_getByTypeClass(
975     typelib_TypeClass eTypeClass )
976     SAL_THROW_EXTERN_C();
977 
978 /** Inits static type reference. Thread synchronizes on typelib init mutex.
979 
980     @param ppRef pointer to type reference pointer
981     @param eTypeClass type class of type
982     @param pTypeName ascii name of type
983 */
984 void SAL_CALL typelib_static_type_init(
985     typelib_TypeDescriptionReference ** ppRef,
986     typelib_TypeClass eTypeClass, const sal_Char * pTypeName )
987     SAL_THROW_EXTERN_C();
988 
989 /** Inits static sequence type reference. Thread synchronizes on typelib init mutex.
990 
991     @param ppRef pointer to type reference pointer
992     @param pElementType element type of sequence
993 */
994 void SAL_CALL typelib_static_sequence_type_init(
995     typelib_TypeDescriptionReference ** ppRef,
996     typelib_TypeDescriptionReference * pElementType )
997     SAL_THROW_EXTERN_C ();
998 
999 /** Inits static array type reference. Thread synchronizes on typelib init mutex.
1000 
1001     @param ppRef pointer to type reference pointer
1002     @param pElementType element type of sequence
1003     @param nDimensions number of dimensions
1004     @param ... additional sal_Int32 parameter for each dimension
1005 */
1006 void SAL_CALL typelib_static_array_type_init(
1007     typelib_TypeDescriptionReference ** ppRef,
1008     typelib_TypeDescriptionReference * pElementType,
1009     sal_Int32 nDimensions, ... )
1010     SAL_THROW_EXTERN_C ();
1011 
1012 /** Inits incomplete static compound type reference. Thread synchronizes on typelib init mutex.
1013 
1014     Since this function can only be used to create type descriptions for plain
1015     struct types, not for instantiated polymorphic struct types, the function
1016     typelib_static_struct_type_init should be used instead for all struct types.
1017 
1018     @param ppRef pointer to type reference pointer
1019     @param eTypeClass typelib_TypeClass_STRUCT or typelib_TypeClass_EXCEPTION
1020     @param pTypeName name of type
1021     @param pBaseType base type
1022     @param nMembers number of members
1023     @param ppMembers member types
1024 */
1025 void SAL_CALL typelib_static_compound_type_init(
1026     typelib_TypeDescriptionReference ** ppRef,
1027     typelib_TypeClass eTypeClass, const sal_Char * pTypeName,
1028     typelib_TypeDescriptionReference * pBaseType,
1029     sal_Int32 nMembers, typelib_TypeDescriptionReference ** ppMembers )
1030     SAL_THROW_EXTERN_C();
1031 
1032 /** Inits incomplete static struct type reference.
1033 
1034     Thread synchronizes on typelib init mutex.
1035 
1036     @param ppRef pointer to type reference pointer
1037     @param pTypeName name of type
1038     @param pBaseType base type
1039     @param nMembers number of members
1040     @param ppMembers member types
1041     @param pParameterizedTypes flags for direct members, specifying whether they
1042         are of parameterized type (true) or explict type (false); must be null
1043         for a plain struct type
1044 
1045     @since UDK 3.2.0
1046 */
1047 void SAL_CALL typelib_static_struct_type_init(
1048     typelib_TypeDescriptionReference ** ppRef, const sal_Char * pTypeName,
1049     typelib_TypeDescriptionReference * pBaseType,
1050     sal_Int32 nMembers, typelib_TypeDescriptionReference ** ppMembers,
1051     sal_Bool const * pParameterizedTypes )
1052     SAL_THROW_EXTERN_C();
1053 
1054 /** Inits incomplete static interface type reference. Thread synchronizes on typelib init mutex.
1055 
1056     @param ppRef pointer to type reference pointer
1057     @param pTypeName name of interface
1058     @param pBaseType base type
1059 */
1060 void SAL_CALL typelib_static_interface_type_init(
1061     typelib_TypeDescriptionReference ** ppRef,
1062     const sal_Char * pTypeName,
1063     typelib_TypeDescriptionReference * pBaseType )
1064     SAL_THROW_EXTERN_C();
1065 
1066 /** Inits incomplete static multiple-inheritance interface type reference.
1067     Thread synchronizes on typelib init mutex.
1068 
1069     @param ppRef pointer to type reference pointer
1070     @param pTypeName name of interface
1071     @param nBaseTypes number of base types
1072     @param ppBaseTypes base types
1073 
1074     @since UDK 3.2.0
1075 */
1076 void SAL_CALL typelib_static_mi_interface_type_init(
1077     typelib_TypeDescriptionReference ** ppRef,
1078     const sal_Char * pTypeName,
1079     sal_Int32 nBaseTypes,
1080     typelib_TypeDescriptionReference ** ppBaseTypes )
1081     SAL_THROW_EXTERN_C();
1082 
1083 /** Inits incomplete static enum type reference. Thread synchronizes on typelib init mutex.
1084 
1085     @param ppRef pointer to type reference pointer
1086     @param pTypeName name of enum
1087     @param nDefaultEnumValue default enum value
1088 */
1089 void SAL_CALL typelib_static_enum_type_init(
1090     typelib_TypeDescriptionReference ** ppRef,
1091     const sal_Char * pTypeName,
1092     sal_Int32 nDefaultValue )
1093     SAL_THROW_EXTERN_C();
1094 
1095 /** Completes a typedescription to be used for, e.g., marshalling values. COMPOUND, UNION,
1096     INTERFACE and ENUM type descriptions may be partly initialized (see typelib_static_...(),
1097     typelib_TypeDescription::bComplete). For interface type descriptions, this will also
1098     init index tables.
1099 
1100     @param ppTypeDescr [inout] type description to be completed (may be exchanged!)
1101     @return true, if type description is complete
1102 */
1103 sal_Bool SAL_CALL typelib_typedescription_complete(
1104     typelib_TypeDescription ** ppTypeDescr )
1105     SAL_THROW_EXTERN_C();
1106 
1107 /** Returns true, if the type description reference may lose the type description. Otherwise
1108     pType is a valid pointer and cannot be discarded through the lifetime of this reference.
1109     Remark: If the pWeakObj of the type is set too, you can avoid the call of
1110     ...getDescription(...) and use the description directly. pWeakObj == 0 means, that the
1111     description is not initialized.
1112     @internal
1113 */
TYPELIB_TYPEDESCRIPTIONREFERENCE_ISREALLYWEAK(_typelib_TypeClass eTypeClass)1114 inline bool TYPELIB_TYPEDESCRIPTIONREFERENCE_ISREALLYWEAK( _typelib_TypeClass eTypeClass )
1115 {
1116     return (eTypeClass == typelib_TypeClass_INTERFACE_METHOD) ||
1117      (eTypeClass == typelib_TypeClass_INTERFACE_ATTRIBUTE);
1118 }
1119 
1120 /** Gets a description from the reference. The description may not be locked by this call.
1121     You must use the TYPELIB_DANGER_RELEASE macro to release the description fetched with
1122     this macro.
1123     @internal
1124 */
TYPELIB_DANGER_GET(typelib_TypeDescription ** ppMacroTypeDescr,typelib_TypeDescriptionReference * pMacroTypeRef)1125 inline void TYPELIB_DANGER_GET( typelib_TypeDescription** ppMacroTypeDescr,
1126     typelib_TypeDescriptionReference* pMacroTypeRef )
1127 {
1128     if (TYPELIB_TYPEDESCRIPTIONREFERENCE_ISREALLYWEAK( pMacroTypeRef->eTypeClass ))
1129     {
1130         typelib_typedescriptionreference_getDescription( ppMacroTypeDescr, pMacroTypeRef );
1131     }
1132     else if (!pMacroTypeRef->pType || !pMacroTypeRef->pType->pWeakRef)
1133     {
1134         typelib_typedescriptionreference_getDescription( ppMacroTypeDescr, pMacroTypeRef );
1135         if (*ppMacroTypeDescr)
1136         typelib_typedescription_release( *ppMacroTypeDescr );
1137     }
1138     else
1139     {
1140         *ppMacroTypeDescr = pMacroTypeRef->pType;
1141     }
1142 }
1143 
1144 /** Releases the description previouse fetched by TYPELIB_DANGER_GET.
1145     @internal
1146 */
TYPELIB_DANGER_RELEASE(typelib_TypeDescription * pDescription)1147 inline void TYPELIB_DANGER_RELEASE( typelib_TypeDescription* pDescription )
1148 {
1149     if (TYPELIB_TYPEDESCRIPTIONREFERENCE_ISREALLYWEAK( pDescription->eTypeClass ))
1150         typelib_typedescription_release( pDescription );
1151 }
1152 
1153 #ifdef __cplusplus
1154 }
1155 #endif
1156 
1157 #endif
1158