From 6c7659b584ea7ed3652ca4eb9a2297f36310c365 Mon Sep 17 00:00:00 2001 From: David Tardon Date: Fri, 19 Apr 2013 18:54:16 +0200 Subject: move URE headers to include/ Change-Id: Ib48a12e902f2311c295b2007f08f44dee28f431d Reviewed-on: https://gerrit.libreoffice.org/3499 Reviewed-by: David Tardon Tested-by: David Tardon --- include/typelib/typeclass.h | 98 +++ include/typelib/typedescription.h | 1148 +++++++++++++++++++++++++++++++++++ include/typelib/typedescription.hxx | 216 +++++++ include/typelib/uik.h | 45 ++ 4 files changed, 1507 insertions(+) create mode 100644 include/typelib/typeclass.h create mode 100644 include/typelib/typedescription.h create mode 100644 include/typelib/typedescription.hxx create mode 100644 include/typelib/uik.h (limited to 'include/typelib') diff --git a/include/typelib/typeclass.h b/include/typelib/typeclass.h new file mode 100644 index 000000000000..b3eeb5ddff52 --- /dev/null +++ b/include/typelib/typeclass.h @@ -0,0 +1,98 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ +#ifndef _TYPELIB_TYPECLASS_H_ +#define _TYPELIB_TYPECLASS_H_ + +#include + +/** This type class enum is binary compatible with the IDL enum com.sun.star.uno.TypeClass. +*/ +typedef enum _typelib_TypeClass +{ + /** type class of void */ + typelib_TypeClass_VOID = 0, + /** type class of char */ + typelib_TypeClass_CHAR = 1, + /** type class of boolean */ + typelib_TypeClass_BOOLEAN = 2, + /** type class of byte */ + typelib_TypeClass_BYTE = 3, + /** type class of short */ + typelib_TypeClass_SHORT = 4, + /** type class of unsigned short */ + typelib_TypeClass_UNSIGNED_SHORT = 5, + /** type class of long */ + typelib_TypeClass_LONG = 6, + /** type class of unsigned long */ + typelib_TypeClass_UNSIGNED_LONG = 7, + /** type class of hyper */ + typelib_TypeClass_HYPER = 8, + /** type class of unsigned hyper */ + typelib_TypeClass_UNSIGNED_HYPER = 9, + /** type class of float */ + typelib_TypeClass_FLOAT = 10, + /** type class of double */ + typelib_TypeClass_DOUBLE = 11, + /** type class of string */ + typelib_TypeClass_STRING = 12, + /** type class of type */ + typelib_TypeClass_TYPE = 13, + /** type class of any */ + typelib_TypeClass_ANY = 14, + /** type class of enum */ + typelib_TypeClass_ENUM = 15, + /** type class of typedef */ + typelib_TypeClass_TYPEDEF = 16, + /** type class of struct */ + typelib_TypeClass_STRUCT = 17, + /** type class of union (not implemented) */ + typelib_TypeClass_UNION = 18, + /** type class of exception */ + typelib_TypeClass_EXCEPTION = 19, + /** type class of sequence */ + typelib_TypeClass_SEQUENCE = 20, + /** type class of array (not implemented) */ + typelib_TypeClass_ARRAY = 21, + /** type class of interface */ + typelib_TypeClass_INTERFACE = 22, + /** type class of service (not implemented) */ + typelib_TypeClass_SERVICE = 23, + /** type class of module (not implemented) */ + typelib_TypeClass_MODULE = 24, + /** type class of interface method */ + typelib_TypeClass_INTERFACE_METHOD = 25, + /** type class of interface attribute */ + typelib_TypeClass_INTERFACE_ATTRIBUTE = 26, + /** type class of unknown type */ + typelib_TypeClass_UNKNOWN = 27, + /** type class of properties */ + typelib_TypeClass_PROPERTY = 28, + /** type class of constants */ + typelib_TypeClass_CONSTANT = 29, + /** type class of constants groups */ + typelib_TypeClass_CONSTANTS = 30, + /** type class of singletons */ + typelib_TypeClass_SINGLETON = 31, + /** fixing enum size */ + typelib_TypeClass_MAKE_FIXED_SIZE = SAL_MAX_ENUM +} typelib_TypeClass; + +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/include/typelib/typedescription.h b/include/typelib/typedescription.h new file mode 100644 index 000000000000..89d718f58433 --- /dev/null +++ b/include/typelib/typedescription.h @@ -0,0 +1,1148 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ +#ifndef _TYPELIB_TYPEDESCRIPTION_H_ +#define _TYPELIB_TYPEDESCRIPTION_H_ + +#include +#include +#include +#include + +#ifdef __cplusplus +extern "C" +{ +#endif + +struct _typelib_TypeDescription; + +#if defined( SAL_W32) +#pragma pack(push, 8) +#endif + +/** Holds a weak reference to a type description. +*/ +typedef struct _typelib_TypeDescriptionReference +{ + /** reference count of type; don't ever modify this by yourself, use + typelib_typedescriptionreference_acquire() and typelib_typedescriptionreference_release() + */ + sal_Int32 nRefCount; + /** number of static references of type, because of the fact that some types are needed + until program termination and are commonly held static. + */ + sal_Int32 nStaticRefCount; + /** type class of type + */ + typelib_TypeClass eTypeClass; + /** fully qualified name of type + */ + rtl_uString * pTypeName; + /** pointer to full typedescription; this value is only valid if the type is never swapped out + */ + struct _typelib_TypeDescription * pType; + /** pointer to optimize the runtime; not for public use + */ + void * pUniqueIdentifier; + /** reserved for future use; 0 if not used + */ + void * pReserved; +} typelib_TypeDescriptionReference; + +/** Full type description of a type. Memory layout of this struct is identical to the + typelib_TypeDescriptionReference for the first six members. + So a typedescription can be used as type reference. +*/ +typedef struct _typelib_TypeDescription +{ + /** reference count; don't ever modify this by yourself, use + typelib_typedescription_acquire() and typelib_typedescription_release() + */ + sal_Int32 nRefCount; + /** number of static references of type, because of the fact that some types are needed + until program termination and are commonly held static. + */ + sal_Int32 nStaticRefCount; + /** type class of type + */ + typelib_TypeClass eTypeClass; + /** fully qualified name of type + */ + rtl_uString * pTypeName; + /** pointer to self to distinguish reference from description; for internal use only + */ + struct _typelib_TypeDescription * pSelf; + /** pointer to optimize the runtime; not for public use + */ + void * pUniqueIdentifier; + /** reserved for future use; 0 if not used + */ + void * pReserved; + + /** flag to determine whether the description is complete: + compound and union types lack of member names, enums lack of member types and names, + interfaces lack of members and table init. + Call typelib_typedescription_complete() if false. + */ + sal_Bool bComplete; + /** size of type + */ + sal_Int32 nSize; + /** alignment of type + */ + sal_Int32 nAlignment; + /** pointer to weak reference + */ + typelib_TypeDescriptionReference * pWeakRef; + /** determines, if type can be unloaded (and it is possible to reloaded it) + */ + sal_Bool bOnDemand; +} typelib_TypeDescription; + +/** Type description for exception types. +*/ +typedef struct _typelib_CompoundTypeDescription +{ + /** inherits all members of typelib_TypeDescription + */ + typelib_TypeDescription aBase; + + /** pointer to base type description, else 0 + */ + struct _typelib_CompoundTypeDescription * pBaseTypeDescription; + + /** number of members + */ + sal_Int32 nMembers; + /** byte offsets of each member including the size the base type + */ + sal_Int32 * pMemberOffsets; + /** members of the struct or exception + */ + typelib_TypeDescriptionReference ** ppTypeRefs; + /** member names of the struct or exception + */ + rtl_uString ** ppMemberNames; +} typelib_CompoundTypeDescription; + +/** + Type description for struct types. + + This is only used to represent plain struct types and instantiated + polymorphic struct types; there is no representation of polymorphic struct + type templates at this level. + + @since UDK 3.2.0 + */ +typedef struct _typelib_StructTypeDescription +{ + /** + Derived from typelib_CompoundTypeDescription. + */ + typelib_CompoundTypeDescription aBase; + + /** + Flags for direct members, specifying whether they are of parameterized + type (true) or explict type (false). + + For a plain struct type, this is a null pointer. + */ + sal_Bool * pParameterizedTypes; +} typelib_StructTypeDescription; + +/** Type description of a union. The type class of this description is typelib_TypeClass_UNION. +*/ +typedef struct _typelib_UnionTypeDescription +{ + /** inherits all members of typelib_TypeDescription + */ + typelib_TypeDescription aBase; + + /** type of the discriminant + */ + typelib_TypeDescriptionReference * pDiscriminantTypeRef; + + /** union default descriminant + */ + sal_Int64 nDefaultDiscriminant; + /** union default member type (may be 0) + */ + typelib_TypeDescriptionReference * pDefaultTypeRef; + /** number of union member types + */ + sal_Int32 nMembers; + /** union member discriminant values (same order as idl declaration) + */ + sal_Int64 * pDiscriminants; + /** union member value types (same order as idl declaration) + */ + typelib_TypeDescriptionReference ** ppTypeRefs; + /** union member value names (same order as idl declaration) + */ + rtl_uString ** ppMemberNames; + /** union value offset for data access + */ + sal_Int32 nValueOffset; +} typelib_UnionTypeDescription; + +/** Type description of an array or sequence. +*/ +typedef struct _typelib_IndirectTypeDescription +{ + /** inherits all members of typelib_TypeDescription + */ + typelib_TypeDescription aBase; + + /** array, sequence: pointer to element type + */ + typelib_TypeDescriptionReference * pType; +} typelib_IndirectTypeDescription; + +/** Type description of an array. +*/ +typedef struct _typelib_ArrayTypeDescription +{ + /** inherits all members of typelib_IndirectTypeDescription + */ + typelib_IndirectTypeDescription aBase; + + /** number of dimensions + */ + sal_Int32 nDimensions; + /** number of total array elements + */ + sal_Int32 nTotalElements; + /** array of dimensions + */ + sal_Int32 * pDimensions; +} typelib_ArrayTypeDescription; + +/** Type description of an enum. The type class of this description is typelib_TypeClass_ENUM. +*/ +typedef struct _typelib_EnumTypeDescription +{ + /** inherits all members of typelib_TypeDescription + */ + typelib_TypeDescription aBase; + + /** first value of the enum + */ + sal_Int32 nDefaultEnumValue; + /** number of enum values + */ + sal_Int32 nEnumValues; + /** names of enum values + */ + rtl_uString ** ppEnumNames; + /** values of enum (corresponding to names in similar order) + */ + sal_Int32 * pEnumValues; +} typelib_EnumTypeDescription; + +/** Description of an interface method parameter. +*/ +typedef struct _typelib_MethodParameter +{ + /** name of parameter + */ + rtl_uString * pName; + /** type of parameter + */ + typelib_TypeDescriptionReference * pTypeRef; + /** true: the call type of this parameter is [in] or [inout] + false: the call type of this parameter is [out] + */ + sal_Bool bIn; + /** true: the call type of this parameter is [out] or [inout] + false: the call type of this parameter is [in] + */ + sal_Bool bOut; +} typelib_MethodParameter; + +/** Common base type description of typelib_InterfaceMethodTypeDescription and + typelib_InterfaceAttributeTypeDescription. +*/ +typedef struct _typelib_InterfaceMemberTypeDescription +{ + /** inherits all members of typelib_TypeDescription + */ + typelib_TypeDescription aBase; + + /** position of member in the interface including the number of members of + any base interfaces + */ + sal_Int32 nPosition; + /** name of member + */ + rtl_uString * pMemberName; +} typelib_InterfaceMemberTypeDescription; + +/** Type description of an interface method. The type class of this description is + typelib_TypeClass_INTERFACE_METHOD. The size and the alignment are 0. +*/ +typedef struct _typelib_InterfaceMethodTypeDescription +{ + /** inherits all members of typelib_InterfaceMemberTypeDescription + */ + typelib_InterfaceMemberTypeDescription aBase; + + /** type of the return value + */ + typelib_TypeDescriptionReference * pReturnTypeRef; + /** number of parameters + */ + sal_Int32 nParams; + /** array of parameters + */ + typelib_MethodParameter * pParams; + /** number of exceptions + */ + sal_Int32 nExceptions; + /** array of exception types + */ + typelib_TypeDescriptionReference ** ppExceptions; + /** determines whether method is declared oneway + */ + sal_Bool bOneWay; + + /** the interface description this method is a member of + */ + struct _typelib_InterfaceTypeDescription * pInterface; + /** the inherited direct base method (null for a method that is not + inherited) + + @since UDK 3.2.0 + */ + typelib_TypeDescriptionReference * pBaseRef; + /** if pBaseRef is null, the member position of this method within + pInterface, not counting members inherited from bases; if pBaseRef is + not null, the index of the direct base within pInterface from which this + method is inherited + + @since UDK 3.2.0 + */ + sal_Int32 nIndex; +} typelib_InterfaceMethodTypeDescription; + +/** The description of an interface attribute. The type class of this description is + typelib_TypeClass_INTERFACE_ATTRIBUTE. The size and the alignment are 0. +*/ +typedef struct _typelib_InterfaceAttributeTypeDescription +{ + /** inherits all members of typelib_InterfaceMemberTypeDescription + */ + typelib_InterfaceMemberTypeDescription aBase; + + /** determines whether attribute is read only + */ + sal_Bool bReadOnly; + /** type of the attribute + */ + typelib_TypeDescriptionReference * pAttributeTypeRef; + + /** the interface description this attribute is a member of + */ + struct _typelib_InterfaceTypeDescription * pInterface; + /** the inherited direct base attribute (null for an attribute that is not + inherited) + + @since UDK 3.2.0 + */ + typelib_TypeDescriptionReference * pBaseRef; + /** if pBaseRef is null, the member position of this attribute within + pInterface, not counting members inherited from bases; if pBaseRef is + not null, the index of the direct base within pInterface from which this + attribute is inherited + + @since UDK 3.2.0 + */ + sal_Int32 nIndex; + /** number of getter exceptions + + @since UDK 3.2.0 + */ + sal_Int32 nGetExceptions; + /** array of getter exception types + + @since UDK 3.2.0 + */ + typelib_TypeDescriptionReference ** ppGetExceptions; + /** number of setter exceptions + + @since UDK 3.2.0 + */ + sal_Int32 nSetExceptions; + /** array of setter exception types + + @since UDK 3.2.0 + */ + typelib_TypeDescriptionReference ** ppSetExceptions; +} typelib_InterfaceAttributeTypeDescription; + +/** Type description of an interface. + +

Not all members are always initialized (not yet initialized members being + null); there are three levels:

+
    +
  • Minimally, only aBase, + pBaseTypeDescription, aUik, + nBaseTypes, and ppBaseTypes are initialized; + aBase.bComplete is false. This only happens when an + interface type description is created with + typelib_static_mi_interface_type_init or + typelib_static_interface_type_init.
  • + +
  • At the next level, nMembers, ppMembers, + nAllMembers, ppAllMembers are also + initialized; aBase.bComplete is still false. This happens + when an interface type description is created with + typelib_typedescription_newMIInterface or + typelib_typedescription_newInterface.
  • + +
  • At the final level, pMapMemberIndexToFunctionIndex, + nMapFunctionIndexToMemberIndex, and + pMapFunctionIndexToMemberIndex are also initialized; + aBase.bComplete is true. This happens after a call to + typelib_typedescription_complete.
  • +
+*/ +typedef struct _typelib_InterfaceTypeDescription +{ + /** inherits all members of typelib_TypeDescription + */ + typelib_TypeDescription aBase; + + /** pointer to base type description, else 0 + + @deprecated + use nBaseTypes and ppBaseTypes instead + */ + struct _typelib_InterfaceTypeDescription * pBaseTypeDescription; + /** unique identifier of interface + */ + typelib_Uik aUik; + /** number of members + */ + sal_Int32 nMembers; + /** array of members; references attributes or methods + */ + typelib_TypeDescriptionReference ** ppMembers; + /** number of members including members of base interface + */ + sal_Int32 nAllMembers; + /** array of members including members of base interface; references attributes or methods + */ + typelib_TypeDescriptionReference ** ppAllMembers; + /** array mapping index of the member description to an index doubling for read-write + attributes (called function index); size of array is nAllMembers + */ + sal_Int32 * pMapMemberIndexToFunctionIndex; + /** number of members plus number of read-write attributes + */ + sal_Int32 nMapFunctionIndexToMemberIndex; + /** array mapping function index to member index; size of arry is nMapFunctionIndexToMemberIndex + */ + sal_Int32 * pMapFunctionIndexToMemberIndex; + /** number of base types + + @since UDK 3.2.0 + */ + sal_Int32 nBaseTypes; + /** array of base type descriptions + + @since UDK 3.2.0 + */ + struct _typelib_InterfaceTypeDescription ** ppBaseTypes; +} typelib_InterfaceTypeDescription; + +/** Init struct of compound members for typelib_typedescription_new(). +*/ +typedef struct _typelib_CompoundMember_Init +{ + /** type class of compound member + */ + typelib_TypeClass eTypeClass; + /** name of type of compound member + + For a member of an instantiated polymorphic struct type that is of + parameterized type, this will be a null pointer. + */ + rtl_uString * pTypeName; + /** name of compound member + */ + rtl_uString * pMemberName; +} typelib_CompoundMember_Init; + +/** + Init struct of members for typelib_typedescription_newStruct(). + + @since UDK 3.2.0 + */ +typedef struct _typelib_StructMember_Init +{ + /** + Derived from typelib_CompoundMember_Init; + */ + typelib_CompoundMember_Init aBase; + + /** + Flag specifying whether the member is of parameterized type (true) or + explict type (false). + */ + sal_Bool bParameterizedType; +} typelib_StructMember_Init; + +/** Init struct of interface methods for typelib_typedescription_new(). +*/ +typedef struct _typelib_Parameter_Init +{ + /** type class of parameter + */ + typelib_TypeClass eTypeClass; + /** name of parameter + */ + rtl_uString * pTypeName; + /** name of parameter + */ + rtl_uString * pParamName; + /** true, if parameter is [in] or [inout] + */ + sal_Bool bIn; + /** true, if parameter is [out] or [inout] + */ + sal_Bool bOut; +} typelib_Parameter_Init; + +/** Init struct of union types for typelib_typedescription_newUnion(). +*/ +typedef struct _typelib_Union_Init +{ + /** union member discriminant + */ + sal_Int64 nDiscriminant; + /** union member name + */ + rtl_uString * pMemberName; + /** union member type + */ + typelib_TypeDescriptionReference* pTypeRef; +} typelib_Union_Init; + +#if defined( SAL_W32) +#pragma pack(pop) +#endif + + +/** Creates a union type description. All discriminants are handled as int64 values. + The pDiscriminantTypeRef must be of type byte, short, ..., up to hyper. + + @param ppRet inout union type description + @param pTypeName name of union type + @param pDiscriminantTypeRef discriminant type + @param nDefaultDiscriminant default discriminant + @param pDefaultTypeRef default value type of union + @param nMembers number of union members + @param pMembers init members +*/ +CPPU_DLLPUBLIC void SAL_CALL typelib_typedescription_newUnion( + typelib_TypeDescription ** ppRet, + rtl_uString * pTypeName, + typelib_TypeDescriptionReference * pDiscriminantTypeRef, + sal_Int64 nDefaultDiscriminant, + typelib_TypeDescriptionReference * pDefaultTypeRef, + sal_Int32 nMembers, + typelib_Union_Init * pMembers ) + SAL_THROW_EXTERN_C(); + +/** Creates an enum type description. + + @param ppRet inout enum type description + @param pTypeName name of enum + @param nDefaultValue default enum value + @param nEnumValues number of enum values + @param ppEnumNames names of enum values + @param pEnumValues enum values +*/ +CPPU_DLLPUBLIC void SAL_CALL typelib_typedescription_newEnum( + typelib_TypeDescription ** ppRet, + rtl_uString * pTypeName, + sal_Int32 nDefaultValue, + sal_Int32 nEnumValues, + rtl_uString ** ppEnumNames, + sal_Int32 * pEnumValues ) + SAL_THROW_EXTERN_C(); + +/** Creates an array type description. + + @param ppRet inout enum type description + @param pElementTypeRef element type + @param nDimensions number of dimensions + @param pDimensions dimensions +*/ +CPPU_DLLPUBLIC void SAL_CALL typelib_typedescription_newArray( + typelib_TypeDescription ** ppRet, + typelib_TypeDescriptionReference * pElementTypeRef, + sal_Int32 nDimensions, + sal_Int32 * pDimensions ) + SAL_THROW_EXTERN_C (); + +/** Creates a new type description. + + Since this function can only be used to create type descriptions for plain + struct types, not for instantiated polymorphic struct types, the function + typelib_typedescription_newStruct should be used instead for all struct + types. + + @param ppRet inout type description + @param eTypeClass type class + @param pTypeName name of type + @param pType sequence, array: element type; + struct, Exception: base type; + @param nMembers number of members if struct, exception + @param pMembers array of members if struct, exception +*/ +CPPU_DLLPUBLIC void SAL_CALL typelib_typedescription_new( + typelib_TypeDescription ** ppRet, + typelib_TypeClass eTypeClass, + rtl_uString * pTypeName, + typelib_TypeDescriptionReference * pType, + sal_Int32 nMembers, + typelib_CompoundMember_Init * pMembers ) + SAL_THROW_EXTERN_C(); + +/** Creates a new struct type description. + + @param ppRet inout type description + @param pTypeName name of type + @param pType base type; + @param nMembers number of members + @param pMembers array of members + + @since UDK 3.2.0 +*/ +CPPU_DLLPUBLIC void SAL_CALL typelib_typedescription_newStruct( + typelib_TypeDescription ** ppRet, + rtl_uString * pTypeName, + typelib_TypeDescriptionReference * pType, + sal_Int32 nMembers, + typelib_StructMember_Init * pMembers ) + SAL_THROW_EXTERN_C(); + +/** Creates an interface type description. + + @param ppRet inout interface type description + @param pTypeName the fully qualified name of the interface. + @param nUik1 uik part + @param nUik2 uik part + @param nUik3 uik part + @param nUik4 uik part + @param nUik5 uik part + @param pBaseInterface base interface type, else 0 + @param nMembers number of members + @param ppMembers members; attributes or methods + + @deprecated + use typelib_typedescription_newMIInterface instead +*/ +CPPU_DLLPUBLIC void SAL_CALL typelib_typedescription_newInterface( + typelib_InterfaceTypeDescription ** ppRet, + rtl_uString * pTypeName, + sal_uInt32 nUik1, sal_uInt16 nUik2, sal_uInt16 nUik3, sal_uInt32 nUik4, sal_uInt32 nUik5, + typelib_TypeDescriptionReference * pBaseInterface, + sal_Int32 nMembers, + typelib_TypeDescriptionReference ** ppMembers ) + SAL_THROW_EXTERN_C(); + +/** Creates a multiple-inheritance interface type description. + + @param ppRet inout interface type description + @param pTypeName the fully qualified name of the interface. + @param nUik1 uik part + @param nUik2 uik part + @param nUik3 uik part + @param nUik4 uik part + @param nUik5 uik part + @param nBaseInterfaces number of base interface types + @param ppBaseInterfaces base interface types + @param nMembers number of members + @param ppMembers members; attributes or methods + + @since UDK 3.2.0 +*/ +CPPU_DLLPUBLIC void SAL_CALL typelib_typedescription_newMIInterface( + typelib_InterfaceTypeDescription ** ppRet, + rtl_uString * pTypeName, + sal_uInt32 nUik1, sal_uInt16 nUik2, sal_uInt16 nUik3, sal_uInt32 nUik4, sal_uInt32 nUik5, + sal_Int32 nBaseInterfaces, + typelib_TypeDescriptionReference ** ppBaseInterfaces, + sal_Int32 nMembers, + typelib_TypeDescriptionReference ** ppMembers ) + SAL_THROW_EXTERN_C(); + +/** Creates an interface method type description. + + @param ppRet inout method type description + @param nAbsolutePosition position of member including all members of base interfaces + @param bOneWay determines whether method is declared oneway + @param pMethodName fully qualified name of method including interface name + @param eReturnTypeClass type class of return type + @param pReturnTypeName type name of the return type + @param nParams number of parameters + @param pParams parameter types + @param nExceptions number of exceptions + @param ppExceptionNames type names of exceptions +*/ +CPPU_DLLPUBLIC void SAL_CALL typelib_typedescription_newInterfaceMethod( + typelib_InterfaceMethodTypeDescription ** ppRet, + sal_Int32 nAbsolutePosition, + sal_Bool bOneWay, + rtl_uString * pMethodName, + typelib_TypeClass eReturnTypeClass, + rtl_uString * pReturnTypeName, + sal_Int32 nParams, + typelib_Parameter_Init * pParams, + sal_Int32 nExceptions, + rtl_uString ** ppExceptionNames ) + SAL_THROW_EXTERN_C(); + +/** Creates an interface attribute type description. + + @param ppRet inout attribute type description + @param nAbsolutePosition position of this attribute including all members of base interfaces + @param pAttributeName fully qualified name of attribute including interface + name + @param eAttributeTypeClass type class of attribute type + @param pAttributeTypeName type name of attribute type + @param bReadOnly determines whether attribute is read-only + + @deprecated + use typelib_typedescription_newExtendedInterfaceAttribute instead +*/ +CPPU_DLLPUBLIC void SAL_CALL typelib_typedescription_newInterfaceAttribute( + typelib_InterfaceAttributeTypeDescription ** ppRet, + sal_Int32 nAbsolutePosition, + rtl_uString * pAttributeName, + typelib_TypeClass eAttributeTypeClass, + rtl_uString * pAttributeTypeName, + sal_Bool bReadOnly ) + SAL_THROW_EXTERN_C(); + +/** Creates an extended interface attribute type description. + + @param ppRet inout attribute type description + @param nAbsolutePosition position of this attribute including all members of + base interfaces + @param pAttributeName fully qualified name of attribute including interface + name + @param eAttributeTypeClass type class of attribute type + @param pAttributeTypeName type name of attribute type + @param bReadOnly determines whether attribute is read-only + @param nGetExceptions number of getter exceptions + @param ppGetExceptionNames type names of getter exceptions + @param nSetExceptions number of setter exceptions + @param ppSetExceptionNames type names of setter exceptions + + @since UDK 3.2.0 +*/ +CPPU_DLLPUBLIC void SAL_CALL typelib_typedescription_newExtendedInterfaceAttribute( + typelib_InterfaceAttributeTypeDescription ** ppRet, + sal_Int32 nAbsolutePosition, + rtl_uString * pAttributeName, + typelib_TypeClass eAttributeTypeClass, + rtl_uString * pAttributeTypeName, + sal_Bool bReadOnly, + sal_Int32 nGetExceptions, rtl_uString ** ppGetExceptionNames, + sal_Int32 nSetExceptions, rtl_uString ** ppSetExceptionNames ) + SAL_THROW_EXTERN_C(); + +/** Increments reference count of given type description. + + @param pDesc type description +*/ +CPPU_DLLPUBLIC void SAL_CALL typelib_typedescription_acquire( + typelib_TypeDescription * pDesc ) + SAL_THROW_EXTERN_C(); + +/** Decrements reference count of given type. If reference count reaches 0, the trype description + is deleted. + + @param pDesc type description +*/ +CPPU_DLLPUBLIC void SAL_CALL typelib_typedescription_release( + typelib_TypeDescription * pDesc ) + SAL_THROW_EXTERN_C(); + +/** Registers a type description and creates a type description reference. Type descriptions + will be registered automatically if they are provided via the callback chain. + + @param ppNewDescription inout description to be registered; +*/ +CPPU_DLLPUBLIC void SAL_CALL typelib_typedescription_register( + typelib_TypeDescription ** ppNewDescription ) + SAL_THROW_EXTERN_C(); + +/** Tests whether two types descriptions are equal, i.e. type class and names are equal. + + @param p1 a type description + @param p2 another type description + @return true, if type descriptions are equal +*/ +CPPU_DLLPUBLIC sal_Bool SAL_CALL typelib_typedescription_equals( + const typelib_TypeDescription * p1, const typelib_TypeDescription * p2 ) + SAL_THROW_EXTERN_C(); + +/** Retrieves a type description via its fully qualified name. + + @param ppRet inout type description; *ppRet is 0, if type description was not found + @param pName name demanded type description +*/ +CPPU_DLLPUBLIC void SAL_CALL typelib_typedescription_getByName( + typelib_TypeDescription ** ppRet, rtl_uString * pName ) + SAL_THROW_EXTERN_C(); + +/** Sets size of type description cache. + + @param nNewSize new size of cache +*/ +CPPU_DLLPUBLIC void SAL_CALL typelib_setCacheSize( + sal_Int32 nNewSize ) + SAL_THROW_EXTERN_C(); + +/** Function pointer declaration of callback function get additional descriptions. Callbacks + must provide complete type descriptions (see typelib_typedescription_complete())! + + @param pContext callback context + @param ppRet inout type description + @param pTypeName name of demanded type description +*/ +typedef void (SAL_CALL * typelib_typedescription_Callback)( + void * pContext, typelib_TypeDescription ** ppRet, rtl_uString * pTypeName ); + +/** Registers callback function providing additional type descriptions. + + @param pContext callback context + @param pCallback callback function +*/ +CPPU_DLLPUBLIC void SAL_CALL typelib_typedescription_registerCallback( + void * pContext, typelib_typedescription_Callback pCallback ) + SAL_THROW_EXTERN_C(); + +/** Revokes a previously registered callback function. + + @param pContext callback context + @param pCallback registered callback function +*/ +CPPU_DLLPUBLIC void SAL_CALL typelib_typedescription_revokeCallback( + void * pContext, typelib_typedescription_Callback pCallback ) + SAL_THROW_EXTERN_C(); + + +/*----------------------------------------------------------------------------*/ +/*----------------------------------------------------------------------------*/ +/*----------------------------------------------------------------------------*/ + +/// @cond INTERNAL + +/** Returns true, if the type description reference may lose the type description. Otherwise + pType is a valid pointer and cannot be discarded through the lifetime of this reference. + Remark: If the pWeakObj of the type is set too, you can avoid the call of + ...getDescription(...) and use the description directly. pWeakObj == 0 means, that the + description is not initialized. +*/ +#define TYPELIB_TYPEDESCRIPTIONREFERENCE_ISREALLYWEAK( eTypeClass ) \ + ((eTypeClass) == typelib_TypeClass_INTERFACE_METHOD || \ + (eTypeClass) == typelib_TypeClass_INTERFACE_ATTRIBUTE) + +/** Gets a description from the reference. The description may not be locked by this call. + You must use the TYPELIB_DANGER_RELEASE macro to release the description fetched with + this macro. +*/ +#define TYPELIB_DANGER_GET( ppDescription, pTypeRef ) \ +{ \ + typelib_TypeDescriptionReference * pMacroTypeRef = (pTypeRef); \ + typelib_TypeDescription ** ppMacroTypeDescr = (ppDescription); \ + if (TYPELIB_TYPEDESCRIPTIONREFERENCE_ISREALLYWEAK( pMacroTypeRef->eTypeClass )) \ + { \ + typelib_typedescriptionreference_getDescription( ppMacroTypeDescr, pMacroTypeRef ); \ + } \ + else if (!pMacroTypeRef->pType || !pMacroTypeRef->pType->pWeakRef) \ + { \ + typelib_typedescriptionreference_getDescription( ppMacroTypeDescr, pMacroTypeRef ); \ + if (*ppMacroTypeDescr) \ + typelib_typedescription_release( *ppMacroTypeDescr ); \ + } \ + else \ + { \ + *ppMacroTypeDescr = pMacroTypeRef->pType; \ + } \ +} + +/** Releases the description previouse fetched by TYPELIB_DANGER_GET. +*/ +#define TYPELIB_DANGER_RELEASE( pDescription ) \ +{ \ + if (TYPELIB_TYPEDESCRIPTIONREFERENCE_ISREALLYWEAK( (pDescription)->eTypeClass )) \ + typelib_typedescription_release( pDescription ); \ +} + +/// @endcond + +/** Creates a type description reference. This is a weak reference not holding the description. + If the description is already registered, the previous one is returned. + + @param ppTDR inout type description reference + @param eTypeClass type class of type + @param pTypeName name of type +*/ +CPPU_DLLPUBLIC void SAL_CALL typelib_typedescriptionreference_new( + typelib_TypeDescriptionReference ** ppTDR, + typelib_TypeClass eTypeClass, + rtl_uString * pTypeName ) + SAL_THROW_EXTERN_C(); + +/** Creates a type description reference. This is a weak reference not holding the description. + If the description is already registered, the previous one is returned. + + @param ppTDR inout type description reference + @param eTypeClass type class of type + @param pTypeName ascii name of type +*/ +CPPU_DLLPUBLIC void SAL_CALL typelib_typedescriptionreference_newByAsciiName( + typelib_TypeDescriptionReference ** ppTDR, + typelib_TypeClass eTypeClass, + const sal_Char * pTypeName ) + SAL_THROW_EXTERN_C(); + +/** Increments reference count of type description reference. + + @param pRef type description reference +*/ +CPPU_DLLPUBLIC void SAL_CALL typelib_typedescriptionreference_acquire( + typelib_TypeDescriptionReference * pRef ) + SAL_THROW_EXTERN_C(); + +/** Increments reference count of type description reference. If the reference count reaches 0, + then the reference is deleted. + + @param pRef type description reference +*/ +CPPU_DLLPUBLIC void SAL_CALL typelib_typedescriptionreference_release( + typelib_TypeDescriptionReference * pRef ) + SAL_THROW_EXTERN_C(); + +/** Retrieves the type description for a given reference. If it is not possible to resolve the + reference, null is returned. + + @param[in,out] ppRet type description + @param[in] pRef type description reference +*/ +CPPU_DLLPUBLIC void SAL_CALL typelib_typedescriptionreference_getDescription( + typelib_TypeDescription ** ppRet, typelib_TypeDescriptionReference * pRef ) + SAL_THROW_EXTERN_C(); + +/** Tests whether two types description references are equal, i.e. type class and names are equal. + + @param p1 a type description reference + @param p2 another type description reference + @return true, if type description references are equal +*/ +CPPU_DLLPUBLIC sal_Bool SAL_CALL typelib_typedescriptionreference_equals( + const typelib_TypeDescriptionReference * p1, const typelib_TypeDescriptionReference * p2 ) + SAL_THROW_EXTERN_C(); + +/** Assigns a type. + + @param ppDest destination type + @param pSource source type +*/ +CPPU_DLLPUBLIC void SAL_CALL typelib_typedescriptionreference_assign( + typelib_TypeDescriptionReference ** ppDest, + typelib_TypeDescriptionReference * pSource ) + SAL_THROW_EXTERN_C(); + +/** Tests if values of type pAssignable can be assigned by values of type pFrom. This includes + widening conversion (e.g., long assignable from short), as long as there is no data loss. + + @param pAssignable type description of value to be assigned + @param pFrom type description of value +*/ +CPPU_DLLPUBLIC sal_Bool SAL_CALL typelib_typedescription_isAssignableFrom( + typelib_TypeDescription * pAssignable, + typelib_TypeDescription * pFrom ) + SAL_THROW_EXTERN_C(); + +/** Tests if values of type pAssignable can be assigned by values of type pFrom. This includes + widening conversion (e.g., long assignable from short), as long as there is no data loss. + + @param pAssignable type of value to be assigned + @param pFrom type of value +*/ +CPPU_DLLPUBLIC sal_Bool SAL_CALL typelib_typedescriptionreference_isAssignableFrom( + typelib_TypeDescriptionReference * pAssignable, + typelib_TypeDescriptionReference * pFrom ) + SAL_THROW_EXTERN_C(); + +/** Gets static type reference of standard types by type class. + ADDITIONAL OPT: provides Type com.sun.star.uno.Exception for typelib_TypeClass_EXCEPTION + and com.sun.star.uno.XInterface for typelib_TypeClass_INTERFACE. + + Thread synchronizes on typelib mutex. + + @param eTypeClass type class of basic type + @return pointer to type reference pointer +*/ +CPPU_DLLPUBLIC typelib_TypeDescriptionReference ** SAL_CALL typelib_static_type_getByTypeClass( + typelib_TypeClass eTypeClass ) + SAL_THROW_EXTERN_C(); + +/** Inits static type reference. Thread synchronizes on typelib init mutex. + + @param ppRef pointer to type reference pointer + @param eTypeClass type class of type + @param pTypeName ascii name of type +*/ +CPPU_DLLPUBLIC void SAL_CALL typelib_static_type_init( + typelib_TypeDescriptionReference ** ppRef, + typelib_TypeClass eTypeClass, const sal_Char * pTypeName ) + SAL_THROW_EXTERN_C(); + +/** Inits static sequence type reference. Thread synchronizes on typelib init mutex. + + @param ppRef pointer to type reference pointer + @param pElementType element type of sequence +*/ +CPPU_DLLPUBLIC void SAL_CALL typelib_static_sequence_type_init( + typelib_TypeDescriptionReference ** ppRef, + typelib_TypeDescriptionReference * pElementType ) + SAL_THROW_EXTERN_C (); + +/** Inits static array type reference. Thread synchronizes on typelib init mutex. + + @param ppRef pointer to type reference pointer + @param pElementType element type of sequence + @param nDimensions number of dimensions + @param ... additional sal_Int32 parameter for each dimension +*/ +CPPU_DLLPUBLIC void SAL_CALL typelib_static_array_type_init( + typelib_TypeDescriptionReference ** ppRef, + typelib_TypeDescriptionReference * pElementType, + sal_Int32 nDimensions, ... ) + SAL_THROW_EXTERN_C (); + +/** Inits incomplete static compound type reference. Thread synchronizes on typelib init mutex. + + Since this function can only be used to create type descriptions for plain + struct types, not for instantiated polymorphic struct types, the function + typelib_static_struct_type_init should be used instead for all struct types. + + @param ppRef pointer to type reference pointer + @param eTypeClass typelib_TypeClass_STRUCT or typelib_TypeClass_EXCEPTION + @param pTypeName name of type + @param pBaseType base type + @param nMembers number of members + @param ppMembers member types +*/ +CPPU_DLLPUBLIC void SAL_CALL typelib_static_compound_type_init( + typelib_TypeDescriptionReference ** ppRef, + typelib_TypeClass eTypeClass, const sal_Char * pTypeName, + typelib_TypeDescriptionReference * pBaseType, + sal_Int32 nMembers, typelib_TypeDescriptionReference ** ppMembers ) + SAL_THROW_EXTERN_C(); + +/** Inits incomplete static struct type reference. + + Thread synchronizes on typelib init mutex. + + @param ppRef pointer to type reference pointer + @param pTypeName name of type + @param pBaseType base type + @param nMembers number of members + @param ppMembers member types + @param pParameterizedTypes flags for direct members, specifying whether they + are of parameterized type (true) or explict type (false); must be null + for a plain struct type + + @since UDK 3.2.0 +*/ +CPPU_DLLPUBLIC void SAL_CALL typelib_static_struct_type_init( + typelib_TypeDescriptionReference ** ppRef, const sal_Char * pTypeName, + typelib_TypeDescriptionReference * pBaseType, + sal_Int32 nMembers, typelib_TypeDescriptionReference ** ppMembers, + sal_Bool const * pParameterizedTypes ) + SAL_THROW_EXTERN_C(); + +/** Inits incomplete static interface type reference. Thread synchronizes on typelib init mutex. + + @param ppRef pointer to type reference pointer + @param pTypeName name of interface + @param pBaseType base type +*/ +CPPU_DLLPUBLIC void SAL_CALL typelib_static_interface_type_init( + typelib_TypeDescriptionReference ** ppRef, + const sal_Char * pTypeName, + typelib_TypeDescriptionReference * pBaseType ) + SAL_THROW_EXTERN_C(); + +/** Inits incomplete static multiple-inheritance interface type reference. + Thread synchronizes on typelib init mutex. + + @param ppRef pointer to type reference pointer + @param pTypeName name of interface + @param nBaseTypes number of base types + @param ppBaseTypes base types + + @since UDK 3.2.0 +*/ +CPPU_DLLPUBLIC void SAL_CALL typelib_static_mi_interface_type_init( + typelib_TypeDescriptionReference ** ppRef, + const sal_Char * pTypeName, + sal_Int32 nBaseTypes, + typelib_TypeDescriptionReference ** ppBaseTypes ) + SAL_THROW_EXTERN_C(); + +/** Inits incomplete static enum type reference. Thread synchronizes on typelib init mutex. + + @param ppRef pointer to type reference pointer + @param pTypeName name of enum + @param nDefaultValue default enum value +*/ +CPPU_DLLPUBLIC void SAL_CALL typelib_static_enum_type_init( + typelib_TypeDescriptionReference ** ppRef, + const sal_Char * pTypeName, + sal_Int32 nDefaultValue ) + SAL_THROW_EXTERN_C(); + +/** Completes a typedescription to be used for, e.g., marshalling values. COMPOUND, UNION, + INTERFACE and ENUM type descriptions may be partly initialized (see typelib_static_...(), + typelib_TypeDescription::bComplete). For interface type descriptions, this will also + init index tables. + + @param ppTypeDescr [inout] type description to be completed (may be exchanged!) + @return true, if type description is complete +*/ +CPPU_DLLPUBLIC sal_Bool SAL_CALL typelib_typedescription_complete( + typelib_TypeDescription ** ppTypeDescr ) + SAL_THROW_EXTERN_C(); + +#ifdef __cplusplus +} +#endif + +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/include/typelib/typedescription.hxx b/include/typelib/typedescription.hxx new file mode 100644 index 000000000000..1026755749f7 --- /dev/null +++ b/include/typelib/typedescription.hxx @@ -0,0 +1,216 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ +#ifndef _TYPELIB_TYPEDESCRIPTION_HXX_ +#define _TYPELIB_TYPEDESCRIPTION_HXX_ + +#include +#include +#include +#include + + +namespace com +{ +namespace sun +{ +namespace star +{ +namespace uno +{ + +/** C++ wrapper for typelib_TypeDescription. + Constructors by name, type, type description reference will get the full type description. + + @see typelib_TypeDescription +*/ +class TypeDescription +{ + /** C typelib type description + */ + mutable typelib_TypeDescription * _pTypeDescr; + +public: + /// @cond INTERNAL + // these are here to force memory de/allocation to sal lib. + inline static void * SAL_CALL operator new ( size_t nSize ) SAL_THROW(()) + { return ::rtl_allocateMemory( nSize ); } + inline static void SAL_CALL operator delete ( void * pMem ) SAL_THROW(()) + { ::rtl_freeMemory( pMem ); } + inline static void * SAL_CALL operator new ( size_t, void * pMem ) SAL_THROW(()) + { return pMem; } + inline static void SAL_CALL operator delete ( void *, void * ) SAL_THROW(()) + {} + /// @endcond + + /** Constructor: + + @param pTypeDescr a type description + */ + inline TypeDescription( typelib_TypeDescription * pTypeDescr = 0 ) SAL_THROW(()); + /** Constructor: + + @param pTypeDescrRef a type description reference + */ + inline TypeDescription( typelib_TypeDescriptionReference * pTypeDescrRef ) SAL_THROW(()); + /** Constructor: + + @param rType a type + */ + inline TypeDescription( const ::com::sun::star::uno::Type & rType ) SAL_THROW(()); + /** Copy constructor: + + @param rDescr another TypeDescription + */ + inline TypeDescription( const TypeDescription & rDescr ) SAL_THROW(()); + /** Constructor: + + @param pTypeName a type name + */ + inline TypeDescription( rtl_uString * pTypeName ) SAL_THROW(()); + /** Constructor: + + @param rTypeName a type name + */ + inline TypeDescription( const ::rtl::OUString & rTypeName ) SAL_THROW(()); + /** Destructor: releases type description + */ + inline ~TypeDescription() SAL_THROW(()); + + /** Assignment operator: acquires given type description and releases a set one. + + @param pTypeDescr another type description + @return this TypeDescription + */ + inline TypeDescription & SAL_CALL operator = ( typelib_TypeDescription * pTypeDescr ) SAL_THROW(()); + /** Assignment operator: acquires given type description and releases a set one. + + @param rTypeDescr another type description + @return this TypeDescription + */ + inline TypeDescription & SAL_CALL operator =( const TypeDescription & rTypeDescr ) SAL_THROW(()) + { return this->operator =( rTypeDescr.get() ); } + + /** Tests whether two type descriptions are equal. + + @param pTypeDescr another type description + @return true, if both type descriptions are equal, false otherwise + */ + inline sal_Bool SAL_CALL equals( const typelib_TypeDescription * pTypeDescr ) const SAL_THROW(()); + /** Tests whether two type descriptions are equal. + + @param rTypeDescr another type description + @return true, if both type descriptions are equal, false otherwise + */ + inline sal_Bool SAL_CALL equals( const TypeDescription & rTypeDescr ) const SAL_THROW(()) + { return equals( rTypeDescr._pTypeDescr ); } + + /** Makes stored type description complete. + */ + inline void SAL_CALL makeComplete() const SAL_THROW(()); + + /** Gets the UNacquired type description pointer. + + @return stored pointer of type description + */ + inline typelib_TypeDescription * SAL_CALL get() const SAL_THROW(()) + { return _pTypeDescr; } + /** Tests if a type description is set. + + @return true, if a type description is set, false otherwise + */ + inline sal_Bool SAL_CALL is() const SAL_THROW(()) + { return (_pTypeDescr != 0); } +}; +//__________________________________________________________________________________________________ +inline TypeDescription::TypeDescription( typelib_TypeDescription * pTypeDescr ) SAL_THROW(()) + : _pTypeDescr( pTypeDescr ) +{ + if (_pTypeDescr) + typelib_typedescription_acquire( _pTypeDescr ); +} +//__________________________________________________________________________________________________ +inline TypeDescription::TypeDescription( typelib_TypeDescriptionReference * pTypeDescrRef ) SAL_THROW(()) + : _pTypeDescr( 0 ) +{ + if (pTypeDescrRef) + typelib_typedescriptionreference_getDescription( &_pTypeDescr, pTypeDescrRef ); +} +//__________________________________________________________________________________________________ +inline TypeDescription::TypeDescription( const ::com::sun::star::uno::Type & rType ) SAL_THROW(()) + : _pTypeDescr( 0 ) +{ + if (rType.getTypeLibType()) + typelib_typedescriptionreference_getDescription( &_pTypeDescr, rType.getTypeLibType() ); +} +//__________________________________________________________________________________________________ +inline TypeDescription::TypeDescription( const TypeDescription & rTypeDescr ) SAL_THROW(()) + : _pTypeDescr( rTypeDescr._pTypeDescr ) +{ + if (_pTypeDescr) + typelib_typedescription_acquire( _pTypeDescr ); +} +//__________________________________________________________________________________________________ +inline TypeDescription::TypeDescription( rtl_uString * pTypeName ) SAL_THROW(()) + : _pTypeDescr( 0 ) +{ + typelib_typedescription_getByName( &_pTypeDescr , pTypeName ); +} +//__________________________________________________________________________________________________ +inline TypeDescription::TypeDescription( const ::rtl::OUString & rTypeName ) SAL_THROW(()) + : _pTypeDescr( 0 ) +{ + typelib_typedescription_getByName( &_pTypeDescr , rTypeName.pData ); +} +//__________________________________________________________________________________________________ +inline TypeDescription::~TypeDescription() SAL_THROW(()) +{ + if (_pTypeDescr) + typelib_typedescription_release( _pTypeDescr ); +} +//__________________________________________________________________________________________________ +inline TypeDescription & TypeDescription::operator = ( typelib_TypeDescription * pTypeDescr ) SAL_THROW(()) +{ + if (pTypeDescr) + typelib_typedescription_acquire( pTypeDescr ); + if (_pTypeDescr) + typelib_typedescription_release( _pTypeDescr ); + _pTypeDescr = pTypeDescr; + return *this; +} +//__________________________________________________________________________________________________ +inline sal_Bool TypeDescription::equals( const typelib_TypeDescription * pTypeDescr ) const SAL_THROW(()) +{ + return (_pTypeDescr && pTypeDescr && + typelib_typedescription_equals( _pTypeDescr, pTypeDescr )); +} +//__________________________________________________________________________________________________ +inline void TypeDescription::makeComplete() const SAL_THROW(()) +{ + if (_pTypeDescr && !_pTypeDescr->bComplete) + ::typelib_typedescription_complete( &_pTypeDescr ); +} + +} +} +} +} + +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/include/typelib/uik.h b/include/typelib/uik.h new file mode 100644 index 000000000000..097f23793ba7 --- /dev/null +++ b/include/typelib/uik.h @@ -0,0 +1,45 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ +#ifndef _TYPELIB_UIK_H_ +#define _TYPELIB_UIK_H_ + +#include + +#if defined( SAL_W32) +#pragma pack(push, 8) +#endif + +/** Binary typelib uik struct. Internally not used anymore. +*/ +typedef struct _typelib_Uik +{ + sal_uInt32 m_Data1; + sal_uInt16 m_Data2; + sal_uInt16 m_Data3; + sal_uInt32 m_Data4; + sal_uInt32 m_Data5; +} typelib_Uik; + +#if defined( SAL_W32) +# pragma pack(pop) +#endif + +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ -- cgit