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