1*cdf0e10cSrcweir /*************************************************************************
2*cdf0e10cSrcweir  *
3*cdf0e10cSrcweir  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4*cdf0e10cSrcweir  *
5*cdf0e10cSrcweir  * Copyright 2000, 2010 Oracle and/or its affiliates.
6*cdf0e10cSrcweir  *
7*cdf0e10cSrcweir  * OpenOffice.org - a multi-platform office productivity suite
8*cdf0e10cSrcweir  *
9*cdf0e10cSrcweir  * This file is part of OpenOffice.org.
10*cdf0e10cSrcweir  *
11*cdf0e10cSrcweir  * OpenOffice.org is free software: you can redistribute it and/or modify
12*cdf0e10cSrcweir  * it under the terms of the GNU Lesser General Public License version 3
13*cdf0e10cSrcweir  * only, as published by the Free Software Foundation.
14*cdf0e10cSrcweir  *
15*cdf0e10cSrcweir  * OpenOffice.org is distributed in the hope that it will be useful,
16*cdf0e10cSrcweir  * but WITHOUT ANY WARRANTY; without even the implied warranty of
17*cdf0e10cSrcweir  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
18*cdf0e10cSrcweir  * GNU Lesser General Public License version 3 for more details
19*cdf0e10cSrcweir  * (a copy is included in the LICENSE file that accompanied this code).
20*cdf0e10cSrcweir  *
21*cdf0e10cSrcweir  * You should have received a copy of the GNU Lesser General Public License
22*cdf0e10cSrcweir  * version 3 along with OpenOffice.org.  If not, see
23*cdf0e10cSrcweir  * <http://www.openoffice.org/license.html>
24*cdf0e10cSrcweir  * for a copy of the LGPLv3 License.
25*cdf0e10cSrcweir  *
26*cdf0e10cSrcweir  ************************************************************************/
27*cdf0e10cSrcweir 
28*cdf0e10cSrcweir #ifndef ARY_IDL_I2S_CALCULATOR_HXX
29*cdf0e10cSrcweir #define ARY_IDL_I2S_CALCULATOR_HXX
30*cdf0e10cSrcweir 
31*cdf0e10cSrcweir 
32*cdf0e10cSrcweir // USED SERVICES
33*cdf0e10cSrcweir     // BASE CLASSES
34*cdf0e10cSrcweir #include <cosv/tpl/processor.hxx>
35*cdf0e10cSrcweir     // PARAMETERS
36*cdf0e10cSrcweir #include <ary/idl/i_types4idl.hxx>
37*cdf0e10cSrcweir 
38*cdf0e10cSrcweir 
39*cdf0e10cSrcweir namespace ary
40*cdf0e10cSrcweir {
41*cdf0e10cSrcweir namespace idl
42*cdf0e10cSrcweir {
43*cdf0e10cSrcweir     class CeAdmin;
44*cdf0e10cSrcweir     class Ce_Storage;
45*cdf0e10cSrcweir     class TypeAdmin;
46*cdf0e10cSrcweir     class Type_Storage;
47*cdf0e10cSrcweir     class Module;
48*cdf0e10cSrcweir     class ExplicitType;
49*cdf0e10cSrcweir     class Function;
50*cdf0e10cSrcweir     class Interface;
51*cdf0e10cSrcweir     class Property;
52*cdf0e10cSrcweir     class Typedef;
53*cdf0e10cSrcweir     class Service;
54*cdf0e10cSrcweir     class Singleton;
55*cdf0e10cSrcweir     class SglIfcService;
56*cdf0e10cSrcweir     class SglIfcSingleton;
57*cdf0e10cSrcweir     class Struct;
58*cdf0e10cSrcweir     class StructElement;
59*cdf0e10cSrcweir     class Exception;
60*cdf0e10cSrcweir     class Ce_2s;
61*cdf0e10cSrcweir }
62*cdf0e10cSrcweir }
63*cdf0e10cSrcweir 
64*cdf0e10cSrcweir 
65*cdf0e10cSrcweir 
66*cdf0e10cSrcweir 
67*cdf0e10cSrcweir 
68*cdf0e10cSrcweir 
69*cdf0e10cSrcweir namespace ary
70*cdf0e10cSrcweir {
71*cdf0e10cSrcweir namespace idl
72*cdf0e10cSrcweir {
73*cdf0e10cSrcweir 
74*cdf0e10cSrcweir 
75*cdf0e10cSrcweir enum E_2s_of_Service
76*cdf0e10cSrcweir {
77*cdf0e10cSrcweir     service_2s_IncludingServices,
78*cdf0e10cSrcweir     service_2s_InstantiatingSingletons
79*cdf0e10cSrcweir };
80*cdf0e10cSrcweir 
81*cdf0e10cSrcweir enum E_2s_of_Interface
82*cdf0e10cSrcweir {
83*cdf0e10cSrcweir     interface_2s_Derivations,
84*cdf0e10cSrcweir     interface_2s_ExportingServices,
85*cdf0e10cSrcweir     interface_2s_ExportingSingletons,
86*cdf0e10cSrcweir     interface_2s_SynonymTypedefs,
87*cdf0e10cSrcweir //    interface_2s_UsingTypedefs,
88*cdf0e10cSrcweir     interface_2s_AsReturns,
89*cdf0e10cSrcweir //    interface_2s_AsIndirectReturns,
90*cdf0e10cSrcweir     interface_2s_AsParameters,
91*cdf0e10cSrcweir //    interface_2s_AsIndirectParameters,
92*cdf0e10cSrcweir     interface_2s_AsDataTypes
93*cdf0e10cSrcweir };
94*cdf0e10cSrcweir 
95*cdf0e10cSrcweir enum E_2s_of_Struct
96*cdf0e10cSrcweir {
97*cdf0e10cSrcweir     struct_2s_Derivations,
98*cdf0e10cSrcweir     struct_2s_SynonymTypedefs,
99*cdf0e10cSrcweir //    struct_2s_UsingTypedefs,
100*cdf0e10cSrcweir     struct_2s_AsReturns,
101*cdf0e10cSrcweir //    struct_2s_AsIndirectReturns,
102*cdf0e10cSrcweir     struct_2s_AsParameters,
103*cdf0e10cSrcweir //    struct_2s_AsIndirectParameters,
104*cdf0e10cSrcweir     struct_2s_AsDataTypes
105*cdf0e10cSrcweir };
106*cdf0e10cSrcweir 
107*cdf0e10cSrcweir enum E_2s_of_Enum
108*cdf0e10cSrcweir {
109*cdf0e10cSrcweir     enum_2s_SynonymTypedefs,
110*cdf0e10cSrcweir //    enum_2s_UsingTypedefs,
111*cdf0e10cSrcweir     enum_2s_AsReturns,
112*cdf0e10cSrcweir //    enum_2s_AsIndirectReturns,
113*cdf0e10cSrcweir     enum_2s_AsParameters,
114*cdf0e10cSrcweir //    enum_2s_AsIndirectParameters,
115*cdf0e10cSrcweir     enum_2s_AsDataTypes
116*cdf0e10cSrcweir };
117*cdf0e10cSrcweir 
118*cdf0e10cSrcweir enum E_2s_of_Typedef
119*cdf0e10cSrcweir {
120*cdf0e10cSrcweir     typedef_2s_SynonymTypedefs,
121*cdf0e10cSrcweir //    typedef_2s_UsingTypedefs,
122*cdf0e10cSrcweir     typedef_2s_AsReturns,
123*cdf0e10cSrcweir //    typedef_2s_AsIndirectReturns,
124*cdf0e10cSrcweir     typedef_2s_AsParameters,
125*cdf0e10cSrcweir //    typedef_2s_AsIndirectParameters,
126*cdf0e10cSrcweir     typedef_2s_AsDataTypes
127*cdf0e10cSrcweir };
128*cdf0e10cSrcweir 
129*cdf0e10cSrcweir enum E_2s_of_Exceptions
130*cdf0e10cSrcweir {
131*cdf0e10cSrcweir     exception_2s_Derivations,
132*cdf0e10cSrcweir     exception_2s_RaisingFunctions
133*cdf0e10cSrcweir };
134*cdf0e10cSrcweir 
135*cdf0e10cSrcweir 
136*cdf0e10cSrcweir 
137*cdf0e10cSrcweir class SPInst_asHost :   public csv::ProcessorIfc,
138*cdf0e10cSrcweir                         public csv::ConstProcessor<Service>,
139*cdf0e10cSrcweir                         public csv::ConstProcessor<Interface>,
140*cdf0e10cSrcweir                         public csv::ConstProcessor<Struct>,
141*cdf0e10cSrcweir                         public csv::ConstProcessor<Exception>,
142*cdf0e10cSrcweir                         public csv::ConstProcessor<Typedef>,
143*cdf0e10cSrcweir                         public csv::ConstProcessor<Singleton>,
144*cdf0e10cSrcweir                         public csv::ConstProcessor<Function>,
145*cdf0e10cSrcweir                         public csv::ConstProcessor<StructElement>,
146*cdf0e10cSrcweir                         public csv::ConstProcessor<Property>,
147*cdf0e10cSrcweir                         public csv::ConstProcessor<SglIfcService>,
148*cdf0e10cSrcweir                         public csv::ConstProcessor<SglIfcSingleton>
149*cdf0e10cSrcweir {
150*cdf0e10cSrcweir };
151*cdf0e10cSrcweir 
152*cdf0e10cSrcweir 
153*cdf0e10cSrcweir 
154*cdf0e10cSrcweir 
155*cdf0e10cSrcweir /** This class scans the parsed data and produces several
156*cdf0e10cSrcweir     secondary data like cross references and alphabetical indices.
157*cdf0e10cSrcweir 
158*cdf0e10cSrcweir     In this declaration "Secondaries" or "2s" mean those secondary data.
159*cdf0e10cSrcweir 
160*cdf0e10cSrcweir     @see Ce_2s
161*cdf0e10cSrcweir */
162*cdf0e10cSrcweir class SecondariesCalculator : public SPInst_asHost
163*cdf0e10cSrcweir {
164*cdf0e10cSrcweir   public:
165*cdf0e10cSrcweir     // LIFECYCLE
166*cdf0e10cSrcweir                         SecondariesCalculator(
167*cdf0e10cSrcweir                             CeAdmin &           i_ces,
168*cdf0e10cSrcweir                             TypeAdmin &         i_types );
169*cdf0e10cSrcweir     virtual             ~SecondariesCalculator();
170*cdf0e10cSrcweir 
171*cdf0e10cSrcweir     // OPERATIONS
172*cdf0e10cSrcweir     void                CheckAllInterfaceBases();
173*cdf0e10cSrcweir     void                Connect_Types2Ces();
174*cdf0e10cSrcweir     void                Gather_CrossReferences();
175*cdf0e10cSrcweir     void                Make_Links2DeveloperManual(
176*cdf0e10cSrcweir                             const String &      i_devman_reffilepath );
177*cdf0e10cSrcweir 
178*cdf0e10cSrcweir   private:
179*cdf0e10cSrcweir     // Interface CeHost These are the points to gather cross
180*cdf0e10cSrcweir     //   references:
181*cdf0e10cSrcweir     virtual void        do_Process(
182*cdf0e10cSrcweir                             const Service &     i_rData );
183*cdf0e10cSrcweir     virtual void        do_Process(
184*cdf0e10cSrcweir                             const Interface &   i_rData );
185*cdf0e10cSrcweir     virtual void        do_Process(
186*cdf0e10cSrcweir                             const Struct &      i_rData );
187*cdf0e10cSrcweir     virtual void        do_Process(
188*cdf0e10cSrcweir                             const Exception &   i_rData );
189*cdf0e10cSrcweir     virtual void        do_Process(
190*cdf0e10cSrcweir                             const Typedef &     i_rData );
191*cdf0e10cSrcweir     virtual void        do_Process(
192*cdf0e10cSrcweir                             const Singleton &   i_rData );
193*cdf0e10cSrcweir     virtual void        do_Process(
194*cdf0e10cSrcweir                             const Function &    i_rData );
195*cdf0e10cSrcweir     virtual void        do_Process(
196*cdf0e10cSrcweir                             const StructElement &
197*cdf0e10cSrcweir                                                 i_rData );
198*cdf0e10cSrcweir     virtual void        do_Process(
199*cdf0e10cSrcweir                             const Property &    i_rData );
200*cdf0e10cSrcweir     virtual void        do_Process(
201*cdf0e10cSrcweir                             const SglIfcService &
202*cdf0e10cSrcweir                                                 i_rData );
203*cdf0e10cSrcweir     virtual void        do_Process(
204*cdf0e10cSrcweir                             const SglIfcSingleton &
205*cdf0e10cSrcweir                                                 i_rData );
206*cdf0e10cSrcweir 
207*cdf0e10cSrcweir     // Locals
208*cdf0e10cSrcweir     const Ce_Storage &  my_CeStorage() const;
209*cdf0e10cSrcweir     const Type_Storage &
210*cdf0e10cSrcweir                         my_TypeStorage() const;
211*cdf0e10cSrcweir     Ce_Storage &        my_CeStorage();
212*cdf0e10cSrcweir     Type_Storage &      my_TypeStorage();
213*cdf0e10cSrcweir 
214*cdf0e10cSrcweir     template <class DEST>
215*cdf0e10cSrcweir     DEST *              SearchCe4Type(
216*cdf0e10cSrcweir                             Type_id             i_type );
217*cdf0e10cSrcweir     Ce_id               lhf_Search_CeForType(
218*cdf0e10cSrcweir                             const ExplicitType &
219*cdf0e10cSrcweir                                                 i_rType ) const;
220*cdf0e10cSrcweir     Ce_id               lhf_Search_CeFromTypeId(
221*cdf0e10cSrcweir                             Type_id             i_nType ) const;
222*cdf0e10cSrcweir     Service *           lhf_SearchService(
223*cdf0e10cSrcweir                             Type_id             i_nServ );
224*cdf0e10cSrcweir     Interface *         lhf_SearchInterface(
225*cdf0e10cSrcweir                             Type_id             i_nIfc );
226*cdf0e10cSrcweir     Struct *            lhf_SearchStruct(
227*cdf0e10cSrcweir                             Type_id             i_nIfc );
228*cdf0e10cSrcweir     Exception *         lhf_SearchException(
229*cdf0e10cSrcweir                             Type_id             i_nIfc );
230*cdf0e10cSrcweir     void                assign_CurLink(
231*cdf0e10cSrcweir                             char *              i_text,
232*cdf0e10cSrcweir                             const String &      i_link,
233*cdf0e10cSrcweir                             const String &      i_linkUI,
234*cdf0e10cSrcweir                             bool                i_isDescr,      /// @descr true: description, false: reference.
235*cdf0e10cSrcweir                             int                 i_lineCount  );
236*cdf0e10cSrcweir     void                gather_Synonyms();
237*cdf0e10cSrcweir     void                recursive_AssignAsSynonym(
238*cdf0e10cSrcweir                             Ce_id               i_synonymousTypedefsId,
239*cdf0e10cSrcweir                             const Typedef &     i_TypedefToCheck );
240*cdf0e10cSrcweir     void                recursive_AssignIncludingService(
241*cdf0e10cSrcweir                             Ce_id               i_includingServicesId,
242*cdf0e10cSrcweir                             const Service &     i_ServiceToCheckItsIncludes );
243*cdf0e10cSrcweir     void                assign_AsDerivedInterface(
244*cdf0e10cSrcweir                             const Interface &   i_rDerived );
245*cdf0e10cSrcweir     void                assign_AsDerivedStruct(
246*cdf0e10cSrcweir                             const Struct &      i_rDerived );
247*cdf0e10cSrcweir     void                assign_AsDerivedException(
248*cdf0e10cSrcweir                             const Exception &   i_rDerived );
249*cdf0e10cSrcweir     void                assignImplementation_toAServicesInterfaces(
250*cdf0e10cSrcweir                             Ce_id               i_nImpl,
251*cdf0e10cSrcweir                             Ce_id               i_nService,
252*cdf0e10cSrcweir                             E_2s_of_Interface   i_eList );
253*cdf0e10cSrcweir     void                recursive_AssignImplementation_toExportedInterface(
254*cdf0e10cSrcweir                             Ce_id               i_nService,
255*cdf0e10cSrcweir                             Type_id             i_nExportedInterface,
256*cdf0e10cSrcweir                             E_2s_of_Interface   i_eList );
257*cdf0e10cSrcweir     void                recursive_AssignFunction_toCeAsReturn(
258*cdf0e10cSrcweir                             Ce_id               i_nFunction,
259*cdf0e10cSrcweir                             Type_id             i_nReturnType );
260*cdf0e10cSrcweir     void                recursive_AssignFunction_toCeAsParameter(
261*cdf0e10cSrcweir                             Ce_id               i_nFunction,
262*cdf0e10cSrcweir                             Type_id             i_nParameterType );
263*cdf0e10cSrcweir 
264*cdf0e10cSrcweir     /** @param i_nDataElement
265*cdf0e10cSrcweir         May be the ID of an struct element as well as an exception element
266*cdf0e10cSrcweir         or a property.
267*cdf0e10cSrcweir     */
268*cdf0e10cSrcweir     void                recursive_AssignStructElement_toCeAsDataType(
269*cdf0e10cSrcweir                             Ce_id               i_nDataElement,
270*cdf0e10cSrcweir                             Type_id             i_nDataType );
271*cdf0e10cSrcweir     void                insert_into2sList(
272*cdf0e10cSrcweir                             CodeEntity &        o_out,
273*cdf0e10cSrcweir                             int                 i_listIndex,
274*cdf0e10cSrcweir                             Ce_id               i_nCe );
275*cdf0e10cSrcweir     void                insert_into2sUnique(
276*cdf0e10cSrcweir                             CodeEntity &        o_out,
277*cdf0e10cSrcweir                             int                 i_listIndex,
278*cdf0e10cSrcweir                             Ce_id               i_nCe );
279*cdf0e10cSrcweir     /// Sorts secondary production lists alphabetical.
280*cdf0e10cSrcweir     void                sort_All2s();
281*cdf0e10cSrcweir 
282*cdf0e10cSrcweir     void                Read_Links2DevManual(
283*cdf0e10cSrcweir                             csv::bstream &      i_file );
284*cdf0e10cSrcweir 
285*cdf0e10cSrcweir     // DATA
286*cdf0e10cSrcweir     CeAdmin *           pCes;
287*cdf0e10cSrcweir     TypeAdmin *         pTypes;
288*cdf0e10cSrcweir };
289*cdf0e10cSrcweir 
290*cdf0e10cSrcweir 
291*cdf0e10cSrcweir 
292*cdf0e10cSrcweir 
293*cdf0e10cSrcweir }   // namespace idl
294*cdf0e10cSrcweir }   // namespace ary
295*cdf0e10cSrcweir #endif
296