1 /************************************************************************* 2 * 3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 4 * 5 * Copyright 2000, 2010 Oracle and/or its affiliates. 6 * 7 * OpenOffice.org - a multi-platform office productivity suite 8 * 9 * This file is part of OpenOffice.org. 10 * 11 * OpenOffice.org is free software: you can redistribute it and/or modify 12 * it under the terms of the GNU Lesser General Public License version 3 13 * only, as published by the Free Software Foundation. 14 * 15 * OpenOffice.org is distributed in the hope that it will be useful, 16 * but WITHOUT ANY WARRANTY; without even the implied warranty of 17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 18 * GNU Lesser General Public License version 3 for more details 19 * (a copy is included in the LICENSE file that accompanied this code). 20 * 21 * You should have received a copy of the GNU Lesser General Public License 22 * version 3 along with OpenOffice.org. If not, see 23 * <http://www.openoffice.org/license.html> 24 * for a copy of the LGPLv3 License. 25 * 26 ************************************************************************/ 27 28 #ifndef INCLUDED_BRIDGES_CPP_UNO_SHARED_VTABLES_HXX 29 #define INCLUDED_BRIDGES_CPP_UNO_SHARED_VTABLES_HXX 30 31 #include "sal/types.h" 32 #include "typelib/typedescription.h" 33 34 namespace bridges { namespace cpp_uno { namespace shared { 35 36 /** 37 * Calculate the number of local functions of an interface type. 38 * 39 * <p><em>Local</em> functions are those not inherited from any base types. The 40 * number of <em>functions</em> is potentially larger than the number of 41 * <em>members</em>, as each read–write attribute member counts as two 42 * functions.</p> 43 * 44 * @param type a non-null pointer to an interface type description, for which 45 * <code>typelib_typedescription_complete</code> must already have been 46 * executed 47 * @return the number of local functions of the given interface type 48 */ 49 sal_Int32 getLocalFunctions(typelib_InterfaceTypeDescription const * type); 50 51 /** 52 * Calculate the number of primary functions of an interface type. 53 * 54 * <p>The number of primary functions of an interface is the number of local 55 * functions of that interface (see <code>getLocalFunctions</code>), plus the 56 * number of primary functions of that interface's first base type (if it has at 57 * least one base type).</p> 58 * 59 * @param type a pointer to an interface type description; may be null 60 * @return the number of primary functions of the given interface type, or zero 61 * if the given interface type is null 62 */ 63 sal_Int32 getPrimaryFunctions(typelib_InterfaceTypeDescription * type); 64 65 /** 66 * Represents a vtable slot of a C++ class. 67 */ 68 struct VtableSlot { 69 /** 70 * The offset of the vtable. 71 * 72 * <p>Multiple-inheritance C++ classes have more than one vtable. The 73 * offset is logical (<em>not</em> a byte offset), and must be 74 * non-negative.</p> 75 */ 76 sal_Int32 offset; 77 78 /** 79 * The index within the vtable. 80 * 81 * <p>The index is logical (<em>not</em> a byte offset), and must be 82 * non-negative.</p> 83 */ 84 sal_Int32 index; 85 }; 86 87 /** 88 * Calculates the vtable slot associated with an interface attribute member. 89 * 90 * @param ifcMember a non-null pointer to an interface attribute member 91 * description 92 * @return the vtable slot associated with the given interface member 93 */ 94 VtableSlot getVtableSlot( 95 typelib_InterfaceAttributeTypeDescription const * ifcMember); 96 97 /** 98 * Calculates the vtable slot associated with an interface method member. 99 * 100 * @param ifcMember a non-null pointer to an interface method member description 101 * @return the vtable slot associated with the given interface member 102 */ 103 VtableSlot getVtableSlot( 104 typelib_InterfaceMethodTypeDescription const * ifcMember); 105 106 } } } 107 108 #endif 109