1*61dff127SAndrew Rist /************************************************************** 2cdf0e10cSrcweir * 3*61dff127SAndrew Rist * Licensed to the Apache Software Foundation (ASF) under one 4*61dff127SAndrew Rist * or more contributor license agreements. See the NOTICE file 5*61dff127SAndrew Rist * distributed with this work for additional information 6*61dff127SAndrew Rist * regarding copyright ownership. The ASF licenses this file 7*61dff127SAndrew Rist * to you under the Apache License, Version 2.0 (the 8*61dff127SAndrew Rist * "License"); you may not use this file except in compliance 9*61dff127SAndrew Rist * with the License. You may obtain a copy of the License at 10*61dff127SAndrew Rist * 11*61dff127SAndrew Rist * http://www.apache.org/licenses/LICENSE-2.0 12*61dff127SAndrew Rist * 13*61dff127SAndrew Rist * Unless required by applicable law or agreed to in writing, 14*61dff127SAndrew Rist * software distributed under the License is distributed on an 15*61dff127SAndrew Rist * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 16*61dff127SAndrew Rist * KIND, either express or implied. See the License for the 17*61dff127SAndrew Rist * specific language governing permissions and limitations 18*61dff127SAndrew Rist * under the License. 19*61dff127SAndrew Rist * 20*61dff127SAndrew Rist *************************************************************/ 21*61dff127SAndrew Rist 22*61dff127SAndrew Rist 23cdf0e10cSrcweir 24cdf0e10cSrcweir // MARKER(update_precomp.py): autogen include statement, do not remove 25cdf0e10cSrcweir #include "precompiled_bridges.hxx" 26cdf0e10cSrcweir 27cdf0e10cSrcweir #include "bridges/cpp_uno/shared/types.hxx" 28cdf0e10cSrcweir #define INCLUDED_BRIDGES_CPP_UNO_SHARED_VTABLES_HXX 29cdf0e10cSrcweir 30cdf0e10cSrcweir #include "typelib/typeclass.h" 31cdf0e10cSrcweir #include "typelib/typedescription.h" 32cdf0e10cSrcweir 33cdf0e10cSrcweir namespace bridges { namespace cpp_uno { namespace shared { 34cdf0e10cSrcweir isSimpleType(typelib_TypeClass typeClass)35cdf0e10cSrcweirbool isSimpleType(typelib_TypeClass typeClass) { 36cdf0e10cSrcweir return typeClass <= typelib_TypeClass_DOUBLE 37cdf0e10cSrcweir || typeClass == typelib_TypeClass_ENUM; 38cdf0e10cSrcweir } 39cdf0e10cSrcweir isSimpleType(typelib_TypeDescriptionReference const * type)40cdf0e10cSrcweirbool isSimpleType(typelib_TypeDescriptionReference const * type) { 41cdf0e10cSrcweir return isSimpleType(type->eTypeClass); 42cdf0e10cSrcweir } 43cdf0e10cSrcweir isSimpleType(typelib_TypeDescription const * type)44cdf0e10cSrcweirbool isSimpleType(typelib_TypeDescription const * type) { 45cdf0e10cSrcweir return isSimpleType(type->eTypeClass); 46cdf0e10cSrcweir } 47cdf0e10cSrcweir relatesToInterfaceType(typelib_TypeDescription const * type)48cdf0e10cSrcweirbool relatesToInterfaceType(typelib_TypeDescription const * type) { 49cdf0e10cSrcweir switch (type->eTypeClass) { 50cdf0e10cSrcweir case typelib_TypeClass_ANY: 51cdf0e10cSrcweir case typelib_TypeClass_INTERFACE: 52cdf0e10cSrcweir return true; 53cdf0e10cSrcweir 54cdf0e10cSrcweir case typelib_TypeClass_STRUCT: 55cdf0e10cSrcweir case typelib_TypeClass_EXCEPTION: 56cdf0e10cSrcweir { 57cdf0e10cSrcweir typelib_CompoundTypeDescription const * p 58cdf0e10cSrcweir = reinterpret_cast< typelib_CompoundTypeDescription const * >( 59cdf0e10cSrcweir type); 60cdf0e10cSrcweir for (sal_Int32 i = 0; i < p->nMembers; ++i) { 61cdf0e10cSrcweir switch (p->ppTypeRefs[i]->eTypeClass) { 62cdf0e10cSrcweir case typelib_TypeClass_ANY: 63cdf0e10cSrcweir case typelib_TypeClass_INTERFACE: 64cdf0e10cSrcweir return true; 65cdf0e10cSrcweir 66cdf0e10cSrcweir case typelib_TypeClass_STRUCT: 67cdf0e10cSrcweir case typelib_TypeClass_EXCEPTION: 68cdf0e10cSrcweir case typelib_TypeClass_SEQUENCE: 69cdf0e10cSrcweir { 70cdf0e10cSrcweir typelib_TypeDescription * t = 0; 71cdf0e10cSrcweir TYPELIB_DANGER_GET(&t, p->ppTypeRefs[i]); 72cdf0e10cSrcweir bool b = relatesToInterfaceType(t); 73cdf0e10cSrcweir TYPELIB_DANGER_RELEASE(t); 74cdf0e10cSrcweir if (b) { 75cdf0e10cSrcweir return true; 76cdf0e10cSrcweir } 77cdf0e10cSrcweir } 78cdf0e10cSrcweir break; 79cdf0e10cSrcweir 80cdf0e10cSrcweir default: 81cdf0e10cSrcweir break; 82cdf0e10cSrcweir } 83cdf0e10cSrcweir } 84cdf0e10cSrcweir if (p->pBaseTypeDescription != 0) { 85cdf0e10cSrcweir return relatesToInterfaceType(&p->pBaseTypeDescription->aBase); 86cdf0e10cSrcweir } 87cdf0e10cSrcweir } 88cdf0e10cSrcweir break; 89cdf0e10cSrcweir 90cdf0e10cSrcweir case typelib_TypeClass_SEQUENCE: 91cdf0e10cSrcweir switch (reinterpret_cast< typelib_IndirectTypeDescription const * >( 92cdf0e10cSrcweir type)->pType->eTypeClass) { 93cdf0e10cSrcweir case typelib_TypeClass_ANY: 94cdf0e10cSrcweir case typelib_TypeClass_INTERFACE: 95cdf0e10cSrcweir return true; 96cdf0e10cSrcweir 97cdf0e10cSrcweir case typelib_TypeClass_STRUCT: 98cdf0e10cSrcweir case typelib_TypeClass_EXCEPTION: 99cdf0e10cSrcweir case typelib_TypeClass_SEQUENCE: 100cdf0e10cSrcweir { 101cdf0e10cSrcweir typelib_TypeDescription * t = 0; 102cdf0e10cSrcweir TYPELIB_DANGER_GET( 103cdf0e10cSrcweir &t, 104cdf0e10cSrcweir reinterpret_cast< typelib_IndirectTypeDescription const * >( 105cdf0e10cSrcweir type)->pType); 106cdf0e10cSrcweir bool b = relatesToInterfaceType(t); 107cdf0e10cSrcweir TYPELIB_DANGER_RELEASE(t); 108cdf0e10cSrcweir return b; 109cdf0e10cSrcweir } 110cdf0e10cSrcweir 111cdf0e10cSrcweir default: 112cdf0e10cSrcweir break; 113cdf0e10cSrcweir } 114cdf0e10cSrcweir break; 115cdf0e10cSrcweir 116cdf0e10cSrcweir default: 117cdf0e10cSrcweir break; 118cdf0e10cSrcweir } 119cdf0e10cSrcweir return false; 120cdf0e10cSrcweir } 121cdf0e10cSrcweir 122cdf0e10cSrcweir } } } 123