1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5 * Copyright 2008 by Sun Microsystems, Inc.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * $RCSfile: typedescription.h,v $
12 * This file is part of OpenOffice.org.
14 * OpenOffice.org is free software: you can redistribute it and/or modify
15 * it under the terms of the GNU Lesser General Public License version 3
16 * only, as published by the Free Software Foundation.
18 * OpenOffice.org is distributed in the hope that it will be useful,
19 * but WITHOUT ANY WARRANTY; without even the implied warranty of
20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 * GNU Lesser General Public License version 3 for more details
22 * (a copy is included in the LICENSE file that accompanied this code).
24 * You should have received a copy of the GNU Lesser General Public License
25 * version 3 along with OpenOffice.org. If not, see
26 * <http://www.openoffice.org/license.html>
27 * for a copy of the LGPLv3 License.
29 ************************************************************************/
30 #ifndef _TYPELIB_TYPEDESCRIPTION_H_
31 #define _TYPELIB_TYPEDESCRIPTION_H_
33 #include <sal/types.h>
34 #include <typelib/uik.h>
35 #include <typelib/typeclass.h>
36 #include <rtl/ustring.h>
43 struct _typelib_TypeDescription
;
47 #elif defined(SAL_OS2)
51 /** Holds a weak reference to a type description.
53 typedef struct _typelib_TypeDescriptionReference
55 /** reference count of type; don't ever modify this by yourself, use
56 typelib_typedescriptionreference_acquire() and typelib_typedescriptionreference_release()
59 /** number of static references of type, because of the fact that some types are needed
60 until program termination and are commonly held static.
62 sal_Int32 nStaticRefCount
;
63 /** type class of type
65 typelib_TypeClass eTypeClass
;
66 /** fully qualified name of type
68 rtl_uString
* pTypeName
;
69 /** pointer to full typedescription; this value is only valid if the type is never swapped out
71 struct _typelib_TypeDescription
* pType
;
72 /** pointer to optimize the runtime; not for public use
74 void * pUniqueIdentifier
;
75 /** reserved for future use; 0 if not used
78 } typelib_TypeDescriptionReference
;
80 /** Full type description of a type. Memory layout of this struct is identical to the
81 typelib_TypeDescriptionReference for the first six members.
82 So a typedescription can be used as type reference.
84 typedef struct _typelib_TypeDescription
86 /** reference count; don't ever modify this by yourself, use
87 typelib_typedescription_acquire() and typelib_typedescription_release()
90 /** number of static references of type, because of the fact that some types are needed
91 until program termination and are commonly held static.
93 sal_Int32 nStaticRefCount
;
94 /** type class of type
96 typelib_TypeClass eTypeClass
;
97 /** fully qualified name of type
99 rtl_uString
* pTypeName
;
100 /** pointer to self to distinguish reference from description; for internal use only
102 struct _typelib_TypeDescription
* pSelf
;
103 /** pointer to optimize the runtime; not for public use
105 void * pUniqueIdentifier
;
106 /** reserved for future use; 0 if not used
110 /** flag to determine whether the description is complete:
111 compound and union types lack of member names, enums lack of member types and names,
112 interfaces lack of members and table init.
113 Call typelib_typedescription_complete() if false.
119 /** alignment of type
121 sal_Int32 nAlignment
;
122 /** pointer to weak reference
124 typelib_TypeDescriptionReference
* pWeakRef
;
125 /** determines, if type can be unloaded (and it is possible to reloaded it)
128 } typelib_TypeDescription
;
130 /** Type description for exception types.
132 typedef struct _typelib_CompoundTypeDescription
134 /** inherits all members of typelib_TypeDescription
136 typelib_TypeDescription aBase
;
138 /** pointer to base type description, else 0
140 struct _typelib_CompoundTypeDescription
* pBaseTypeDescription
;
142 /** number of members
145 /** byte offsets of each member including the size the base type
147 sal_Int32
* pMemberOffsets
;
148 /** members of the struct or exception
150 typelib_TypeDescriptionReference
** ppTypeRefs
;
151 /** member names of the struct or exception
153 rtl_uString
** ppMemberNames
;
154 } typelib_CompoundTypeDescription
;
157 Type description for struct types.
159 This is only used to represent plain struct types and instantiated
160 polymorphic struct types; there is no representation of polymorphic struct
161 type templates at this level.
165 typedef struct _typelib_StructTypeDescription
168 Derived from typelib_CompoundTypeDescription.
170 typelib_CompoundTypeDescription aBase
;
173 Flags for direct members, specifying whether they are of parameterized
174 type (true) or explict type (false).
176 For a plain struct type, this is a null pointer.
178 sal_Bool
* pParameterizedTypes
;
179 } typelib_StructTypeDescription
;
181 /** Type description of a union. The type class of this description is typelib_TypeClass_UNION.
183 typedef struct _typelib_UnionTypeDescription
185 /** inherits all members of typelib_TypeDescription
187 typelib_TypeDescription aBase
;
189 /** type of the discriminant
191 typelib_TypeDescriptionReference
* pDiscriminantTypeRef
;
193 /** union default descriminant
195 sal_Int64 nDefaultDiscriminant
;
196 /** union default member type (may be 0)
198 typelib_TypeDescriptionReference
* pDefaultTypeRef
;
199 /** number of union member types
202 /** union member discriminant values (same order as idl declaration)
204 sal_Int64
* pDiscriminants
;
205 /** union member value types (same order as idl declaration)
207 typelib_TypeDescriptionReference
** ppTypeRefs
;
208 /** union member value names (same order as idl declaration)
210 rtl_uString
** ppMemberNames
;
211 /** union value offset for data access
213 sal_Int32 nValueOffset
;
214 } typelib_UnionTypeDescription
;
216 /** Type description of an array or sequence.
218 typedef struct _typelib_IndirectTypeDescription
220 /** inherits all members of typelib_TypeDescription
222 typelib_TypeDescription aBase
;
224 /** array, sequence: pointer to element type
226 typelib_TypeDescriptionReference
* pType
;
227 } typelib_IndirectTypeDescription
;
229 /** Type description of an array.
231 typedef struct _typelib_ArrayTypeDescription
233 /** inherits all members of typelib_IndirectTypeDescription
235 typelib_IndirectTypeDescription aBase
;
237 /** number of dimensions
239 sal_Int32 nDimensions
;
240 /** number of total array elements
242 sal_Int32 nTotalElements
;
243 /** array of dimensions
245 sal_Int32
* pDimensions
;
246 } typelib_ArrayTypeDescription
;
248 /** Type description of an enum. The type class of this description is typelib_TypeClass_ENUM.
250 typedef struct _typelib_EnumTypeDescription
252 /** inherits all members of typelib_TypeDescription
254 typelib_TypeDescription aBase
;
256 /** first value of the enum
258 sal_Int32 nDefaultEnumValue
;
259 /** number of enum values
261 sal_Int32 nEnumValues
;
262 /** names of enum values
264 rtl_uString
** ppEnumNames
;
265 /** values of enum (corresponding to names in similar order)
267 sal_Int32
* pEnumValues
;
268 } typelib_EnumTypeDescription
;
270 /** Description of an interface method parameter.
272 typedef struct _typelib_MethodParameter
274 /** name of parameter
277 /** type of parameter
279 typelib_TypeDescriptionReference
* pTypeRef
;
280 /** true: the call type of this parameter is [in] or [inout]
281 false: the call type of this parameter is [out]
284 /** true: the call type of this parameter is [out] or [inout]
285 false: the call type of this parameter is [in]
288 } typelib_MethodParameter
;
290 /** Common base type description of typelib_InterfaceMethodTypeDescription and
291 typelib_InterfaceAttributeTypeDescription.
293 typedef struct _typelib_InterfaceMemberTypeDescription
295 /** inherits all members of typelib_TypeDescription
297 typelib_TypeDescription aBase
;
299 /** position of member in the interface including the number of members of
305 rtl_uString
* pMemberName
;
306 } typelib_InterfaceMemberTypeDescription
;
308 /** Type description of an interface method. The type class of this description is
309 typelib_TypeClass_INTERFACE_METHOD. The size and the alignment are 0.
311 typedef struct _typelib_InterfaceMethodTypeDescription
313 /** inherits all members of typelib_InterfaceMemberTypeDescription
315 typelib_InterfaceMemberTypeDescription aBase
;
317 /** type of the return value
319 typelib_TypeDescriptionReference
* pReturnTypeRef
;
320 /** number of parameters
323 /** array of parameters
325 typelib_MethodParameter
* pParams
;
326 /** number of exceptions
328 sal_Int32 nExceptions
;
329 /** array of exception types
331 typelib_TypeDescriptionReference
** ppExceptions
;
332 /** determines whether method is declared oneway
336 /** the interface description this method is a member of
340 struct _typelib_InterfaceTypeDescription
* pInterface
;
341 /** the inherited direct base method (null for a method that is not
346 typelib_TypeDescriptionReference
* pBaseRef
;
347 /** if pBaseRef is null, the member position of this method within
348 pInterface, not counting members inherited from bases; if pBaseRef is
349 not null, the index of the direct base within pInterface from which this
355 } typelib_InterfaceMethodTypeDescription
;
357 /** The description of an interface attribute. The type class of this description is
358 typelib_TypeClass_INTERFACE_ATTRIBUTE. The size and the alignment are 0.
360 typedef struct _typelib_InterfaceAttributeTypeDescription
362 /** inherits all members of typelib_InterfaceMemberTypeDescription
364 typelib_InterfaceMemberTypeDescription aBase
;
366 /** determines whether attribute is read only
369 /** type of the attribute
371 typelib_TypeDescriptionReference
* pAttributeTypeRef
;
373 /** the interface description this attribute is a member of
377 struct _typelib_InterfaceTypeDescription
* pInterface
;
378 /** the inherited direct base attribute (null for an attribute that is not
383 typelib_TypeDescriptionReference
* pBaseRef
;
384 /** if pBaseRef is null, the member position of this attribute within
385 pInterface, not counting members inherited from bases; if pBaseRef is
386 not null, the index of the direct base within pInterface from which this
387 attribute is inherited
392 /** number of getter exceptions
396 sal_Int32 nGetExceptions
;
397 /** array of getter exception types
401 typelib_TypeDescriptionReference
** ppGetExceptions
;
402 /** number of setter exceptions
406 sal_Int32 nSetExceptions
;
407 /** array of setter exception types
411 typelib_TypeDescriptionReference
** ppSetExceptions
;
412 } typelib_InterfaceAttributeTypeDescription
;
415 /** Type description of an interface.
417 <p>Not all members are always initialized (not yet initialized members being
418 null); there are three levels:</p>
420 <li>Minimally, only <code>aBase</code>,
421 <code>pBaseTypeDescription</code>, <code>aUik</code>,
422 <code>nBaseTypes</code>, and <code>ppBaseTypes</code> are initialized;
423 <code>aBase.bComplete</code> is false. This only happens when an
424 interface type description is created with
425 <code>typelib_static_mi_interface_type_init</code> or
426 <code>typelib_static_interface_type_init</code>.</li>
428 <li>At the next level, <code>nMembers</code>, <code>ppMembers</code>,
429 <code>nAllMembers</code>, <code>ppAllMembers</code> are also
430 initialized; <code>aBase.bComplete</code> is still false. This happens
431 when an interface type description is created with
432 <code>typelib_typedescription_newMIInterface</cocde> or
433 <code>typelib_typedescription_newInterface</code>.</li>
435 <li>At the final level, <code>pMapMemberIndexToFunctionIndex</code>,
436 <code>nMapFunctionIndexToMemberIndex</code>, and
437 <code>pMapFunctionIndexToMemberIndex</code> are also initialized;
438 <code>aBase.bComplete</code> is true. This happens after a call to
439 <code>typelib_typedescription_complete</code>.</li>
442 typedef struct _typelib_InterfaceTypeDescription
445 /** inherits all members of typelib_TypeDescription
447 typelib_TypeDescription aBase
;
449 /** pointer to base type description, else 0
452 use nBaseTypes and ppBaseTypes instead
454 struct _typelib_InterfaceTypeDescription
* pBaseTypeDescription
;
455 /** unique identifier of interface
458 /** number of members
461 /** array of members; references attributes or methods
463 typelib_TypeDescriptionReference
** ppMembers
;
464 /** number of members including members of base interface
466 sal_Int32 nAllMembers
;
467 /** array of members including members of base interface; references attributes or methods
469 typelib_TypeDescriptionReference
** ppAllMembers
;
470 /** array mapping index of the member description to an index doubling for read-write
471 attributes (called function index); size of array is nAllMembers
473 sal_Int32
* pMapMemberIndexToFunctionIndex
;
474 /** number of members plus number of read-write attributes
476 sal_Int32 nMapFunctionIndexToMemberIndex
;
477 /** array mapping function index to member index; size of arry is nMapFunctionIndexToMemberIndex
479 sal_Int32
* pMapFunctionIndexToMemberIndex
;
480 /** number of base types
484 sal_Int32 nBaseTypes
;
485 /** array of base type descriptions
489 struct _typelib_InterfaceTypeDescription
** ppBaseTypes
;
490 } typelib_InterfaceTypeDescription
;
492 /** Init struct of compound members for typelib_typedescription_new().
494 typedef struct _typelib_CompoundMember_Init
496 /** type class of compound member
498 typelib_TypeClass eTypeClass
;
499 /** name of type of compound member
501 For a member of an instantiated polymorphic struct type that is of
502 parameterized type, this will be a null pointer.
504 rtl_uString
* pTypeName
;
505 /** name of compound member
507 rtl_uString
* pMemberName
;
508 } typelib_CompoundMember_Init
;
511 Init struct of members for typelib_typedescription_newStruct().
515 typedef struct _typelib_StructMember_Init
518 Derived from typelib_CompoundMember_Init;
520 typelib_CompoundMember_Init aBase
;
523 Flag specifying whether the member is of parameterized type (true) or
524 explict type (false).
526 sal_Bool bParameterizedType
;
527 } typelib_StructMember_Init
;
529 /** Init struct of interface methods for typelib_typedescription_new().
531 typedef struct _typelib_Parameter_Init
533 /** type class of parameter
535 typelib_TypeClass eTypeClass
;
536 /** name of parameter
538 rtl_uString
* pTypeName
;
539 /** name of parameter
541 rtl_uString
* pParamName
;
542 /** true, if parameter is [in] or [inout]
545 /** true, if parameter is [out] or [inout]
548 } typelib_Parameter_Init
;
550 /** Init struct of union types for typelib_typedescription_newUnion().
552 typedef struct _typelib_Union_Init
554 /** union member discriminant
556 sal_Int64 nDiscriminant
;
557 /** union member name
559 rtl_uString
* pMemberName
;
560 /** union member type
562 typelib_TypeDescriptionReference
* pTypeRef
;
563 } typelib_Union_Init
;
565 #if defined( SAL_W32) || defined(SAL_OS2)
570 /** Creates a union type description. All discriminants are handled as int64 values.
571 The pDiscriminantTypeRef must be of type byte, short, ..., up to hyper.
573 @param ppRet inout union type description
574 @param pTypeName name of union type
575 @param pDiscriminantTypeRef discriminant type
576 @param nDefaultDiscriminant default discriminant
577 @param pDefaultTypeRef default value type of union
578 @param nMembers number of union members
579 @param pMembers init members
581 void SAL_CALL
typelib_typedescription_newUnion(
582 typelib_TypeDescription
** ppRet
,
583 rtl_uString
* pTypeName
,
584 typelib_TypeDescriptionReference
* pDiscriminantTypeRef
,
585 sal_Int64 nDefaultDiscriminant
,
586 typelib_TypeDescriptionReference
* pDefaultTypeRef
,
588 typelib_Union_Init
* pMembers
)
589 SAL_THROW_EXTERN_C();
591 /** Creates an enum type description.
593 @param ppRet inout enum type description
594 @param pTypeName name of enum
595 @param nDefaultEnumValue default enum value
596 @param nEnumValues number of enum values
597 @param ppEnumNames names of enum values
598 @param pEnumValues enum values
600 void SAL_CALL
typelib_typedescription_newEnum(
601 typelib_TypeDescription
** ppRet
,
602 rtl_uString
* pTypeName
,
603 sal_Int32 nDefaultValue
,
604 sal_Int32 nEnumValues
,
605 rtl_uString
** ppEnumNames
,
606 sal_Int32
* pEnumValues
)
607 SAL_THROW_EXTERN_C();
609 /** Creates an array type description.
611 @param ppRet inout enum type description
612 @param pElementTypeRef element type
613 @param nDimensions number of dimensions
614 @param pDimensions dimensions
616 void SAL_CALL
typelib_typedescription_newArray(
617 typelib_TypeDescription
** ppRet
,
618 typelib_TypeDescriptionReference
* pElementTypeRef
,
619 sal_Int32 nDimensions
,
620 sal_Int32
* pDimensions
)
621 SAL_THROW_EXTERN_C ();
623 /** Creates a new type description.
625 Since this function can only be used to create type descriptions for plain
626 struct types, not for instantiated polymorphic struct types, the function
627 typelib_typedescription_newStruct should be used instead for all struct
630 @param ppRet inout type description
631 @param eTypeClass type class
632 @param pTypeName name of type
633 @param pType sequence, array: element type;
634 struct, Exception: base type;
635 @param nMembers number of members if struct, exception
636 @param pMember array of members if struct, exception
638 void SAL_CALL
typelib_typedescription_new(
639 typelib_TypeDescription
** ppRet
,
640 typelib_TypeClass eTypeClass
,
641 rtl_uString
* pTypeName
,
642 typelib_TypeDescriptionReference
* pType
,
644 typelib_CompoundMember_Init
* pMembers
)
645 SAL_THROW_EXTERN_C();
647 /** Creates a new struct type description.
649 @param ppRet inout type description
650 @param pTypeName name of type
651 @param pType base type;
652 @param nMembers number of members
653 @param pMember array of members
657 void SAL_CALL
typelib_typedescription_newStruct(
658 typelib_TypeDescription
** ppRet
,
659 rtl_uString
* pTypeName
,
660 typelib_TypeDescriptionReference
* pType
,
662 typelib_StructMember_Init
* pMembers
)
663 SAL_THROW_EXTERN_C();
665 /** Creates an interface type description.
667 @param ppRet inout interface type description
668 @param pTypeName the fully qualified name of the interface.
669 @param nUik1 uik part
670 @param nUik2 uik part
671 @param nUik3 uik part
672 @param nUik4 uik part
673 @param nUik5 uik part
674 @param pBaseInterface base interface type, else 0
675 @param nMembers number of members
676 @param ppMembers members; attributes or methods
679 use typelib_typedescription_newMIInterface instead
681 void SAL_CALL
typelib_typedescription_newInterface(
682 typelib_InterfaceTypeDescription
** ppRet
,
683 rtl_uString
* pTypeName
,
684 sal_uInt32 nUik1
, sal_uInt16 nUik2
, sal_uInt16 nUik3
, sal_uInt32 nUik4
, sal_uInt32 nUik5
,
685 typelib_TypeDescriptionReference
* pBaseInterface
,
687 typelib_TypeDescriptionReference
** ppMembers
)
688 SAL_THROW_EXTERN_C();
690 /** Creates a multiple-inheritance interface type description.
692 @param ppRet inout interface type description
693 @param pTypeName the fully qualified name of the interface.
694 @param nUik1 uik part
695 @param nUik2 uik part
696 @param nUik3 uik part
697 @param nUik4 uik part
698 @param nUik5 uik part
699 @param nBaseInterfaces number of base interface types
700 @param ppBaseInterface base interface types
701 @param nMembers number of members
702 @param ppMembers members; attributes or methods
706 void SAL_CALL
typelib_typedescription_newMIInterface(
707 typelib_InterfaceTypeDescription
** ppRet
,
708 rtl_uString
* pTypeName
,
709 sal_uInt32 nUik1
, sal_uInt16 nUik2
, sal_uInt16 nUik3
, sal_uInt32 nUik4
, sal_uInt32 nUik5
,
710 sal_Int32 nBaseInterfaces
,
711 typelib_TypeDescriptionReference
** ppBaseInterfaces
,
713 typelib_TypeDescriptionReference
** ppMembers
)
714 SAL_THROW_EXTERN_C();
716 /** Creates an interface method type description.
718 @param ppRet inout method type description
719 @param nAbsolutePosition position of member including all members of base interfaces
720 @param bOneWay determines whether method is declared oneway
721 @param pTypeName fully qualified name of method including interface name
722 @param eReturnTypeClass type class of return type
723 @param pReturnTypeName type name of the return type
724 @param nParams number of parameters
725 @param pParams parameter types
726 @param nExceptions number of exceptions
727 @param ppExceptionNames type names of exceptions
729 void SAL_CALL
typelib_typedescription_newInterfaceMethod(
730 typelib_InterfaceMethodTypeDescription
** ppRet
,
731 sal_Int32 nAbsolutePosition
,
733 rtl_uString
* pMethodName
,
734 typelib_TypeClass eReturnTypeClass
,
735 rtl_uString
* pReturnTypeName
,
737 typelib_Parameter_Init
* pParams
,
738 sal_Int32 nExceptions
,
739 rtl_uString
** ppExceptionNames
)
740 SAL_THROW_EXTERN_C();
742 /** Creates an interface attribute type description.
744 @param ppRet inout attribute type description
745 @param nAbsolutePosition position of this attribute including all members of base interfaces
746 @param pAttributeName fully qualified name of attribute including interface
748 @param eAttributeTypeClass type class of attribute type
749 @param pAttributeTypeName type name of attribute type
750 @param bReadOnly determines whether attribute is read-only
753 use typelib_typedescription_newExtendedInterfaceAttribute instead
755 void SAL_CALL
typelib_typedescription_newInterfaceAttribute(
756 typelib_InterfaceAttributeTypeDescription
** ppRet
,
757 sal_Int32 nAbsolutePosition
,
758 rtl_uString
* pAttributeName
,
759 typelib_TypeClass eAttributeTypeClass
,
760 rtl_uString
* pAttributeTypeName
,
762 SAL_THROW_EXTERN_C();
764 /** Creates an extended interface attribute type description.
766 @param ppRet inout attribute type description
767 @param nAbsolutePosition position of this attribute including all members of
769 @param pAttributeName fully qualified name of attribute including interface
771 @param eAttributeTypeClass type class of attribute type
772 @param pAttributeTypeName type name of attribute type
773 @param bReadOnly determines whether attribute is read-only
774 @param nGetExceptions number of getter exceptions
775 @param ppGetExceptionNames type names of getter exceptions
776 @param nSetExceptions number of setter exceptions
777 @param ppSetExceptionNames type names of setter exceptions
781 void SAL_CALL
typelib_typedescription_newExtendedInterfaceAttribute(
782 typelib_InterfaceAttributeTypeDescription
** ppRet
,
783 sal_Int32 nAbsolutePosition
,
784 rtl_uString
* pAttributeName
,
785 typelib_TypeClass eAttributeTypeClass
,
786 rtl_uString
* pAttributeTypeName
,
788 sal_Int32 nGetExceptions
, rtl_uString
** ppGetExceptionNames
,
789 sal_Int32 nSetExceptions
, rtl_uString
** ppSetExceptionNames
)
790 SAL_THROW_EXTERN_C();
792 /** Increments reference count of given type description.
794 @param pDesc type description
796 void SAL_CALL
typelib_typedescription_acquire(
797 typelib_TypeDescription
* pDesc
)
798 SAL_THROW_EXTERN_C();
800 /** Decrements reference count of given type. If reference count reaches 0, the trype description
803 @param pDesc type description
805 void SAL_CALL
typelib_typedescription_release(
806 typelib_TypeDescription
* pDesc
)
807 SAL_THROW_EXTERN_C();
809 /** Registers a type description and creates a type description reference. Type descriptions
810 will be registered automatically if they are provided via the callback chain.
812 @param ppNewDescription inout description to be registered;
814 void SAL_CALL
typelib_typedescription_register(
815 typelib_TypeDescription
** ppNewDescription
)
816 SAL_THROW_EXTERN_C();
818 /** Tests whether two types descriptions are equal, i.e. type class and names are equal.
820 @param p1 a type description
821 @param p2 another type description
822 @return true, if type descriptions are equal
824 sal_Bool SAL_CALL
typelib_typedescription_equals(
825 const typelib_TypeDescription
* p1
, const typelib_TypeDescription
* p2
)
826 SAL_THROW_EXTERN_C();
828 /** Retrieves a type description via its fully qualified name.
830 @param ppRet inout type description; *ppRet is 0, if type description was not found
831 @param pName name demanded type description
833 void SAL_CALL
typelib_typedescription_getByName(
834 typelib_TypeDescription
** ppRet
, rtl_uString
* pName
)
835 SAL_THROW_EXTERN_C();
837 /** Sets size of type description cache.
839 @param nNewSize new size of cache
841 void SAL_CALL
typelib_setCacheSize(
843 SAL_THROW_EXTERN_C();
845 /** Function pointer declaration of callback function get additional descriptions. Callbacks
846 must provide complete type descriptions (see typelib_typedescription_complete())!
848 @param pContext callback context
849 @param ppRet inout type description
850 @param pTypeName name of demanded type description
852 typedef void (SAL_CALL
* typelib_typedescription_Callback
)(
853 void * pContext
, typelib_TypeDescription
** ppRet
, rtl_uString
* pTypeName
);
855 /** Registers callback function providing additional type descriptions.
857 @param pContext callback context
858 @param pCallback callback function
860 void SAL_CALL
typelib_typedescription_registerCallback(
861 void * pContext
, typelib_typedescription_Callback pCallback
)
862 SAL_THROW_EXTERN_C();
864 /** Revokes a previously registered callback function.
866 @param pContext callback context
867 @param pCallback registered callback function
869 void SAL_CALL
typelib_typedescription_revokeCallback(
870 void * pContext
, typelib_typedescription_Callback pCallback
)
871 SAL_THROW_EXTERN_C();
874 /*----------------------------------------------------------------------------*/
875 /*----------------------------------------------------------------------------*/
876 /*----------------------------------------------------------------------------*/
878 /** Returns true, if the type description reference may lose the type description. Otherwise
879 pType is a valid pointer and cannot be discarded through the lifetime of this reference.
880 Remark: If the pWeakObj of the type is set too, you can avoid the call of
881 ...getDescription(...) and use the description directly. pWeakObj == 0 means, that the
882 description is not initialized.
885 #define TYPELIB_TYPEDESCRIPTIONREFERENCE_ISREALLYWEAK( eTypeClass ) \
886 ((eTypeClass) == typelib_TypeClass_INTERFACE_METHOD || \
887 (eTypeClass) == typelib_TypeClass_INTERFACE_ATTRIBUTE)
889 /** Gets a description from the reference. The description may not be locked by this call.
890 You must use the TYPELIB_DANGER_RELEASE macro to release the description fetched with
894 #define TYPELIB_DANGER_GET( ppDescription, pTypeRef ) \
896 typelib_TypeDescriptionReference * pMacroTypeRef = (pTypeRef); \
897 typelib_TypeDescription ** ppMacroTypeDescr = (ppDescription); \
898 if (TYPELIB_TYPEDESCRIPTIONREFERENCE_ISREALLYWEAK( pMacroTypeRef->eTypeClass )) \
900 typelib_typedescriptionreference_getDescription( ppMacroTypeDescr, pMacroTypeRef ); \
902 else if (!pMacroTypeRef->pType || !pMacroTypeRef->pType->pWeakRef) \
904 typelib_typedescriptionreference_getDescription( ppMacroTypeDescr, pMacroTypeRef ); \
905 if (*ppMacroTypeDescr) \
906 typelib_typedescription_release( *ppMacroTypeDescr ); \
910 *ppMacroTypeDescr = pMacroTypeRef->pType; \
914 /** Releases the description previouse fetched by TYPELIB_DANGER_GET.
917 #define TYPELIB_DANGER_RELEASE( pDescription ) \
919 if (TYPELIB_TYPEDESCRIPTIONREFERENCE_ISREALLYWEAK( (pDescription)->eTypeClass )) \
920 typelib_typedescription_release( pDescription ); \
923 /** Creates a type description reference. This is a weak reference not holding the description.
924 If the description is already registered, the previous one is returned.
926 @param ppTDR inout type description reference
927 @param eTypeClass type class of type
928 @param pTypeName name of type
930 void SAL_CALL
typelib_typedescriptionreference_new(
931 typelib_TypeDescriptionReference
** ppTDR
,
932 typelib_TypeClass eTypeClass
,
933 rtl_uString
* pTypeName
)
934 SAL_THROW_EXTERN_C();
936 /** Creates a type description reference. This is a weak reference not holding the description.
937 If the description is already registered, the previous one is returned.
939 @param ppTDR inout type description reference
940 @param eTypeClass type class of type
941 @param pTypeName ascii name of type
943 void SAL_CALL
typelib_typedescriptionreference_newByAsciiName(
944 typelib_TypeDescriptionReference
** ppTDR
,
945 typelib_TypeClass eTypeClass
,
946 const sal_Char
* pTypeName
)
947 SAL_THROW_EXTERN_C();
949 /** Increments reference count of type description reference.
951 @param pRef type description reference
953 void SAL_CALL
typelib_typedescriptionreference_acquire(
954 typelib_TypeDescriptionReference
* pRef
)
955 SAL_THROW_EXTERN_C();
957 /** Increments reference count of type description reference. If the reference count reaches 0,
958 then the reference is deleted.
960 @param pRef type description reference
962 void SAL_CALL
typelib_typedescriptionreference_release(
963 typelib_TypeDescriptionReference
* pRef
)
964 SAL_THROW_EXTERN_C();
966 /** Retrieves the type description for a given reference. If it is not possible to resolve the
967 reference, null is returned.
969 @param ppRet inout type description
971 void SAL_CALL
typelib_typedescriptionreference_getDescription(
972 typelib_TypeDescription
** ppRet
, typelib_TypeDescriptionReference
* pRef
)
973 SAL_THROW_EXTERN_C();
975 /** Tests whether two types description references are equal, i.e. type class and names are equal.
977 @param p1 a type description reference
978 @param p2 another type description reference
979 @return true, if type description references are equal
981 sal_Bool SAL_CALL
typelib_typedescriptionreference_equals(
982 const typelib_TypeDescriptionReference
* p1
, const typelib_TypeDescriptionReference
* p2
)
983 SAL_THROW_EXTERN_C();
987 @param ppDest destination type
988 @param pSource source type
990 void SAL_CALL
typelib_typedescriptionreference_assign(
991 typelib_TypeDescriptionReference
** ppDest
,
992 typelib_TypeDescriptionReference
* pSource
)
993 SAL_THROW_EXTERN_C();
995 /** Tests if values of type pAssignable can be assigned by values of type pFrom. This includes
996 widening conversion (e.g., long assignable from short), as long as there is no data loss.
998 @param pAssignable type description of value to be assigned
999 @param pFrom type description of value
1001 sal_Bool SAL_CALL
typelib_typedescription_isAssignableFrom(
1002 typelib_TypeDescription
* pAssignable
,
1003 typelib_TypeDescription
* pFrom
)
1004 SAL_THROW_EXTERN_C();
1006 /** Tests if values of type pAssignable can be assigned by values of type pFrom. This includes
1007 widening conversion (e.g., long assignable from short), as long as there is no data loss.
1009 @param pAssignable type of value to be assigned
1010 @param pFrom type of value
1012 sal_Bool SAL_CALL
typelib_typedescriptionreference_isAssignableFrom(
1013 typelib_TypeDescriptionReference
* pAssignable
,
1014 typelib_TypeDescriptionReference
* pFrom
)
1015 SAL_THROW_EXTERN_C();
1017 /** Gets static type reference of standard types by type class.
1018 ADDITIONAL OPT: provides Type com.sun.star.uno.Exception for typelib_TypeClass_EXCEPTION
1019 and com.sun.star.uno.XInterface for typelib_TypeClass_INTERFACE.
1021 Thread synchronizes on typelib mutex.
1023 @param eTypeClass type class of basic type
1024 @return pointer to type reference pointer
1026 typelib_TypeDescriptionReference
** SAL_CALL
typelib_static_type_getByTypeClass(
1027 typelib_TypeClass eTypeClass
)
1028 SAL_THROW_EXTERN_C();
1030 /** Inits static type reference. Thread synchronizes on typelib init mutex.
1032 @param ppRef pointer to type reference pointer
1033 @param eTypeClass type class of type
1034 @param pTypeName ascii name of type
1036 void SAL_CALL
typelib_static_type_init(
1037 typelib_TypeDescriptionReference
** ppRef
,
1038 typelib_TypeClass eTypeClass
, const sal_Char
* pTypeName
)
1039 SAL_THROW_EXTERN_C();
1041 /** Inits static sequence type reference. Thread synchronizes on typelib init mutex.
1043 @param ppRef pointer to type reference pointer
1044 @param pElementType element type of sequence
1046 void SAL_CALL
typelib_static_sequence_type_init(
1047 typelib_TypeDescriptionReference
** ppRef
,
1048 typelib_TypeDescriptionReference
* pElementType
)
1049 SAL_THROW_EXTERN_C ();
1051 /** Inits static array type reference. Thread synchronizes on typelib init mutex.
1053 @param ppRef pointer to type reference pointer
1054 @param pElementType element type of sequence
1055 @param nDimensions number of dimensions
1056 @param ... additional sal_Int32 parameter for each dimension
1058 void SAL_CALL
typelib_static_array_type_init(
1059 typelib_TypeDescriptionReference
** ppRef
,
1060 typelib_TypeDescriptionReference
* pElementType
,
1061 sal_Int32 nDimensions
, ... )
1062 SAL_THROW_EXTERN_C ();
1064 /** Inits incomplete static compound type reference. Thread synchronizes on typelib init mutex.
1066 Since this function can only be used to create type descriptions for plain
1067 struct types, not for instantiated polymorphic struct types, the function
1068 typelib_static_struct_type_init should be used instead for all struct types.
1070 @param ppRef pointer to type reference pointer
1071 @param eTypeClass typelib_TypeClass_STRUCT or typelib_TypeClass_EXCEPTION
1072 @param pTypeName name of type
1073 @param pBaseType base type
1074 @param nMembers number of members
1075 @param ppMembers member types
1077 void SAL_CALL
typelib_static_compound_type_init(
1078 typelib_TypeDescriptionReference
** ppRef
,
1079 typelib_TypeClass eTypeClass
, const sal_Char
* pTypeName
,
1080 typelib_TypeDescriptionReference
* pBaseType
,
1081 sal_Int32 nMembers
, typelib_TypeDescriptionReference
** ppMembers
)
1082 SAL_THROW_EXTERN_C();
1084 /** Inits incomplete static struct type reference.
1086 Thread synchronizes on typelib init mutex.
1088 @param ppRef pointer to type reference pointer
1089 @param pTypeName name of type
1090 @param pBaseType base type
1091 @param nMembers number of members
1092 @param ppMembers member types
1093 @param pParameterizedTypes flags for direct members, specifying whether they
1094 are of parameterized type (true) or explict type (false); must be null
1095 for a plain struct type
1099 void SAL_CALL
typelib_static_struct_type_init(
1100 typelib_TypeDescriptionReference
** ppRef
, const sal_Char
* pTypeName
,
1101 typelib_TypeDescriptionReference
* pBaseType
,
1102 sal_Int32 nMembers
, typelib_TypeDescriptionReference
** ppMembers
,
1103 sal_Bool
const * pParameterizedTypes
)
1104 SAL_THROW_EXTERN_C();
1106 /** Inits incomplete static interface type reference. Thread synchronizes on typelib init mutex.
1108 @param ppRef pointer to type reference pointer
1109 @param pTypeName name of interface
1110 @param pBaseType base type
1112 void SAL_CALL
typelib_static_interface_type_init(
1113 typelib_TypeDescriptionReference
** ppRef
,
1114 const sal_Char
* pTypeName
,
1115 typelib_TypeDescriptionReference
* pBaseType
)
1116 SAL_THROW_EXTERN_C();
1118 /** Inits incomplete static multiple-inheritance interface type reference.
1119 Thread synchronizes on typelib init mutex.
1121 @param ppRef pointer to type reference pointer
1122 @param pTypeName name of interface
1123 @param nBaseTypes number of base types
1124 @param ppBaseTypes base types
1128 void SAL_CALL
typelib_static_mi_interface_type_init(
1129 typelib_TypeDescriptionReference
** ppRef
,
1130 const sal_Char
* pTypeName
,
1131 sal_Int32 nBaseTypes
,
1132 typelib_TypeDescriptionReference
** ppBaseTypes
)
1133 SAL_THROW_EXTERN_C();
1135 /** Inits incomplete static enum type reference. Thread synchronizes on typelib init mutex.
1137 @param ppRef pointer to type reference pointer
1138 @param pTypeName name of enum
1139 @param nDefaultEnumValue default enum value
1141 void SAL_CALL
typelib_static_enum_type_init(
1142 typelib_TypeDescriptionReference
** ppRef
,
1143 const sal_Char
* pTypeName
,
1144 sal_Int32 nDefaultValue
)
1145 SAL_THROW_EXTERN_C();
1147 /** Completes a typedescription to be used for, e.g., marshalling values. COMPOUND, UNION,
1148 INTERFACE and ENUM type descriptions may be partly initialized (see typelib_static_...(),
1149 typelib_TypeDescription::bComplete). For interface type descriptions, this will also
1152 @param ppTypeDescr [inout] type description to be completed (may be exchanged!)
1153 @return true, if type description is complete
1155 sal_Bool SAL_CALL
typelib_typedescription_complete(
1156 typelib_TypeDescription
** ppTypeDescr
)
1157 SAL_THROW_EXTERN_C();