Drop redundant 'using rtl::OUString'
[LibreOffice.git] / include / typelib / typedescription.h
blob59423bfd481b573875656ed4808ed59946269864
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
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"
31 #ifdef __cplusplus
32 extern "C"
34 #endif
36 struct _typelib_TypeDescription;
38 #if defined( _WIN32)
39 #pragma pack(push, 8)
40 #endif
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()
49 sal_Int32 nRefCount;
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
68 void * pReserved;
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()
80 sal_Int32 nRefCount;
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
99 void * pReserved;
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.
106 sal_Bool bComplete;
107 /** size of type
109 sal_Int32 nSize;
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)
118 sal_Bool bOnDemand;
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
135 sal_Int32 nMembers;
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.
154 @since UDK 3.2.0
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
213 rtl_uString * pName;
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]
220 sal_Bool bIn;
221 /** true: the call type of this parameter is [out] or [inout]
222 false: the call type of this parameter is [in]
224 sal_Bool bOut;
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
237 any base interfaces
239 sal_Int32 nPosition;
240 /** name of member
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
259 sal_Int32 nParams;
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
271 sal_Bool bOneWay;
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
277 inherited)
279 @since UDK 3.2.0
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
285 method is inherited
287 @since UDK 3.2.0
289 sal_Int32 nIndex;
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
303 sal_Bool bReadOnly;
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
312 inherited)
314 @since UDK 3.2.0
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
322 @since UDK 3.2.0
324 sal_Int32 nIndex;
325 /** number of getter exceptions
327 @since UDK 3.2.0
329 sal_Int32 nGetExceptions;
330 /** array of getter exception types
332 @since UDK 3.2.0
334 typelib_TypeDescriptionReference ** ppGetExceptions;
335 /** number of setter exceptions
337 @since UDK 3.2.0
339 sal_Int32 nSetExceptions;
340 /** array of setter exception types
342 @since UDK 3.2.0
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>
351 <ul>
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>
372 </ul>
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
382 @deprecated
383 use nBaseTypes and ppBaseTypes instead
385 struct _typelib_InterfaceTypeDescription * pBaseTypeDescription;
386 /** unique identifier of interface
388 @deprecated
389 should always contain all-zeros
391 typelib_Uik aUik;
392 /** number of members
394 sal_Int32 nMembers;
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
416 @since UDK 3.2.0
418 sal_Int32 nBaseTypes;
419 /** array of base type descriptions
421 @since UDK 3.2.0
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().
447 @since UDK 3.2.0
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]
478 sal_Bool bIn;
479 /** true, if parameter is [out] or [inout]
481 sal_Bool bOut;
482 } typelib_Parameter_Init;
484 #if defined( _WIN32)
485 #pragma pack(pop)
486 #endif
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
511 types.
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,
526 sal_Int32 nMembers,
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
538 @since UDK 3.2.0
540 CPPU_DLLPUBLIC void SAL_CALL typelib_typedescription_newStruct(
541 typelib_TypeDescription ** ppRet,
542 rtl_uString * pTypeName,
543 typelib_TypeDescriptionReference * pType,
544 sal_Int32 nMembers,
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
561 @deprecated
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,
569 sal_Int32 nMembers,
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
587 @since UDK 3.2.0
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,
595 sal_Int32 nMembers,
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,
615 sal_Bool bOneWay,
616 rtl_uString * pMethodName,
617 typelib_TypeClass eReturnTypeClass,
618 rtl_uString * pReturnTypeName,
619 sal_Int32 nParams,
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
630 name
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
635 @deprecated
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,
644 sal_Bool bReadOnly )
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
651 base interfaces
652 @param pAttributeName fully qualified name of attribute including interface
653 name
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
662 @since UDK 3.2.0
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,
670 sal_Bool bReadOnly,
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
684 is deleted.
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 CPPU_DLLPUBLIC void SAL_CALL typelib_setCacheSize(
725 sal_Int32 nNewSize )
726 SAL_THROW_EXTERN_C();
728 /** Function pointer declaration of callback function get additional descriptions. Callbacks
729 must provide complete type descriptions (see typelib_typedescription_complete())!
731 @param pContext callback context
732 @param ppRet inout type description
733 @param pTypeName name of demanded type description
735 typedef void (SAL_CALL * typelib_typedescription_Callback)(
736 void * pContext, typelib_TypeDescription ** ppRet, rtl_uString * pTypeName );
738 /** Registers callback function providing additional type descriptions.
740 @param pContext callback context
741 @param pCallback callback function
743 CPPU_DLLPUBLIC void SAL_CALL typelib_typedescription_registerCallback(
744 void * pContext, typelib_typedescription_Callback pCallback )
745 SAL_THROW_EXTERN_C();
747 /** Revokes a previously registered callback function.
749 @param pContext callback context
750 @param pCallback registered callback function
752 CPPU_DLLPUBLIC void SAL_CALL typelib_typedescription_revokeCallback(
753 void * pContext, typelib_typedescription_Callback pCallback )
754 SAL_THROW_EXTERN_C();
757 /*----------------------------------------------------------------------------*/
758 /*----------------------------------------------------------------------------*/
759 /*----------------------------------------------------------------------------*/
761 /** Creates a type description reference. This is a weak reference not holding the description.
762 If the description is already registered, the previous one is returned.
764 @param ppTDR inout type description reference
765 @param eTypeClass type class of type
766 @param pTypeName name of type
768 CPPU_DLLPUBLIC void SAL_CALL typelib_typedescriptionreference_new(
769 typelib_TypeDescriptionReference ** ppTDR,
770 typelib_TypeClass eTypeClass,
771 rtl_uString * pTypeName )
772 SAL_THROW_EXTERN_C();
774 /** Creates a type description reference. This is a weak reference not holding the description.
775 If the description is already registered, the previous one is returned.
777 @param ppTDR inout type description reference
778 @param eTypeClass type class of type
779 @param pTypeName ascii name of type
781 CPPU_DLLPUBLIC void SAL_CALL typelib_typedescriptionreference_newByAsciiName(
782 typelib_TypeDescriptionReference ** ppTDR,
783 typelib_TypeClass eTypeClass,
784 const char * pTypeName )
785 SAL_THROW_EXTERN_C();
787 /** Increments reference count of type description reference.
789 @param pRef type description reference
791 CPPU_DLLPUBLIC void SAL_CALL typelib_typedescriptionreference_acquire(
792 typelib_TypeDescriptionReference * pRef )
793 SAL_THROW_EXTERN_C();
795 /** Increments reference count of type description reference. If the reference count reaches 0,
796 then the reference is deleted.
798 @param pRef type description reference
800 CPPU_DLLPUBLIC void SAL_CALL typelib_typedescriptionreference_release(
801 typelib_TypeDescriptionReference * pRef )
802 SAL_THROW_EXTERN_C();
804 /** Retrieves the type description for a given reference. If it is not possible to resolve the
805 reference, null is returned.
807 @param[in,out] ppRet type description
808 @param[in] pRef type description reference
810 CPPU_DLLPUBLIC void SAL_CALL typelib_typedescriptionreference_getDescription(
811 typelib_TypeDescription ** ppRet, typelib_TypeDescriptionReference * pRef )
812 SAL_THROW_EXTERN_C();
814 /** Tests whether two types description references are equal, i.e. type class and names are equal.
816 @param p1 a type description reference
817 @param p2 another type description reference
818 @return true, if type description references are equal
820 CPPU_DLLPUBLIC sal_Bool SAL_CALL typelib_typedescriptionreference_equals(
821 const typelib_TypeDescriptionReference * p1, const typelib_TypeDescriptionReference * p2 )
822 SAL_THROW_EXTERN_C();
824 /** Assigns a type.
826 @param ppDest destination type
827 @param pSource source type
829 CPPU_DLLPUBLIC void SAL_CALL typelib_typedescriptionreference_assign(
830 typelib_TypeDescriptionReference ** ppDest,
831 typelib_TypeDescriptionReference * pSource )
832 SAL_THROW_EXTERN_C();
834 /** Tests if values of type pAssignable can be assigned by values of type pFrom. This includes
835 widening conversion (e.g., long assignable from short), as long as there is no data loss.
837 @param pAssignable type description of value to be assigned
838 @param pFrom type description of value
840 CPPU_DLLPUBLIC sal_Bool SAL_CALL typelib_typedescription_isAssignableFrom(
841 typelib_TypeDescription * pAssignable,
842 typelib_TypeDescription * pFrom )
843 SAL_THROW_EXTERN_C();
845 /** Tests if values of type pAssignable can be assigned by values of type pFrom. This includes
846 widening conversion (e.g., long assignable from short), as long as there is no data loss.
848 @param pAssignable type of value to be assigned
849 @param pFrom type of value
851 CPPU_DLLPUBLIC sal_Bool SAL_CALL typelib_typedescriptionreference_isAssignableFrom(
852 typelib_TypeDescriptionReference * pAssignable,
853 typelib_TypeDescriptionReference * pFrom )
854 SAL_THROW_EXTERN_C();
856 /** Gets static type reference of standard types by type class.
857 ADDITIONAL OPT: provides Type com.sun.star.uno.Exception for typelib_TypeClass_EXCEPTION
858 and com.sun.star.uno.XInterface for typelib_TypeClass_INTERFACE.
860 Thread synchronizes on typelib mutex.
862 @param eTypeClass type class of basic type
863 @return pointer to type reference pointer
865 CPPU_DLLPUBLIC typelib_TypeDescriptionReference ** SAL_CALL typelib_static_type_getByTypeClass(
866 typelib_TypeClass eTypeClass )
867 SAL_THROW_EXTERN_C();
869 /** Inits static type reference. Thread synchronizes on typelib init mutex.
871 @param ppRef pointer to type reference pointer
872 @param eTypeClass type class of type
873 @param pTypeName ascii name of type
875 CPPU_DLLPUBLIC void SAL_CALL typelib_static_type_init(
876 typelib_TypeDescriptionReference ** ppRef,
877 typelib_TypeClass eTypeClass, const char * pTypeName )
878 SAL_THROW_EXTERN_C();
880 /** Inits static sequence type reference. Thread synchronizes on typelib init mutex.
882 @param ppRef pointer to type reference pointer
883 @param pElementType element type of sequence
885 CPPU_DLLPUBLIC void SAL_CALL typelib_static_sequence_type_init(
886 typelib_TypeDescriptionReference ** ppRef,
887 typelib_TypeDescriptionReference * pElementType )
888 SAL_THROW_EXTERN_C ();
890 /** Inits incomplete static compound type reference. Thread synchronizes on typelib init mutex.
892 Since this function can only be used to create type descriptions for plain
893 struct types, not for instantiated polymorphic struct types, the function
894 typelib_static_struct_type_init should be used instead for all struct types.
896 @param ppRef pointer to type reference pointer
897 @param eTypeClass typelib_TypeClass_STRUCT or typelib_TypeClass_EXCEPTION
898 @param pTypeName name of type
899 @param pBaseType base type
900 @param nMembers number of members
901 @param ppMembers member types
903 CPPU_DLLPUBLIC void SAL_CALL typelib_static_compound_type_init(
904 typelib_TypeDescriptionReference ** ppRef,
905 typelib_TypeClass eTypeClass, const char * pTypeName,
906 typelib_TypeDescriptionReference * pBaseType,
907 sal_Int32 nMembers, typelib_TypeDescriptionReference ** ppMembers )
908 SAL_THROW_EXTERN_C();
910 /** Inits incomplete static struct type reference.
912 Thread synchronizes on typelib init mutex.
914 @param ppRef pointer to type reference pointer
915 @param pTypeName name of type
916 @param pBaseType base type
917 @param nMembers number of members
918 @param ppMembers member types
919 @param pParameterizedTypes flags for direct members, specifying whether they
920 are of parameterized type (true) or explicit type (false); must be null
921 for a plain struct type
923 @since UDK 3.2.0
925 CPPU_DLLPUBLIC void SAL_CALL typelib_static_struct_type_init(
926 typelib_TypeDescriptionReference ** ppRef, const char * pTypeName,
927 typelib_TypeDescriptionReference * pBaseType,
928 sal_Int32 nMembers, typelib_TypeDescriptionReference ** ppMembers,
929 sal_Bool const * pParameterizedTypes )
930 SAL_THROW_EXTERN_C();
932 /** Inits incomplete static interface type reference. Thread synchronizes on typelib init mutex.
934 @param ppRef pointer to type reference pointer
935 @param pTypeName name of interface
936 @param pBaseType base type
938 CPPU_DLLPUBLIC void SAL_CALL typelib_static_interface_type_init(
939 typelib_TypeDescriptionReference ** ppRef,
940 const char * pTypeName,
941 typelib_TypeDescriptionReference * pBaseType )
942 SAL_THROW_EXTERN_C();
944 /** Inits incomplete static multiple-inheritance interface type reference.
945 Thread synchronizes on typelib init mutex.
947 @param ppRef pointer to type reference pointer
948 @param pTypeName name of interface
949 @param nBaseTypes number of base types
950 @param ppBaseTypes base types
952 @since UDK 3.2.0
954 CPPU_DLLPUBLIC void SAL_CALL typelib_static_mi_interface_type_init(
955 typelib_TypeDescriptionReference ** ppRef,
956 const char * pTypeName,
957 sal_Int32 nBaseTypes,
958 typelib_TypeDescriptionReference ** ppBaseTypes )
959 SAL_THROW_EXTERN_C();
961 /** Inits incomplete static enum type reference. Thread synchronizes on typelib init mutex.
963 @param ppRef pointer to type reference pointer
964 @param pTypeName name of enum
965 @param nDefaultValue default enum value
967 CPPU_DLLPUBLIC void SAL_CALL typelib_static_enum_type_init(
968 typelib_TypeDescriptionReference ** ppRef,
969 const char * pTypeName,
970 sal_Int32 nDefaultValue )
971 SAL_THROW_EXTERN_C();
973 /** Completes a typedescription to be used for, e.g., marshalling values. COMPOUND,
974 INTERFACE and ENUM type descriptions may be partly initialized (see typelib_static_...(),
975 typelib_TypeDescription::bComplete). For interface type descriptions, this will also
976 init index tables.
978 @param ppTypeDescr [inout] type description to be completed (may be exchanged!)
979 @return true, if type description is complete
981 CPPU_DLLPUBLIC sal_Bool SAL_CALL typelib_typedescription_complete(
982 typelib_TypeDescription ** ppTypeDescr )
983 SAL_THROW_EXTERN_C();
985 /// @cond INTERNAL
987 /** Returns true, if the type description reference may lose the type description. Otherwise
988 pType is a valid pointer and cannot be discarded through the lifetime of this reference.
989 Remark: If the pWeakObj of the type is set too, you can avoid the call of
990 ...getDescription(...) and use the description directly. pWeakObj == 0 means, that the
991 description is not initialized.
992 @internal
994 #if defined LIBO_INTERNAL_ONLY && defined __cplusplus
995 constexpr
996 #endif
997 inline bool TYPELIB_TYPEDESCRIPTIONREFERENCE_ISREALLYWEAK( _typelib_TypeClass eTypeClass )
999 return (eTypeClass == typelib_TypeClass_INTERFACE_METHOD) ||
1000 (eTypeClass == typelib_TypeClass_INTERFACE_ATTRIBUTE);
1003 /** Gets a description from the reference. The description may not be locked by this call.
1004 You must use the TYPELIB_DANGER_RELEASE macro to release the description fetched with
1005 this macro.
1006 @internal
1008 inline void TYPELIB_DANGER_GET( typelib_TypeDescription** ppMacroTypeDescr,
1009 typelib_TypeDescriptionReference* pMacroTypeRef )
1011 if (TYPELIB_TYPEDESCRIPTIONREFERENCE_ISREALLYWEAK( pMacroTypeRef->eTypeClass ))
1013 typelib_typedescriptionreference_getDescription( ppMacroTypeDescr, pMacroTypeRef );
1015 else if (!pMacroTypeRef->pType || !pMacroTypeRef->pType->pWeakRef)
1017 typelib_typedescriptionreference_getDescription( ppMacroTypeDescr, pMacroTypeRef );
1018 if (*ppMacroTypeDescr)
1019 typelib_typedescription_release( *ppMacroTypeDescr );
1021 else
1023 *ppMacroTypeDescr = pMacroTypeRef->pType;
1027 /** Releases the description previous fetched by TYPELIB_DANGER_GET.
1028 @internal
1030 inline void TYPELIB_DANGER_RELEASE( typelib_TypeDescription* pDescription )
1032 if (TYPELIB_TYPEDESCRIPTIONREFERENCE_ISREALLYWEAK( pDescription->eTypeClass ))
1033 typelib_typedescription_release( pDescription );
1036 /// @endcond
1038 #ifdef __cplusplus
1040 #endif
1042 #endif
1044 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */