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 29cdf0e10cSrcweir #include "typelib/typeclass.h" 30cdf0e10cSrcweir #include "typelib/typedescription.h" 31cdf0e10cSrcweir 32cdf0e10cSrcweir namespace bridges { namespace cpp_uno { namespace shared { 33cdf0e10cSrcweir 34cdf0e10cSrcweir namespace { isSimpleStruct(typelib_TypeDescription const * type)35cdf0e10cSrcweirbool isSimpleStruct(typelib_TypeDescription const * type) { 36cdf0e10cSrcweir switch (type->eTypeClass) { 37cdf0e10cSrcweir case typelib_TypeClass_STRUCT: 38cdf0e10cSrcweir { 39cdf0e10cSrcweir typelib_CompoundTypeDescription const * p 40cdf0e10cSrcweir = reinterpret_cast< typelib_CompoundTypeDescription const * >( 41cdf0e10cSrcweir type); 42cdf0e10cSrcweir for (sal_Int32 i = 0; i < p->nMembers; ++i) { 43cdf0e10cSrcweir switch (p->ppTypeRefs[i]->eTypeClass) { 44cdf0e10cSrcweir case typelib_TypeClass_STRUCT: 45cdf0e10cSrcweir { 46cdf0e10cSrcweir typelib_TypeDescription * t = 0; 47cdf0e10cSrcweir TYPELIB_DANGER_GET(&t, p->ppTypeRefs[i]); 48cdf0e10cSrcweir bool b = isSimpleStruct(t); 49cdf0e10cSrcweir TYPELIB_DANGER_RELEASE(t); 50cdf0e10cSrcweir if (!b) { 51cdf0e10cSrcweir return false; 52cdf0e10cSrcweir } 53cdf0e10cSrcweir } 54cdf0e10cSrcweir break; 55cdf0e10cSrcweir 56cdf0e10cSrcweir default: 57cdf0e10cSrcweir if (!isSimpleType(p->ppTypeRefs[i]->eTypeClass)) 58cdf0e10cSrcweir return false; 59cdf0e10cSrcweir break; 60cdf0e10cSrcweir } 61cdf0e10cSrcweir } 62cdf0e10cSrcweir } 63cdf0e10cSrcweir return true; 64cdf0e10cSrcweir 65cdf0e10cSrcweir default: 66cdf0e10cSrcweir return false; 67cdf0e10cSrcweir } 68cdf0e10cSrcweir } 69cdf0e10cSrcweir } 70cdf0e10cSrcweir isSmallStruct(typelib_TypeDescription const * type)71cdf0e10cSrcweirbool isSmallStruct(typelib_TypeDescription const * type) { 72cdf0e10cSrcweir return (type->nSize <= 8 && isSimpleStruct(type)); 73cdf0e10cSrcweir } 74cdf0e10cSrcweir 75cdf0e10cSrcweir } } } 76