1*1c78a5d6SAndrew Rist /**************************************************************
2cdf0e10cSrcweir *
3*1c78a5d6SAndrew Rist * Licensed to the Apache Software Foundation (ASF) under one
4*1c78a5d6SAndrew Rist * or more contributor license agreements. See the NOTICE file
5*1c78a5d6SAndrew Rist * distributed with this work for additional information
6*1c78a5d6SAndrew Rist * regarding copyright ownership. The ASF licenses this file
7*1c78a5d6SAndrew Rist * to you under the Apache License, Version 2.0 (the
8*1c78a5d6SAndrew Rist * "License"); you may not use this file except in compliance
9*1c78a5d6SAndrew Rist * with the License. You may obtain a copy of the License at
10cdf0e10cSrcweir *
11*1c78a5d6SAndrew Rist * http://www.apache.org/licenses/LICENSE-2.0
12cdf0e10cSrcweir *
13*1c78a5d6SAndrew Rist * Unless required by applicable law or agreed to in writing,
14*1c78a5d6SAndrew Rist * software distributed under the License is distributed on an
15*1c78a5d6SAndrew Rist * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16*1c78a5d6SAndrew Rist * KIND, either express or implied. See the License for the
17*1c78a5d6SAndrew Rist * specific language governing permissions and limitations
18*1c78a5d6SAndrew Rist * under the License.
19cdf0e10cSrcweir *
20*1c78a5d6SAndrew Rist *************************************************************/
21*1c78a5d6SAndrew Rist
22*1c78a5d6SAndrew Rist
23cdf0e10cSrcweir
24cdf0e10cSrcweir #ifndef ARY_CPP_CA_CE_HXX
25cdf0e10cSrcweir #define ARY_CPP_CA_CE_HXX
26cdf0e10cSrcweir
27cdf0e10cSrcweir // USED SERVICES
28cdf0e10cSrcweir // BASE CLASSES
29cdf0e10cSrcweir #include <ary/cpp/cp_ce.hxx>
30cdf0e10cSrcweir // OTHER
31cdf0e10cSrcweir #include "cs_ce.hxx"
32cdf0e10cSrcweir
33cdf0e10cSrcweir
34cdf0e10cSrcweir namespace ary
35cdf0e10cSrcweir {
36cdf0e10cSrcweir namespace cpp
37cdf0e10cSrcweir {
38cdf0e10cSrcweir class Ce_Storage;
39cdf0e10cSrcweir class RepositoryPartition;
40cdf0e10cSrcweir }
41cdf0e10cSrcweir }
42cdf0e10cSrcweir
43cdf0e10cSrcweir
44cdf0e10cSrcweir
45cdf0e10cSrcweir
46cdf0e10cSrcweir
47cdf0e10cSrcweir namespace ary
48cdf0e10cSrcweir {
49cdf0e10cSrcweir namespace cpp
50cdf0e10cSrcweir {
51cdf0e10cSrcweir
52cdf0e10cSrcweir
53cdf0e10cSrcweir
54cdf0e10cSrcweir /** Administrates all C++ code entities (types, operations, variables).
55cdf0e10cSrcweir */
56cdf0e10cSrcweir class CeAdmin : public CePilot
57cdf0e10cSrcweir {
58cdf0e10cSrcweir public:
59cdf0e10cSrcweir // LIFECYCLE
60cdf0e10cSrcweir CeAdmin(
61cdf0e10cSrcweir RepositoryPartition &
62cdf0e10cSrcweir io_myReposyPartition );
63cdf0e10cSrcweir void Set_Related(
64cdf0e10cSrcweir const TypePilot & i_types );
65cdf0e10cSrcweir virtual ~CeAdmin();
66cdf0e10cSrcweir
67cdf0e10cSrcweir // INQUIRY
68cdf0e10cSrcweir const Ce_Storage & Storage() const;
69cdf0e10cSrcweir
70cdf0e10cSrcweir // ACCESS
71cdf0e10cSrcweir Ce_Storage & Storage();
72cdf0e10cSrcweir
73cdf0e10cSrcweir // INHERITED
74cdf0e10cSrcweir // Interface CePilot:
75cdf0e10cSrcweir virtual Namespace & CheckIn_Namespace(
76cdf0e10cSrcweir const InputContext &
77cdf0e10cSrcweir i_context,
78cdf0e10cSrcweir const String & i_localName );
79cdf0e10cSrcweir virtual Class & Store_Class(
80cdf0e10cSrcweir const InputContext &
81cdf0e10cSrcweir i_context,
82cdf0e10cSrcweir const String & i_localName,
83cdf0e10cSrcweir E_ClassKey i_classKey );
84cdf0e10cSrcweir virtual Enum & Store_Enum(
85cdf0e10cSrcweir const InputContext &
86cdf0e10cSrcweir i_context,
87cdf0e10cSrcweir const String & i_localName );
88cdf0e10cSrcweir virtual Typedef & Store_Typedef(
89cdf0e10cSrcweir const InputContext &
90cdf0e10cSrcweir i_context,
91cdf0e10cSrcweir const String & i_localName,
92cdf0e10cSrcweir Type_id i_referredType );
93cdf0e10cSrcweir virtual Function * Store_Operation(
94cdf0e10cSrcweir const InputContext &
95cdf0e10cSrcweir i_context,
96cdf0e10cSrcweir const String & i_localName,
97cdf0e10cSrcweir Type_id i_returnType,
98cdf0e10cSrcweir const std::vector<S_Parameter> &
99cdf0e10cSrcweir i_parameters,
100cdf0e10cSrcweir E_Virtuality i_virtuality,
101cdf0e10cSrcweir E_ConVol i_conVol,
102cdf0e10cSrcweir FunctionFlags i_flags,
103cdf0e10cSrcweir bool i_throwExists,
104cdf0e10cSrcweir const std::vector<Type_id> &
105cdf0e10cSrcweir i_exceptions );
106cdf0e10cSrcweir virtual Variable & Store_Variable(
107cdf0e10cSrcweir const InputContext &
108cdf0e10cSrcweir i_context,
109cdf0e10cSrcweir const String & i_localName,
110cdf0e10cSrcweir Type_id i_type,
111cdf0e10cSrcweir VariableFlags i_flags,
112cdf0e10cSrcweir const String & i_arraySize,
113cdf0e10cSrcweir const String & i_initValue );
114cdf0e10cSrcweir virtual EnumValue & Store_EnumValue(
115cdf0e10cSrcweir const InputContext &
116cdf0e10cSrcweir i_context,
117cdf0e10cSrcweir const String & i_localName,
118cdf0e10cSrcweir const String & i_initValue );
119cdf0e10cSrcweir virtual const Namespace &
120cdf0e10cSrcweir GlobalNamespace() const;
121cdf0e10cSrcweir virtual const CodeEntity &
122cdf0e10cSrcweir Find_Ce(
123cdf0e10cSrcweir Ce_id i_id ) const;
124cdf0e10cSrcweir virtual const CodeEntity *
125cdf0e10cSrcweir Search_Ce(
126cdf0e10cSrcweir Ce_id i_id ) const;
127cdf0e10cSrcweir virtual const CodeEntity *
128cdf0e10cSrcweir Search_CeAbsolute(
129cdf0e10cSrcweir const CodeEntity & i_curScope,
130cdf0e10cSrcweir const QualifiedName &
131cdf0e10cSrcweir i_absoluteName ) const;
132cdf0e10cSrcweir virtual const CodeEntity *
133cdf0e10cSrcweir Search_CeLocal(
134cdf0e10cSrcweir const String & i_relativeName,
135cdf0e10cSrcweir bool i_isFunction,
136cdf0e10cSrcweir const Namespace & i_curNamespace,
137cdf0e10cSrcweir const Class * i_curClass ) const;
138cdf0e10cSrcweir virtual void Get_QualifiedName(
139cdf0e10cSrcweir StreamStr & o_result,
140cdf0e10cSrcweir const String & i_localName,
141cdf0e10cSrcweir Ce_id i_owner,
142cdf0e10cSrcweir const char * i_delimiter = "::" ) const;
143cdf0e10cSrcweir virtual void Get_SignatureText(
144cdf0e10cSrcweir StreamStr & o_rOut,
145cdf0e10cSrcweir const OperationSignature &
146cdf0e10cSrcweir i_signature,
147cdf0e10cSrcweir const StringVector *
148cdf0e10cSrcweir i_sParameterNames = 0 ) const;
149cdf0e10cSrcweir virtual CesResultList
150cdf0e10cSrcweir Search_TypeName(
151cdf0e10cSrcweir const String & i_sName ) const;
152cdf0e10cSrcweir virtual Namespace & GlobalNamespace();
153cdf0e10cSrcweir
154cdf0e10cSrcweir private:
155cdf0e10cSrcweir // Locals
156cdf0e10cSrcweir /// @return true, if function is duplicate.
157cdf0e10cSrcweir enum E_DuplicateFunction
158cdf0e10cSrcweir {
159cdf0e10cSrcweir df_no,
160cdf0e10cSrcweir df_replace,
161cdf0e10cSrcweir df_discard_new
162cdf0e10cSrcweir };
163cdf0e10cSrcweir
164cdf0e10cSrcweir /** @param o_existentFunction
165cdf0e10cSrcweir The id of the already existing function, else unset.
166cdf0e10cSrcweir */
167cdf0e10cSrcweir E_DuplicateFunction lhf_CheckAndHandle_DuplicateOperation(
168cdf0e10cSrcweir Ce_id & o_existentFunction,
169cdf0e10cSrcweir const InputContext &
170cdf0e10cSrcweir i_context,
171cdf0e10cSrcweir const Function & i_newFunction );
172cdf0e10cSrcweir Namespace & Create_Namespace(
173cdf0e10cSrcweir Namespace & o_parent,
174cdf0e10cSrcweir const String & i_localName );
175cdf0e10cSrcweir Ce_id Search_MatchingInstance(
176cdf0e10cSrcweir CesResultList i_list,
177cdf0e10cSrcweir Ce_id i_owner ) const;
178cdf0e10cSrcweir const TypePilot & Types() const;
179cdf0e10cSrcweir
180cdf0e10cSrcweir // DATA
181cdf0e10cSrcweir Ce_Storage aStorage;
182cdf0e10cSrcweir const TypePilot * pTypes;
183cdf0e10cSrcweir RepositoryPartition *
184cdf0e10cSrcweir pCppRepositoryPartition;
185cdf0e10cSrcweir };
186cdf0e10cSrcweir
187cdf0e10cSrcweir
188cdf0e10cSrcweir
189cdf0e10cSrcweir
190cdf0e10cSrcweir // IMPLEMENTATION
191cdf0e10cSrcweir inline const Ce_Storage &
Storage() const192cdf0e10cSrcweir CeAdmin::Storage() const
193cdf0e10cSrcweir {
194cdf0e10cSrcweir return aStorage;
195cdf0e10cSrcweir }
196cdf0e10cSrcweir
197cdf0e10cSrcweir inline Ce_Storage &
Storage()198cdf0e10cSrcweir CeAdmin::Storage()
199cdf0e10cSrcweir {
200cdf0e10cSrcweir return aStorage;
201cdf0e10cSrcweir }
202cdf0e10cSrcweir
203cdf0e10cSrcweir
204cdf0e10cSrcweir
205cdf0e10cSrcweir
206cdf0e10cSrcweir
207cdf0e10cSrcweir } // namespace cpp
208cdf0e10cSrcweir } // namespace ary
209cdf0e10cSrcweir #endif
210