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