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 ARY_CPP_C_FUNCT_HXX 29 #define ARY_CPP_C_FUNCT_HXX 30 31 32 33 // USED SERVICES 34 // BASE CLASSES 35 #include <ary/cpp/c_ce.hxx> 36 // OTHER 37 #include <ary/cessentl.hxx> 38 #include <ary/cpp/c_types4cpp.hxx> 39 #include <ary/cpp/c_slntry.hxx> 40 #include <ary/cpp/c_vfflag.hxx> 41 #include <ary/cpp/c_osigna.hxx> 42 43 44 45 46 namespace ary 47 { 48 namespace cpp 49 { 50 51 52 53 /** A C++ function declaration. 54 */ 55 class Function : public CodeEntity 56 { 57 public: 58 enum E_ClassId { class_id = 1004 }; 59 60 Function( 61 const String & i_sLocalName, 62 Ce_id i_nOwner, 63 E_Protection i_eProtection, 64 loc::Le_id i_nFile, 65 Type_id i_nReturnType, 66 const std::vector<S_Parameter> & 67 i_parameters, 68 E_ConVol i_conVol, 69 E_Virtuality i_eVirtuality, 70 FunctionFlags i_aFlags, 71 bool i_bThrowExists, 72 const std::vector<Type_id> & 73 i_rExceptions ); 74 ~Function(); 75 76 77 // OPERATIONS 78 void Add_TemplateParameterType( 79 const String & i_sLocalName, 80 Type_id i_nIdAsType ); 81 82 // INQUIRY 83 const OperationSignature & 84 Signature() const; 85 Type_id ReturnType() const; 86 E_Protection Protection() const { return eProtection; } 87 E_Virtuality Virtuality() const { return eVirtuality; } 88 const FunctionFlags & 89 Flags() const { return aFlags; } 90 const StringVector & 91 ParamInfos() const { return aParameterInfos; } 92 const std::vector<Type_id> * 93 Exceptions() const { return pExceptions.Ptr(); } 94 95 const List_TplParam & 96 TemplateParameters() const 97 { return aTemplateParameterTypes; } 98 bool IsIdentical( 99 const Function & i_f ) const; 100 101 private: 102 // Interface csv::ConstProcessorClient 103 virtual void do_Accept( 104 csv::ProcessorIfc & io_processor ) const; 105 106 // Interface ary::cpp::CodeEntity 107 virtual const String & 108 inq_LocalName() const; 109 virtual Cid inq_Owner() const; 110 virtual Lid inq_Location() const; 111 112 // Interface ary::cpp::CppEntity 113 virtual ClassId get_AryClass() const; 114 115 // Local Types 116 typedef StringVector ParameterInfoList; 117 typedef std::vector<Type_id> ExceptionTypeList; 118 119 // DATA 120 CeEssentials aEssentials; 121 List_TplParam aTemplateParameterTypes; 122 OperationSignature aSignature; 123 Type_id nReturnType; 124 E_Protection eProtection; 125 E_Virtuality eVirtuality; 126 FunctionFlags aFlags; 127 ParameterInfoList aParameterInfos; 128 Dyn<ExceptionTypeList> 129 pExceptions; // if (NOT pExceptions) there is no throw, 130 // else, there is one, but the list still may be empty. 131 }; 132 133 134 135 136 // IMPLEMENTATION 137 inline const OperationSignature & 138 Function::Signature() const 139 { return aSignature; } 140 inline Type_id 141 Function::ReturnType() const 142 { return nReturnType; } 143 144 145 146 147 } // namespace cpp 148 } // namespace ary 149 #endif 150