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_CA_CE_HXX 29 #define ARY_CPP_CA_CE_HXX 30 31 // USED SERVICES 32 // BASE CLASSES 33 #include <ary/cpp/cp_ce.hxx> 34 // OTHER 35 #include "cs_ce.hxx" 36 37 38 namespace ary 39 { 40 namespace cpp 41 { 42 class Ce_Storage; 43 class RepositoryPartition; 44 } 45 } 46 47 48 49 50 51 namespace ary 52 { 53 namespace cpp 54 { 55 56 57 58 /** Administrates all C++ code entities (types, operations, variables). 59 */ 60 class CeAdmin : public CePilot 61 { 62 public: 63 // LIFECYCLE 64 CeAdmin( 65 RepositoryPartition & 66 io_myReposyPartition ); 67 void Set_Related( 68 const TypePilot & i_types ); 69 virtual ~CeAdmin(); 70 71 // INQUIRY 72 const Ce_Storage & Storage() const; 73 74 // ACCESS 75 Ce_Storage & Storage(); 76 77 // INHERITED 78 // Interface CePilot: 79 virtual Namespace & CheckIn_Namespace( 80 const InputContext & 81 i_context, 82 const String & i_localName ); 83 virtual Class & Store_Class( 84 const InputContext & 85 i_context, 86 const String & i_localName, 87 E_ClassKey i_classKey ); 88 virtual Enum & Store_Enum( 89 const InputContext & 90 i_context, 91 const String & i_localName ); 92 virtual Typedef & Store_Typedef( 93 const InputContext & 94 i_context, 95 const String & i_localName, 96 Type_id i_referredType ); 97 virtual Function * Store_Operation( 98 const InputContext & 99 i_context, 100 const String & i_localName, 101 Type_id i_returnType, 102 const std::vector<S_Parameter> & 103 i_parameters, 104 E_Virtuality i_virtuality, 105 E_ConVol i_conVol, 106 FunctionFlags i_flags, 107 bool i_throwExists, 108 const std::vector<Type_id> & 109 i_exceptions ); 110 virtual Variable & Store_Variable( 111 const InputContext & 112 i_context, 113 const String & i_localName, 114 Type_id i_type, 115 VariableFlags i_flags, 116 const String & i_arraySize, 117 const String & i_initValue ); 118 virtual EnumValue & Store_EnumValue( 119 const InputContext & 120 i_context, 121 const String & i_localName, 122 const String & i_initValue ); 123 virtual const Namespace & 124 GlobalNamespace() const; 125 virtual const CodeEntity & 126 Find_Ce( 127 Ce_id i_id ) const; 128 virtual const CodeEntity * 129 Search_Ce( 130 Ce_id i_id ) const; 131 virtual const CodeEntity * 132 Search_CeAbsolute( 133 const CodeEntity & i_curScope, 134 const QualifiedName & 135 i_absoluteName ) const; 136 virtual const CodeEntity * 137 Search_CeLocal( 138 const String & i_relativeName, 139 bool i_isFunction, 140 const Namespace & i_curNamespace, 141 const Class * i_curClass ) const; 142 virtual void Get_QualifiedName( 143 StreamStr & o_result, 144 const String & i_localName, 145 Ce_id i_owner, 146 const char * i_delimiter = "::" ) const; 147 virtual void Get_SignatureText( 148 StreamStr & o_rOut, 149 const OperationSignature & 150 i_signature, 151 const StringVector * 152 i_sParameterNames = 0 ) const; 153 virtual CesResultList 154 Search_TypeName( 155 const String & i_sName ) const; 156 virtual Namespace & GlobalNamespace(); 157 158 private: 159 // Locals 160 /// @return true, if function is duplicate. 161 enum E_DuplicateFunction 162 { 163 df_no, 164 df_replace, 165 df_discard_new 166 }; 167 168 /** @param o_existentFunction 169 The id of the already existing function, else unset. 170 */ 171 E_DuplicateFunction lhf_CheckAndHandle_DuplicateOperation( 172 Ce_id & o_existentFunction, 173 const InputContext & 174 i_context, 175 const Function & i_newFunction ); 176 Namespace & Create_Namespace( 177 Namespace & o_parent, 178 const String & i_localName ); 179 Ce_id Search_MatchingInstance( 180 CesResultList i_list, 181 Ce_id i_owner ) const; 182 const TypePilot & Types() const; 183 184 // DATA 185 Ce_Storage aStorage; 186 const TypePilot * pTypes; 187 RepositoryPartition * 188 pCppRepositoryPartition; 189 }; 190 191 192 193 194 // IMPLEMENTATION 195 inline const Ce_Storage & 196 CeAdmin::Storage() const 197 { 198 return aStorage; 199 } 200 201 inline Ce_Storage & 202 CeAdmin::Storage() 203 { 204 return aStorage; 205 } 206 207 208 209 210 211 } // namespace cpp 212 } // namespace ary 213 #endif 214