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 #include <precomp.h>
29*cdf0e10cSrcweir #include <s2_luidl/parsenv2.hxx>
30*cdf0e10cSrcweir 
31*cdf0e10cSrcweir 
32*cdf0e10cSrcweir // NOT FULLY DEFINED SERVICES
33*cdf0e10cSrcweir #include <ary/ary.hxx>
34*cdf0e10cSrcweir #include <ary/getncast.hxx>
35*cdf0e10cSrcweir #include <ary/qualiname.hxx>
36*cdf0e10cSrcweir #include <ary/doc/d_oldidldocu.hxx>
37*cdf0e10cSrcweir #include <ary/idl/i_gate.hxx>
38*cdf0e10cSrcweir #include <ary/idl/i_ce.hxx>
39*cdf0e10cSrcweir #include <ary/idl/i_enum.hxx>
40*cdf0e10cSrcweir #include <ary/idl/i_enumvalue.hxx>
41*cdf0e10cSrcweir #include <ary/idl/i_module.hxx>
42*cdf0e10cSrcweir #include <ary/idl/ip_ce.hxx>
43*cdf0e10cSrcweir #include <parser/parserinfo.hxx>
44*cdf0e10cSrcweir #include <adc_msg.hxx>
45*cdf0e10cSrcweir #include <s2_luidl/uidl_tok.hxx>
46*cdf0e10cSrcweir #include <x_parse2.hxx>
47*cdf0e10cSrcweir 
48*cdf0e10cSrcweir 
49*cdf0e10cSrcweir 
50*cdf0e10cSrcweir 
51*cdf0e10cSrcweir namespace csi
52*cdf0e10cSrcweir {
53*cdf0e10cSrcweir namespace uidl
54*cdf0e10cSrcweir {
55*cdf0e10cSrcweir 
56*cdf0e10cSrcweir 
57*cdf0e10cSrcweir UnoIDL_PE::~UnoIDL_PE()
58*cdf0e10cSrcweir {
59*cdf0e10cSrcweir }
60*cdf0e10cSrcweir 
61*cdf0e10cSrcweir void
62*cdf0e10cSrcweir UnoIDL_PE::EstablishContacts( UnoIDL_PE *				io_pParentPE,
63*cdf0e10cSrcweir 							  ary::Repository &	        io_rRepository,
64*cdf0e10cSrcweir 							  TokenProcessing_Result &  o_rResult )
65*cdf0e10cSrcweir {
66*cdf0e10cSrcweir     pRepository = &io_rRepository;
67*cdf0e10cSrcweir 	aMyNode.EstablishContacts(io_pParentPE, io_rRepository.Gate_Idl(), o_rResult);
68*cdf0e10cSrcweir }
69*cdf0e10cSrcweir 
70*cdf0e10cSrcweir //void
71*cdf0e10cSrcweir //UnoIDL_PE::EstablishContacts( UnoIDL_PE *				io_pParentPE,
72*cdf0e10cSrcweir //							  ary::idl::Gate &          io_rGate,
73*cdf0e10cSrcweir //							  TokenProcessing_Result &  o_rResult )
74*cdf0e10cSrcweir //{
75*cdf0e10cSrcweir //	aMyNode.EstablishContacts(io_pParentPE, io_rGate, o_rResult);
76*cdf0e10cSrcweir //}
77*cdf0e10cSrcweir 
78*cdf0e10cSrcweir void
79*cdf0e10cSrcweir UnoIDL_PE::Enter( E_EnvStackAction	i_eWayOfEntering )
80*cdf0e10cSrcweir {
81*cdf0e10cSrcweir 	switch (i_eWayOfEntering)
82*cdf0e10cSrcweir 	{
83*cdf0e10cSrcweir 		case push_sure:
84*cdf0e10cSrcweir 				InitData();
85*cdf0e10cSrcweir 				break;
86*cdf0e10cSrcweir 		case push_try:
87*cdf0e10cSrcweir 				csv_assert(false);
88*cdf0e10cSrcweir 				break;
89*cdf0e10cSrcweir 		case pop_success:
90*cdf0e10cSrcweir 				ReceiveData();
91*cdf0e10cSrcweir 				break;
92*cdf0e10cSrcweir 		case pop_failure:
93*cdf0e10cSrcweir 		        throw X_AutodocParser(X_AutodocParser::x_Any);
94*cdf0e10cSrcweir 				// no break because of throw
95*cdf0e10cSrcweir 		default:
96*cdf0e10cSrcweir 			csv_assert(false);
97*cdf0e10cSrcweir 	}	// end switch
98*cdf0e10cSrcweir }
99*cdf0e10cSrcweir 
100*cdf0e10cSrcweir void
101*cdf0e10cSrcweir UnoIDL_PE::Leave( E_EnvStackAction	i_eWayOfLeaving )
102*cdf0e10cSrcweir {
103*cdf0e10cSrcweir 	switch (i_eWayOfLeaving)
104*cdf0e10cSrcweir 	{
105*cdf0e10cSrcweir 		case push_sure:
106*cdf0e10cSrcweir 				break;
107*cdf0e10cSrcweir 		case push_try:
108*cdf0e10cSrcweir 				csv_assert(false);
109*cdf0e10cSrcweir 				break;
110*cdf0e10cSrcweir 		case pop_success:
111*cdf0e10cSrcweir 				TransferData();
112*cdf0e10cSrcweir 				break;
113*cdf0e10cSrcweir 		case pop_failure:
114*cdf0e10cSrcweir 		        throw X_AutodocParser(X_AutodocParser::x_Any);
115*cdf0e10cSrcweir 				// no break because of throw
116*cdf0e10cSrcweir 		default:
117*cdf0e10cSrcweir 			csv_assert(false);
118*cdf0e10cSrcweir 	}	// end switch
119*cdf0e10cSrcweir }
120*cdf0e10cSrcweir 
121*cdf0e10cSrcweir void
122*cdf0e10cSrcweir UnoIDL_PE::SetDocu( DYN ary::doc::OldIdlDocu * let_dpDocu )
123*cdf0e10cSrcweir {
124*cdf0e10cSrcweir     pDocu = let_dpDocu;
125*cdf0e10cSrcweir }
126*cdf0e10cSrcweir 
127*cdf0e10cSrcweir void
128*cdf0e10cSrcweir UnoIDL_PE::SetPublished()
129*cdf0e10cSrcweir {
130*cdf0e10cSrcweir 	if (NOT pDocu)
131*cdf0e10cSrcweir 	{
132*cdf0e10cSrcweir 		pDocu = new ary::doc::OldIdlDocu;
133*cdf0e10cSrcweir 	}
134*cdf0e10cSrcweir 	pDocu->SetPublished();
135*cdf0e10cSrcweir }
136*cdf0e10cSrcweir 
137*cdf0e10cSrcweir void
138*cdf0e10cSrcweir UnoIDL_PE::SetOptional()
139*cdf0e10cSrcweir {
140*cdf0e10cSrcweir 	if (NOT pDocu)
141*cdf0e10cSrcweir 	{
142*cdf0e10cSrcweir 		pDocu = new ary::doc::OldIdlDocu;
143*cdf0e10cSrcweir 	}
144*cdf0e10cSrcweir 	pDocu->SetOptional();
145*cdf0e10cSrcweir }
146*cdf0e10cSrcweir 
147*cdf0e10cSrcweir void
148*cdf0e10cSrcweir UnoIDL_PE::PassDocuAt( ary::idl::CodeEntity & io_rCe )
149*cdf0e10cSrcweir {
150*cdf0e10cSrcweir 	if (pDocu)
151*cdf0e10cSrcweir 	{
152*cdf0e10cSrcweir         io_rCe.Set_Docu(*pDocu.Release());
153*cdf0e10cSrcweir 	}
154*cdf0e10cSrcweir     else if // KORR_FUTURE
155*cdf0e10cSrcweir             // Re-enable doc-warning for Enum Values, as soon as there is a
156*cdf0e10cSrcweir             //   @option -no-doc-for-enumvalues.
157*cdf0e10cSrcweir             (     NOT ary::is_type<ary::idl::Module>(io_rCe)
158*cdf0e10cSrcweir               AND NOT ary::is_type<ary::idl::Enum>(io_rCe)  )
159*cdf0e10cSrcweir     {
160*cdf0e10cSrcweir         TheMessages().Out_MissingDoc(
161*cdf0e10cSrcweir                         io_rCe.LocalName(),
162*cdf0e10cSrcweir                         ParseInfo().CurFile(),
163*cdf0e10cSrcweir                         ParseInfo().CurLine() );
164*cdf0e10cSrcweir     }
165*cdf0e10cSrcweir }
166*cdf0e10cSrcweir 
167*cdf0e10cSrcweir void
168*cdf0e10cSrcweir UnoIDL_PE::InitData()
169*cdf0e10cSrcweir {
170*cdf0e10cSrcweir 	// Needs not anything to do.
171*cdf0e10cSrcweir }
172*cdf0e10cSrcweir 
173*cdf0e10cSrcweir void
174*cdf0e10cSrcweir UnoIDL_PE::ReceiveData()
175*cdf0e10cSrcweir {
176*cdf0e10cSrcweir 	// Needs not anything to do.
177*cdf0e10cSrcweir }
178*cdf0e10cSrcweir 
179*cdf0e10cSrcweir const ary::idl::Module &
180*cdf0e10cSrcweir UnoIDL_PE::CurNamespace() const
181*cdf0e10cSrcweir {
182*cdf0e10cSrcweir 	if ( Parent() != 0 )
183*cdf0e10cSrcweir 		return Parent()->CurNamespace();
184*cdf0e10cSrcweir 	else
185*cdf0e10cSrcweir 	{
186*cdf0e10cSrcweir 		csv_assert(false);
187*cdf0e10cSrcweir 		return *(const ary::idl::Module*)0;
188*cdf0e10cSrcweir 	}
189*cdf0e10cSrcweir }
190*cdf0e10cSrcweir 
191*cdf0e10cSrcweir const ParserInfo &
192*cdf0e10cSrcweir UnoIDL_PE::ParseInfo() const
193*cdf0e10cSrcweir {
194*cdf0e10cSrcweir 	if ( Parent() != 0 )
195*cdf0e10cSrcweir 		return Parent()->ParseInfo();
196*cdf0e10cSrcweir 	else
197*cdf0e10cSrcweir 	{
198*cdf0e10cSrcweir 		csv_assert(false);
199*cdf0e10cSrcweir 		return *(const ParserInfo*)0;
200*cdf0e10cSrcweir 	}
201*cdf0e10cSrcweir }
202*cdf0e10cSrcweir 
203*cdf0e10cSrcweir UnoIDL_PE::UnoIDL_PE()
204*cdf0e10cSrcweir     :   aMyNode(),
205*cdf0e10cSrcweir         pDocu(),
206*cdf0e10cSrcweir         pRepository(0)
207*cdf0e10cSrcweir {
208*cdf0e10cSrcweir }
209*cdf0e10cSrcweir 
210*cdf0e10cSrcweir 
211*cdf0e10cSrcweir }   // namespace uidl
212*cdf0e10cSrcweir }   // namespace csi
213