1*74f1be36SAndrew Rist /************************************************************** 2cdf0e10cSrcweir * 3*74f1be36SAndrew Rist * Licensed to the Apache Software Foundation (ASF) under one 4*74f1be36SAndrew Rist * or more contributor license agreements. See the NOTICE file 5*74f1be36SAndrew Rist * distributed with this work for additional information 6*74f1be36SAndrew Rist * regarding copyright ownership. The ASF licenses this file 7*74f1be36SAndrew Rist * to you under the Apache License, Version 2.0 (the 8*74f1be36SAndrew Rist * "License"); you may not use this file except in compliance 9*74f1be36SAndrew Rist * with the License. You may obtain a copy of the License at 10cdf0e10cSrcweir * 11*74f1be36SAndrew Rist * http://www.apache.org/licenses/LICENSE-2.0 12cdf0e10cSrcweir * 13*74f1be36SAndrew Rist * Unless required by applicable law or agreed to in writing, 14*74f1be36SAndrew Rist * software distributed under the License is distributed on an 15*74f1be36SAndrew Rist * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 16*74f1be36SAndrew Rist * KIND, either express or implied. See the License for the 17*74f1be36SAndrew Rist * specific language governing permissions and limitations 18*74f1be36SAndrew Rist * under the License. 19cdf0e10cSrcweir * 20*74f1be36SAndrew Rist *************************************************************/ 21*74f1be36SAndrew Rist 22*74f1be36SAndrew Rist 23cdf0e10cSrcweir 24cdf0e10cSrcweir #ifndef INCLUDED_BRIDGES_CPP_UNO_SHARED_VTABLES_HXX 25cdf0e10cSrcweir #define INCLUDED_BRIDGES_CPP_UNO_SHARED_VTABLES_HXX 26cdf0e10cSrcweir 27cdf0e10cSrcweir #include "sal/types.h" 28cdf0e10cSrcweir #include "typelib/typedescription.h" 29cdf0e10cSrcweir 30cdf0e10cSrcweir namespace bridges { namespace cpp_uno { namespace shared { 31cdf0e10cSrcweir 32cdf0e10cSrcweir /** 33cdf0e10cSrcweir * Calculate the number of local functions of an interface type. 34cdf0e10cSrcweir * 35cdf0e10cSrcweir * <p><em>Local</em> functions are those not inherited from any base types. The 36cdf0e10cSrcweir * number of <em>functions</em> is potentially larger than the number of 37cdf0e10cSrcweir * <em>members</em>, as each read–write attribute member counts as two 38cdf0e10cSrcweir * functions.</p> 39cdf0e10cSrcweir * 40cdf0e10cSrcweir * @param type a non-null pointer to an interface type description, for which 41cdf0e10cSrcweir * <code>typelib_typedescription_complete</code> must already have been 42cdf0e10cSrcweir * executed 43cdf0e10cSrcweir * @return the number of local functions of the given interface type 44cdf0e10cSrcweir */ 45cdf0e10cSrcweir sal_Int32 getLocalFunctions(typelib_InterfaceTypeDescription const * type); 46cdf0e10cSrcweir 47cdf0e10cSrcweir /** 48cdf0e10cSrcweir * Calculate the number of primary functions of an interface type. 49cdf0e10cSrcweir * 50cdf0e10cSrcweir * <p>The number of primary functions of an interface is the number of local 51cdf0e10cSrcweir * functions of that interface (see <code>getLocalFunctions</code>), plus the 52cdf0e10cSrcweir * number of primary functions of that interface's first base type (if it has at 53cdf0e10cSrcweir * least one base type).</p> 54cdf0e10cSrcweir * 55cdf0e10cSrcweir * @param type a pointer to an interface type description; may be null 56cdf0e10cSrcweir * @return the number of primary functions of the given interface type, or zero 57cdf0e10cSrcweir * if the given interface type is null 58cdf0e10cSrcweir */ 59cdf0e10cSrcweir sal_Int32 getPrimaryFunctions(typelib_InterfaceTypeDescription * type); 60cdf0e10cSrcweir 61cdf0e10cSrcweir /** 62cdf0e10cSrcweir * Represents a vtable slot of a C++ class. 63cdf0e10cSrcweir */ 64cdf0e10cSrcweir struct VtableSlot { 65cdf0e10cSrcweir /** 66cdf0e10cSrcweir * The offset of the vtable. 67cdf0e10cSrcweir * 68cdf0e10cSrcweir * <p>Multiple-inheritance C++ classes have more than one vtable. The 69cdf0e10cSrcweir * offset is logical (<em>not</em> a byte offset), and must be 70cdf0e10cSrcweir * non-negative.</p> 71cdf0e10cSrcweir */ 72cdf0e10cSrcweir sal_Int32 offset; 73cdf0e10cSrcweir 74cdf0e10cSrcweir /** 75cdf0e10cSrcweir * The index within the vtable. 76cdf0e10cSrcweir * 77cdf0e10cSrcweir * <p>The index is logical (<em>not</em> a byte offset), and must be 78cdf0e10cSrcweir * non-negative.</p> 79cdf0e10cSrcweir */ 80cdf0e10cSrcweir sal_Int32 index; 81cdf0e10cSrcweir }; 82cdf0e10cSrcweir 83cdf0e10cSrcweir /** 84cdf0e10cSrcweir * Calculates the vtable slot associated with an interface attribute member. 85cdf0e10cSrcweir * 86cdf0e10cSrcweir * @param ifcMember a non-null pointer to an interface attribute member 87cdf0e10cSrcweir * description 88cdf0e10cSrcweir * @return the vtable slot associated with the given interface member 89cdf0e10cSrcweir */ 90cdf0e10cSrcweir VtableSlot getVtableSlot( 91cdf0e10cSrcweir typelib_InterfaceAttributeTypeDescription const * ifcMember); 92cdf0e10cSrcweir 93cdf0e10cSrcweir /** 94cdf0e10cSrcweir * Calculates the vtable slot associated with an interface method member. 95cdf0e10cSrcweir * 96cdf0e10cSrcweir * @param ifcMember a non-null pointer to an interface method member description 97cdf0e10cSrcweir * @return the vtable slot associated with the given interface member 98cdf0e10cSrcweir */ 99cdf0e10cSrcweir VtableSlot getVtableSlot( 100cdf0e10cSrcweir typelib_InterfaceMethodTypeDescription const * ifcMember); 101cdf0e10cSrcweir 102cdf0e10cSrcweir } } } 103cdf0e10cSrcweir 104cdf0e10cSrcweir #endif 105