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