1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
3 * This file is part of the LibreOffice project.
5 * This Source Code Form is subject to the terms of the Mozilla Public
6 * License, v. 2.0. If a copy of the MPL was not distributed with this
7 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
9 * This file incorporates work covered by the following license notice:
11 * Licensed to the Apache Software Foundation (ASF) under one or more
12 * contributor license agreements. See the NOTICE file distributed
13 * with this work for additional information regarding copyright
14 * ownership. The ASF licenses this file to you under the Apache
15 * License, Version 2.0 (the "License"); you may not use this file
16 * except in compliance with the License. You may obtain a copy of
17 * the License at http://www.apache.org/licenses/LICENSE-2.0 .
21 * This file is part of LibreOffice published API.
23 #ifndef INCLUDED_TYPELIB_TYPEDESCRIPTION_H
24 #define INCLUDED_TYPELIB_TYPEDESCRIPTION_H
26 #include "cppu/cppudllapi.h"
27 #include "typelib/uik.h"
28 #include "typelib/typeclass.h"
29 #include "rtl/ustring.h"
36 struct _typelib_TypeDescription
;
42 /** Holds a weak reference to a type description.
44 typedef struct SAL_DLLPUBLIC_RTTI _typelib_TypeDescriptionReference
46 /** reference count of type; don't ever modify this by yourself, use
47 typelib_typedescriptionreference_acquire() and typelib_typedescriptionreference_release()
50 /** number of static references of type, because of the fact that some types are needed
51 until program termination and are commonly held static.
53 sal_Int32 nStaticRefCount
;
54 /** type class of type
56 typelib_TypeClass eTypeClass
;
57 /** fully qualified name of type
59 rtl_uString
* pTypeName
;
60 /** pointer to full typedescription; this value is only valid if the type is never swapped out
62 struct _typelib_TypeDescription
* pType
;
63 /** pointer to optimize the runtime; not for public use
65 void * pUniqueIdentifier
;
66 /** reserved for future use; 0 if not used
69 } typelib_TypeDescriptionReference
;
71 /** Full type description of a type. Memory layout of this struct is identical to the
72 typelib_TypeDescriptionReference for the first six members.
73 So a typedescription can be used as type reference.
75 typedef struct SAL_DLLPUBLIC_RTTI _typelib_TypeDescription
77 /** reference count; don't ever modify this by yourself, use
78 typelib_typedescription_acquire() and typelib_typedescription_release()
81 /** number of static references of type, because of the fact that some types are needed
82 until program termination and are commonly held static.
84 sal_Int32 nStaticRefCount
;
85 /** type class of type
87 typelib_TypeClass eTypeClass
;
88 /** fully qualified name of type
90 rtl_uString
* pTypeName
;
91 /** pointer to self to distinguish reference from description; for internal use only
93 struct _typelib_TypeDescription
* pSelf
;
94 /** pointer to optimize the runtime; not for public use
96 void * pUniqueIdentifier
;
97 /** reserved for future use; 0 if not used
101 /** flag to determine whether the description is complete:
102 compound types lack of member names, enums lack of member types and names,
103 interfaces lack of members and table init.
104 Call typelib_typedescription_complete() if false.
110 /** alignment of type
112 sal_Int32 nAlignment
;
113 /** pointer to weak reference
115 typelib_TypeDescriptionReference
* pWeakRef
;
116 /** determines, if type can be unloaded (and it is possible to reloaded it)
119 } typelib_TypeDescription
;
121 /** Type description for exception types.
123 typedef struct _typelib_CompoundTypeDescription
125 /** inherits all members of typelib_TypeDescription
127 typelib_TypeDescription aBase
;
129 /** pointer to base type description, else 0
131 struct _typelib_CompoundTypeDescription
* pBaseTypeDescription
;
133 /** number of members
136 /** byte offsets of each member including the size the base type
138 sal_Int32
* pMemberOffsets
;
139 /** members of the struct or exception
141 typelib_TypeDescriptionReference
** ppTypeRefs
;
142 /** member names of the struct or exception
144 rtl_uString
** ppMemberNames
;
145 } typelib_CompoundTypeDescription
;
148 Type description for struct types.
150 This is only used to represent plain struct types and instantiated
151 polymorphic struct types; there is no representation of polymorphic struct
152 type templates at this level.
156 typedef struct _typelib_StructTypeDescription
159 Derived from typelib_CompoundTypeDescription.
161 typelib_CompoundTypeDescription aBase
;
164 Flags for direct members, specifying whether they are of parameterized
165 type (true) or explicit type (false).
167 For a plain struct type, this is a null pointer.
169 sal_Bool
* pParameterizedTypes
;
170 } typelib_StructTypeDescription
;
172 /** Type description of a sequence.
174 typedef struct _typelib_IndirectTypeDescription
176 /** inherits all members of typelib_TypeDescription
178 typelib_TypeDescription aBase
;
180 /** pointer to element type
182 typelib_TypeDescriptionReference
* pType
;
183 } typelib_IndirectTypeDescription
;
185 /** Type description of an enum. The type class of this description is typelib_TypeClass_ENUM.
187 typedef struct _typelib_EnumTypeDescription
189 /** inherits all members of typelib_TypeDescription
191 typelib_TypeDescription aBase
;
193 /** first value of the enum
195 sal_Int32 nDefaultEnumValue
;
196 /** number of enum values
198 sal_Int32 nEnumValues
;
199 /** names of enum values
201 rtl_uString
** ppEnumNames
;
202 /** values of enum (corresponding to names in similar order)
204 sal_Int32
* pEnumValues
;
205 } typelib_EnumTypeDescription
;
207 /** Description of an interface method parameter.
209 typedef struct _typelib_MethodParameter
211 /** name of parameter
214 /** type of parameter
216 typelib_TypeDescriptionReference
* pTypeRef
;
217 /** true: the call type of this parameter is [in] or [inout]
218 false: the call type of this parameter is [out]
221 /** true: the call type of this parameter is [out] or [inout]
222 false: the call type of this parameter is [in]
225 } typelib_MethodParameter
;
227 /** Common base type description of typelib_InterfaceMethodTypeDescription and
228 typelib_InterfaceAttributeTypeDescription.
230 typedef struct _typelib_InterfaceMemberTypeDescription
232 /** inherits all members of typelib_TypeDescription
234 typelib_TypeDescription aBase
;
236 /** position of member in the interface including the number of members of
242 rtl_uString
* pMemberName
;
243 } typelib_InterfaceMemberTypeDescription
;
245 /** Type description of an interface method. The type class of this description is
246 typelib_TypeClass_INTERFACE_METHOD. The size and the alignment are 0.
248 typedef struct _typelib_InterfaceMethodTypeDescription
250 /** inherits all members of typelib_InterfaceMemberTypeDescription
252 typelib_InterfaceMemberTypeDescription aBase
;
254 /** type of the return value
256 typelib_TypeDescriptionReference
* pReturnTypeRef
;
257 /** number of parameters
260 /** array of parameters
262 typelib_MethodParameter
* pParams
;
263 /** number of exceptions
265 sal_Int32 nExceptions
;
266 /** array of exception types
268 typelib_TypeDescriptionReference
** ppExceptions
;
269 /** determines whether method is declared oneway
273 /** the interface description this method is a member of
275 struct _typelib_InterfaceTypeDescription
* pInterface
;
276 /** the inherited direct base method (null for a method that is not
281 typelib_TypeDescriptionReference
* pBaseRef
;
282 /** if pBaseRef is null, the member position of this method within
283 pInterface, not counting members inherited from bases; if pBaseRef is
284 not null, the index of the direct base within pInterface from which this
290 } typelib_InterfaceMethodTypeDescription
;
292 /** The description of an interface attribute. The type class of this description is
293 typelib_TypeClass_INTERFACE_ATTRIBUTE. The size and the alignment are 0.
295 typedef struct _typelib_InterfaceAttributeTypeDescription
297 /** inherits all members of typelib_InterfaceMemberTypeDescription
299 typelib_InterfaceMemberTypeDescription aBase
;
301 /** determines whether attribute is read only
304 /** type of the attribute
306 typelib_TypeDescriptionReference
* pAttributeTypeRef
;
308 /** the interface description this attribute is a member of
310 struct _typelib_InterfaceTypeDescription
* pInterface
;
311 /** the inherited direct base attribute (null for an attribute that is not
316 typelib_TypeDescriptionReference
* pBaseRef
;
317 /** if pBaseRef is null, the member position of this attribute within
318 pInterface, not counting members inherited from bases; if pBaseRef is
319 not null, the index of the direct base within pInterface from which this
320 attribute is inherited
325 /** number of getter exceptions
329 sal_Int32 nGetExceptions
;
330 /** array of getter exception types
334 typelib_TypeDescriptionReference
** ppGetExceptions
;
335 /** number of setter exceptions
339 sal_Int32 nSetExceptions
;
340 /** array of setter exception types
344 typelib_TypeDescriptionReference
** ppSetExceptions
;
345 } typelib_InterfaceAttributeTypeDescription
;
347 /** Type description of an interface.
349 <p>Not all members are always initialized (not yet initialized members being
350 null); there are three levels:</p>
352 <li>Minimally, only <code>aBase</code>,
353 <code>pBaseTypeDescription</code>, <code>aUik</code>,
354 <code>nBaseTypes</code>, and <code>ppBaseTypes</code> are initialized;
355 <code>aBase.bComplete</code> is false. This only happens when an
356 interface type description is created with
357 <code>typelib_static_mi_interface_type_init</code> or
358 <code>typelib_static_interface_type_init</code>.</li>
360 <li>At the next level, <code>nMembers</code>, <code>ppMembers</code>,
361 <code>nAllMembers</code>, <code>ppAllMembers</code> are also
362 initialized; <code>aBase.bComplete</code> is still false. This happens
363 when an interface type description is created with
364 <code>typelib_typedescription_newMIInterface</code> or
365 <code>typelib_typedescription_newInterface</code>.</li>
367 <li>At the final level, <code>pMapMemberIndexToFunctionIndex</code>,
368 <code>nMapFunctionIndexToMemberIndex</code>, and
369 <code>pMapFunctionIndexToMemberIndex</code> are also initialized;
370 <code>aBase.bComplete</code> is true. This happens after a call to
371 <code>typelib_typedescription_complete</code>.</li>
374 typedef struct SAL_DLLPUBLIC_RTTI _typelib_InterfaceTypeDescription
376 /** inherits all members of typelib_TypeDescription
378 typelib_TypeDescription aBase
;
380 /** pointer to base type description, else 0
383 use nBaseTypes and ppBaseTypes instead
385 struct _typelib_InterfaceTypeDescription
* pBaseTypeDescription
;
386 /** unique identifier of interface
389 should always contain all-zeros
392 /** number of members
395 /** array of members; references attributes or methods
397 typelib_TypeDescriptionReference
** ppMembers
;
398 /** number of members including members of base interface
400 sal_Int32 nAllMembers
;
401 /** array of members including members of base interface; references attributes or methods
403 typelib_TypeDescriptionReference
** ppAllMembers
;
404 /** array mapping index of the member description to an index doubling for read-write
405 attributes (called function index); size of array is nAllMembers
407 sal_Int32
* pMapMemberIndexToFunctionIndex
;
408 /** number of members plus number of read-write attributes
410 sal_Int32 nMapFunctionIndexToMemberIndex
;
411 /** array mapping function index to member index; size of array is nMapFunctionIndexToMemberIndex
413 sal_Int32
* pMapFunctionIndexToMemberIndex
;
414 /** number of base types
418 sal_Int32 nBaseTypes
;
419 /** array of base type descriptions
423 struct _typelib_InterfaceTypeDescription
** ppBaseTypes
;
424 } typelib_InterfaceTypeDescription
;
426 /** Init struct of compound members for typelib_typedescription_new().
428 typedef struct _typelib_CompoundMember_Init
430 /** type class of compound member
432 typelib_TypeClass eTypeClass
;
433 /** name of type of compound member
435 For a member of an instantiated polymorphic struct type that is of
436 parameterized type, this will be a null pointer.
438 rtl_uString
* pTypeName
;
439 /** name of compound member
441 rtl_uString
* pMemberName
;
442 } typelib_CompoundMember_Init
;
445 Init struct of members for typelib_typedescription_newStruct().
449 typedef struct _typelib_StructMember_Init
452 Derived from typelib_CompoundMember_Init;
454 typelib_CompoundMember_Init aBase
;
457 Flag specifying whether the member is of parameterized type (true) or
458 explicit type (false).
460 sal_Bool bParameterizedType
;
461 } typelib_StructMember_Init
;
463 /** Init struct of interface methods for typelib_typedescription_new().
465 typedef struct _typelib_Parameter_Init
467 /** type class of parameter
469 typelib_TypeClass eTypeClass
;
470 /** name of parameter
472 rtl_uString
* pTypeName
;
473 /** name of parameter
475 rtl_uString
* pParamName
;
476 /** true, if parameter is [in] or [inout]
479 /** true, if parameter is [out] or [inout]
482 } typelib_Parameter_Init
;
488 /** Creates an enum type description.
490 @param ppRet inout enum type description
491 @param pTypeName name of enum
492 @param nDefaultValue default enum value
493 @param nEnumValues number of enum values
494 @param ppEnumNames names of enum values
495 @param pEnumValues enum values
497 CPPU_DLLPUBLIC
void SAL_CALL
typelib_typedescription_newEnum(
498 typelib_TypeDescription
** ppRet
,
499 rtl_uString
* pTypeName
,
500 sal_Int32 nDefaultValue
,
501 sal_Int32 nEnumValues
,
502 rtl_uString
** ppEnumNames
,
503 sal_Int32
* pEnumValues
)
504 SAL_THROW_EXTERN_C();
506 /** Creates a new type description.
508 Since this function can only be used to create type descriptions for plain
509 struct types, not for instantiated polymorphic struct types, the function
510 typelib_typedescription_newStruct should be used instead for all struct
513 @param ppRet inout type description
514 @param eTypeClass type class
515 @param pTypeName name of type
516 @param pType sequence: element type;
517 struct, Exception: base type;
518 @param nMembers number of members if struct, exception
519 @param pMembers array of members if struct, exception
521 CPPU_DLLPUBLIC
void SAL_CALL
typelib_typedescription_new(
522 typelib_TypeDescription
** ppRet
,
523 typelib_TypeClass eTypeClass
,
524 rtl_uString
* pTypeName
,
525 typelib_TypeDescriptionReference
* pType
,
527 typelib_CompoundMember_Init
* pMembers
)
528 SAL_THROW_EXTERN_C();
530 /** Creates a new struct type description.
532 @param ppRet inout type description
533 @param pTypeName name of type
534 @param pType base type;
535 @param nMembers number of members
536 @param pMembers array of members
540 CPPU_DLLPUBLIC
void SAL_CALL
typelib_typedescription_newStruct(
541 typelib_TypeDescription
** ppRet
,
542 rtl_uString
* pTypeName
,
543 typelib_TypeDescriptionReference
* pType
,
545 typelib_StructMember_Init
* pMembers
)
546 SAL_THROW_EXTERN_C();
548 /** Creates an interface type description.
550 @param ppRet inout interface type description
551 @param pTypeName the fully qualified name of the interface.
552 @param nUik1 uik part; deprecated and ignored, should always be 0
553 @param nUik2 uik part; deprecated and ignored, should always be 0
554 @param nUik3 uik part; deprecated and ignored, should always be 0
555 @param nUik4 uik part; deprecated and ignored, should always be 0
556 @param nUik5 uik part; deprecated and ignored, should always be 0
557 @param pBaseInterface base interface type, else 0
558 @param nMembers number of members
559 @param ppMembers members; attributes or methods
562 use typelib_typedescription_newMIInterface instead
564 CPPU_DLLPUBLIC
void SAL_CALL
typelib_typedescription_newInterface(
565 typelib_InterfaceTypeDescription
** ppRet
,
566 rtl_uString
* pTypeName
,
567 sal_uInt32 nUik1
, sal_uInt16 nUik2
, sal_uInt16 nUik3
, sal_uInt32 nUik4
, sal_uInt32 nUik5
,
568 typelib_TypeDescriptionReference
* pBaseInterface
,
570 typelib_TypeDescriptionReference
** ppMembers
)
571 SAL_THROW_EXTERN_C();
573 /** Creates a multiple-inheritance interface type description.
575 @param ppRet inout interface type description
576 @param pTypeName the fully qualified name of the interface.
577 @param nUik1 uik part; deprecated and ignored, should always be 0
578 @param nUik2 uik part; deprecated and ignored, should always be 0
579 @param nUik3 uik part; deprecated and ignored, should always be 0
580 @param nUik4 uik part; deprecated and ignored, should always be 0
581 @param nUik5 uik part; deprecated and ignored, should always be 0
582 @param nBaseInterfaces number of base interface types
583 @param ppBaseInterfaces base interface types
584 @param nMembers number of members
585 @param ppMembers members; attributes or methods
589 CPPU_DLLPUBLIC
void SAL_CALL
typelib_typedescription_newMIInterface(
590 typelib_InterfaceTypeDescription
** ppRet
,
591 rtl_uString
* pTypeName
,
592 sal_uInt32 nUik1
, sal_uInt16 nUik2
, sal_uInt16 nUik3
, sal_uInt32 nUik4
, sal_uInt32 nUik5
,
593 sal_Int32 nBaseInterfaces
,
594 typelib_TypeDescriptionReference
** ppBaseInterfaces
,
596 typelib_TypeDescriptionReference
** ppMembers
)
597 SAL_THROW_EXTERN_C();
599 /** Creates an interface method type description.
601 @param ppRet inout method type description
602 @param nAbsolutePosition position of member including all members of base interfaces
603 @param bOneWay determines whether method is declared oneway
604 @param pMethodName fully qualified name of method including interface name
605 @param eReturnTypeClass type class of return type
606 @param pReturnTypeName type name of the return type
607 @param nParams number of parameters
608 @param pParams parameter types
609 @param nExceptions number of exceptions
610 @param ppExceptionNames type names of exceptions
612 CPPU_DLLPUBLIC
void SAL_CALL
typelib_typedescription_newInterfaceMethod(
613 typelib_InterfaceMethodTypeDescription
** ppRet
,
614 sal_Int32 nAbsolutePosition
,
616 rtl_uString
* pMethodName
,
617 typelib_TypeClass eReturnTypeClass
,
618 rtl_uString
* pReturnTypeName
,
620 typelib_Parameter_Init
* pParams
,
621 sal_Int32 nExceptions
,
622 rtl_uString
** ppExceptionNames
)
623 SAL_THROW_EXTERN_C();
625 /** Creates an interface attribute type description.
627 @param ppRet inout attribute type description
628 @param nAbsolutePosition position of this attribute including all members of base interfaces
629 @param pAttributeName fully qualified name of attribute including interface
631 @param eAttributeTypeClass type class of attribute type
632 @param pAttributeTypeName type name of attribute type
633 @param bReadOnly determines whether attribute is read-only
636 use typelib_typedescription_newExtendedInterfaceAttribute instead
638 CPPU_DLLPUBLIC
void SAL_CALL
typelib_typedescription_newInterfaceAttribute(
639 typelib_InterfaceAttributeTypeDescription
** ppRet
,
640 sal_Int32 nAbsolutePosition
,
641 rtl_uString
* pAttributeName
,
642 typelib_TypeClass eAttributeTypeClass
,
643 rtl_uString
* pAttributeTypeName
,
645 SAL_THROW_EXTERN_C();
647 /** Creates an extended interface attribute type description.
649 @param ppRet inout attribute type description
650 @param nAbsolutePosition position of this attribute including all members of
652 @param pAttributeName fully qualified name of attribute including interface
654 @param eAttributeTypeClass type class of attribute type
655 @param pAttributeTypeName type name of attribute type
656 @param bReadOnly determines whether attribute is read-only
657 @param nGetExceptions number of getter exceptions
658 @param ppGetExceptionNames type names of getter exceptions
659 @param nSetExceptions number of setter exceptions
660 @param ppSetExceptionNames type names of setter exceptions
664 CPPU_DLLPUBLIC
void SAL_CALL
typelib_typedescription_newExtendedInterfaceAttribute(
665 typelib_InterfaceAttributeTypeDescription
** ppRet
,
666 sal_Int32 nAbsolutePosition
,
667 rtl_uString
* pAttributeName
,
668 typelib_TypeClass eAttributeTypeClass
,
669 rtl_uString
* pAttributeTypeName
,
671 sal_Int32 nGetExceptions
, rtl_uString
** ppGetExceptionNames
,
672 sal_Int32 nSetExceptions
, rtl_uString
** ppSetExceptionNames
)
673 SAL_THROW_EXTERN_C();
675 /** Increments reference count of given type description.
677 @param pDesc type description
679 CPPU_DLLPUBLIC
void SAL_CALL
typelib_typedescription_acquire(
680 typelib_TypeDescription
* pDesc
)
681 SAL_THROW_EXTERN_C();
683 /** Decrements reference count of given type. If reference count reaches 0, the type description
686 @param pDesc type description
688 CPPU_DLLPUBLIC
void SAL_CALL
typelib_typedescription_release(
689 typelib_TypeDescription
* pDesc
)
690 SAL_THROW_EXTERN_C();
692 /** Registers a type description and creates a type description reference. Type descriptions
693 will be registered automatically if they are provided via the callback chain.
695 @param ppNewDescription inout description to be registered;
697 CPPU_DLLPUBLIC
void SAL_CALL
typelib_typedescription_register(
698 typelib_TypeDescription
** ppNewDescription
)
699 SAL_THROW_EXTERN_C();
701 /** Tests whether two types descriptions are equal, i.e. type class and names are equal.
703 @param p1 a type description
704 @param p2 another type description
705 @return true, if type descriptions are equal
707 CPPU_DLLPUBLIC sal_Bool SAL_CALL
typelib_typedescription_equals(
708 const typelib_TypeDescription
* p1
, const typelib_TypeDescription
* p2
)
709 SAL_THROW_EXTERN_C();
711 /** Retrieves a type description via its fully qualified name.
713 @param ppRet inout type description; *ppRet is 0, if type description was not found
714 @param pName name demanded type description
716 CPPU_DLLPUBLIC
void SAL_CALL
typelib_typedescription_getByName(
717 typelib_TypeDescription
** ppRet
, rtl_uString
* pName
)
718 SAL_THROW_EXTERN_C();
720 /** Sets size of type description cache.
722 @param nNewSize new size of cache
724 @deprecated Do not use, it does not have any effect.
726 CPPU_DLLPUBLIC
void SAL_CALL
typelib_setCacheSize(
728 SAL_THROW_EXTERN_C();
730 /** Function pointer declaration of callback function get additional descriptions. Callbacks
731 must provide complete type descriptions (see typelib_typedescription_complete())!
733 @param pContext callback context
734 @param ppRet inout type description
735 @param pTypeName name of demanded type description
737 typedef void (SAL_CALL
* typelib_typedescription_Callback
)(
738 void * pContext
, typelib_TypeDescription
** ppRet
, rtl_uString
* pTypeName
);
740 /** Registers callback function providing additional type descriptions.
742 @param pContext callback context
743 @param pCallback callback function
745 CPPU_DLLPUBLIC
void SAL_CALL
typelib_typedescription_registerCallback(
746 void * pContext
, typelib_typedescription_Callback pCallback
)
747 SAL_THROW_EXTERN_C();
749 /** Revokes a previously registered callback function.
751 @param pContext callback context
752 @param pCallback registered callback function
754 CPPU_DLLPUBLIC
void SAL_CALL
typelib_typedescription_revokeCallback(
755 void * pContext
, typelib_typedescription_Callback pCallback
)
756 SAL_THROW_EXTERN_C();
759 /*----------------------------------------------------------------------------*/
760 /*----------------------------------------------------------------------------*/
761 /*----------------------------------------------------------------------------*/
763 /** Creates a type description reference. This is a weak reference not holding the description.
764 If the description is already registered, the previous one is returned.
766 @param ppTDR inout type description reference
767 @param eTypeClass type class of type
768 @param pTypeName name of type
770 CPPU_DLLPUBLIC
void SAL_CALL
typelib_typedescriptionreference_new(
771 typelib_TypeDescriptionReference
** ppTDR
,
772 typelib_TypeClass eTypeClass
,
773 rtl_uString
* pTypeName
)
774 SAL_THROW_EXTERN_C();
776 /** Creates a type description reference. This is a weak reference not holding the description.
777 If the description is already registered, the previous one is returned.
779 @param ppTDR inout type description reference
780 @param eTypeClass type class of type
781 @param pTypeName ascii name of type
783 CPPU_DLLPUBLIC
void SAL_CALL
typelib_typedescriptionreference_newByAsciiName(
784 typelib_TypeDescriptionReference
** ppTDR
,
785 typelib_TypeClass eTypeClass
,
786 const char * pTypeName
)
787 SAL_THROW_EXTERN_C();
789 /** Increments reference count of type description reference.
791 @param pRef type description reference
793 CPPU_DLLPUBLIC
void SAL_CALL
typelib_typedescriptionreference_acquire(
794 typelib_TypeDescriptionReference
* pRef
)
795 SAL_THROW_EXTERN_C();
797 /** Increments reference count of type description reference. If the reference count reaches 0,
798 then the reference is deleted.
800 @param pRef type description reference
802 CPPU_DLLPUBLIC
void SAL_CALL
typelib_typedescriptionreference_release(
803 typelib_TypeDescriptionReference
* pRef
)
804 SAL_THROW_EXTERN_C();
806 /** Retrieves the type description for a given reference. If it is not possible to resolve the
807 reference, null is returned.
809 @param[in,out] ppRet type description
810 @param[in] pRef type description reference
812 CPPU_DLLPUBLIC
void SAL_CALL
typelib_typedescriptionreference_getDescription(
813 typelib_TypeDescription
** ppRet
, typelib_TypeDescriptionReference
* pRef
)
814 SAL_THROW_EXTERN_C();
816 /** Tests whether two types description references are equal, i.e. type class and names are equal.
818 @param p1 a type description reference
819 @param p2 another type description reference
820 @return true, if type description references are equal
822 CPPU_DLLPUBLIC sal_Bool SAL_CALL
typelib_typedescriptionreference_equals(
823 const typelib_TypeDescriptionReference
* p1
, const typelib_TypeDescriptionReference
* p2
)
824 SAL_THROW_EXTERN_C();
828 @param ppDest destination type
829 @param pSource source type
831 CPPU_DLLPUBLIC
void SAL_CALL
typelib_typedescriptionreference_assign(
832 typelib_TypeDescriptionReference
** ppDest
,
833 typelib_TypeDescriptionReference
* pSource
)
834 SAL_THROW_EXTERN_C();
836 /** Tests if values of type pAssignable can be assigned by values of type pFrom. This includes
837 widening conversion (e.g., long assignable from short), as long as there is no data loss.
839 @param pAssignable type description of value to be assigned
840 @param pFrom type description of value
842 CPPU_DLLPUBLIC sal_Bool SAL_CALL
typelib_typedescription_isAssignableFrom(
843 typelib_TypeDescription
* pAssignable
,
844 typelib_TypeDescription
* pFrom
)
845 SAL_THROW_EXTERN_C();
847 /** Tests if values of type pAssignable can be assigned by values of type pFrom. This includes
848 widening conversion (e.g., long assignable from short), as long as there is no data loss.
850 @param pAssignable type of value to be assigned
851 @param pFrom type of value
853 CPPU_DLLPUBLIC sal_Bool SAL_CALL
typelib_typedescriptionreference_isAssignableFrom(
854 typelib_TypeDescriptionReference
* pAssignable
,
855 typelib_TypeDescriptionReference
* pFrom
)
856 SAL_THROW_EXTERN_C();
858 /** Gets static type reference of standard types by type class.
859 ADDITIONAL OPT: provides Type com.sun.star.uno.Exception for typelib_TypeClass_EXCEPTION
860 and com.sun.star.uno.XInterface for typelib_TypeClass_INTERFACE.
862 Thread synchronizes on typelib mutex.
864 @param eTypeClass type class of basic type
865 @return pointer to type reference pointer
867 CPPU_DLLPUBLIC typelib_TypeDescriptionReference
** SAL_CALL
typelib_static_type_getByTypeClass(
868 typelib_TypeClass eTypeClass
)
869 SAL_THROW_EXTERN_C();
871 /** Inits static type reference. Thread synchronizes on typelib init mutex.
873 @param ppRef pointer to type reference pointer
874 @param eTypeClass type class of type
875 @param pTypeName ascii name of type
877 CPPU_DLLPUBLIC
void SAL_CALL
typelib_static_type_init(
878 typelib_TypeDescriptionReference
** ppRef
,
879 typelib_TypeClass eTypeClass
, const char * pTypeName
)
880 SAL_THROW_EXTERN_C();
882 /** Inits static sequence type reference. Thread synchronizes on typelib init mutex.
884 @param ppRef pointer to type reference pointer
885 @param pElementType element type of sequence
887 CPPU_DLLPUBLIC
void SAL_CALL
typelib_static_sequence_type_init(
888 typelib_TypeDescriptionReference
** ppRef
,
889 typelib_TypeDescriptionReference
* pElementType
)
890 SAL_THROW_EXTERN_C ();
892 /** Inits incomplete static compound type reference. Thread synchronizes on typelib init mutex.
894 Since this function can only be used to create type descriptions for plain
895 struct types, not for instantiated polymorphic struct types, the function
896 typelib_static_struct_type_init should be used instead for all struct types.
898 @param ppRef pointer to type reference pointer
899 @param eTypeClass typelib_TypeClass_STRUCT or typelib_TypeClass_EXCEPTION
900 @param pTypeName name of type
901 @param pBaseType base type
902 @param nMembers number of members
903 @param ppMembers member types
905 CPPU_DLLPUBLIC
void SAL_CALL
typelib_static_compound_type_init(
906 typelib_TypeDescriptionReference
** ppRef
,
907 typelib_TypeClass eTypeClass
, const char * pTypeName
,
908 typelib_TypeDescriptionReference
* pBaseType
,
909 sal_Int32 nMembers
, typelib_TypeDescriptionReference
** ppMembers
)
910 SAL_THROW_EXTERN_C();
912 /** Inits incomplete static struct type reference.
914 Thread synchronizes on typelib init mutex.
916 @param ppRef pointer to type reference pointer
917 @param pTypeName name of type
918 @param pBaseType base type
919 @param nMembers number of members
920 @param ppMembers member types
921 @param pParameterizedTypes flags for direct members, specifying whether they
922 are of parameterized type (true) or explicit type (false); must be null
923 for a plain struct type
927 CPPU_DLLPUBLIC
void SAL_CALL
typelib_static_struct_type_init(
928 typelib_TypeDescriptionReference
** ppRef
, const char * pTypeName
,
929 typelib_TypeDescriptionReference
* pBaseType
,
930 sal_Int32 nMembers
, typelib_TypeDescriptionReference
** ppMembers
,
931 sal_Bool
const * pParameterizedTypes
)
932 SAL_THROW_EXTERN_C();
934 /** Inits incomplete static interface type reference. Thread synchronizes on typelib init mutex.
936 @param ppRef pointer to type reference pointer
937 @param pTypeName name of interface
938 @param pBaseType base type
940 CPPU_DLLPUBLIC
void SAL_CALL
typelib_static_interface_type_init(
941 typelib_TypeDescriptionReference
** ppRef
,
942 const char * pTypeName
,
943 typelib_TypeDescriptionReference
* pBaseType
)
944 SAL_THROW_EXTERN_C();
946 /** Inits incomplete static multiple-inheritance interface type reference.
947 Thread synchronizes on typelib init mutex.
949 @param ppRef pointer to type reference pointer
950 @param pTypeName name of interface
951 @param nBaseTypes number of base types
952 @param ppBaseTypes base types
956 CPPU_DLLPUBLIC
void SAL_CALL
typelib_static_mi_interface_type_init(
957 typelib_TypeDescriptionReference
** ppRef
,
958 const char * pTypeName
,
959 sal_Int32 nBaseTypes
,
960 typelib_TypeDescriptionReference
** ppBaseTypes
)
961 SAL_THROW_EXTERN_C();
963 /** Inits incomplete static enum type reference. Thread synchronizes on typelib init mutex.
965 @param ppRef pointer to type reference pointer
966 @param pTypeName name of enum
967 @param nDefaultValue default enum value
969 CPPU_DLLPUBLIC
void SAL_CALL
typelib_static_enum_type_init(
970 typelib_TypeDescriptionReference
** ppRef
,
971 const char * pTypeName
,
972 sal_Int32 nDefaultValue
)
973 SAL_THROW_EXTERN_C();
975 /** Completes a typedescription to be used for, e.g., marshalling values. COMPOUND,
976 INTERFACE and ENUM type descriptions may be partly initialized (see typelib_static_...(),
977 typelib_TypeDescription::bComplete). For interface type descriptions, this will also
980 @param ppTypeDescr [inout] type description to be completed (may be exchanged!)
981 @return true, if type description is complete
983 CPPU_DLLPUBLIC sal_Bool SAL_CALL
typelib_typedescription_complete(
984 typelib_TypeDescription
** ppTypeDescr
)
985 SAL_THROW_EXTERN_C();
989 /** Returns true, if the type description reference may lose the type description. Otherwise
990 pType is a valid pointer and cannot be discarded through the lifetime of this reference.
991 Remark: If the pWeakObj of the type is set too, you can avoid the call of
992 ...getDescription(...) and use the description directly. pWeakObj == 0 means, that the
993 description is not initialized.
996 #if defined LIBO_INTERNAL_ONLY && defined __cplusplus
999 inline bool TYPELIB_TYPEDESCRIPTIONREFERENCE_ISREALLYWEAK( _typelib_TypeClass eTypeClass
)
1001 return (eTypeClass
== typelib_TypeClass_INTERFACE_METHOD
) ||
1002 (eTypeClass
== typelib_TypeClass_INTERFACE_ATTRIBUTE
);
1005 /** Gets a description from the reference. The description may not be locked by this call.
1006 You must use the TYPELIB_DANGER_RELEASE macro to release the description fetched with
1010 inline void TYPELIB_DANGER_GET( typelib_TypeDescription
** ppMacroTypeDescr
,
1011 typelib_TypeDescriptionReference
* pMacroTypeRef
)
1013 if (TYPELIB_TYPEDESCRIPTIONREFERENCE_ISREALLYWEAK( pMacroTypeRef
->eTypeClass
))
1015 typelib_typedescriptionreference_getDescription( ppMacroTypeDescr
, pMacroTypeRef
);
1017 else if (!pMacroTypeRef
->pType
|| !pMacroTypeRef
->pType
->pWeakRef
)
1019 typelib_typedescriptionreference_getDescription( ppMacroTypeDescr
, pMacroTypeRef
);
1020 if (*ppMacroTypeDescr
)
1021 typelib_typedescription_release( *ppMacroTypeDescr
);
1025 *ppMacroTypeDescr
= pMacroTypeRef
->pType
;
1029 /** Releases the description previous fetched by TYPELIB_DANGER_GET.
1032 inline void TYPELIB_DANGER_RELEASE( typelib_TypeDescription
* pDescription
)
1034 if (TYPELIB_TYPEDESCRIPTIONREFERENCE_ISREALLYWEAK( pDescription
->eTypeClass
))
1035 typelib_typedescription_release( pDescription
);
1046 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */