Bump for 3.6-28
[LibreOffice.git] / autodoc / source / parser_i / idl / pe_selem.cxx
blob7dabd57b82054b585651bc2c8d8674b8867a2d0b
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*************************************************************************
4 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
6 * Copyright 2000, 2010 Oracle and/or its affiliates.
8 * OpenOffice.org - a multi-platform office productivity suite
10 * This file is part of OpenOffice.org.
12 * OpenOffice.org is free software: you can redistribute it and/or modify
13 * it under the terms of the GNU Lesser General Public License version 3
14 * only, as published by the Free Software Foundation.
16 * OpenOffice.org is distributed in the hope that it will be useful,
17 * but WITHOUT ANY WARRANTY; without even the implied warranty of
18 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 * GNU Lesser General Public License version 3 for more details
20 * (a copy is included in the LICENSE file that accompanied this code).
22 * You should have received a copy of the GNU Lesser General Public License
23 * version 3 along with OpenOffice.org. If not, see
24 * <http://www.openoffice.org/license.html>
25 * for a copy of the LGPLv3 License.
27 ************************************************************************/
29 #include <precomp.h>
30 #include <s2_luidl/pe_selem.hxx>
32 // NOT FULLY DECLARED SERVICES
33 #include <ary/idl/i_gate.hxx>
34 #include <ary/idl/i_struct.hxx>
35 #include <ary/idl/i_structelem.hxx>
36 #include <ary/idl/ip_ce.hxx>
37 #include <ary/doc/d_oldidldocu.hxx>
38 #include <s2_luidl/pe_type2.hxx>
39 #include <s2_luidl/tk_ident.hxx>
40 #include <s2_luidl/tk_punct.hxx>
43 namespace csi
45 namespace uidl
48 namespace
50 const String C_sNone;
53 PE_StructElement::PE_StructElement( RStructElement & o_rResult,
54 const RStruct & i_rCurStruct,
55 const String & i_rCurStructTemplateParam )
56 : eState(e_none),
57 pResult(&o_rResult),
58 pCurStruct(&i_rCurStruct),
59 bIsExceptionElement(false),
60 pPE_Type(0),
61 nType(0),
62 sName(),
63 pCurStructTemplateParam(&i_rCurStructTemplateParam)
65 pPE_Type = new PE_Type(nType);
68 PE_StructElement::PE_StructElement( RStructElement & o_rResult,
69 const RStruct & i_rCurExc )
70 : eState(e_none),
71 pResult(&o_rResult),
72 pCurStruct(&i_rCurExc),
73 bIsExceptionElement(true),
74 pPE_Type(0),
75 nType(0),
76 sName(),
77 pCurStructTemplateParam(&C_sNone)
79 pPE_Type = new PE_Type(nType);
82 void
83 PE_StructElement::EstablishContacts( UnoIDL_PE * io_pParentPE,
84 ary::Repository & io_rRepository,
85 TokenProcessing_Result & o_rResult )
87 UnoIDL_PE::EstablishContacts(io_pParentPE,io_rRepository,o_rResult);
88 pPE_Type->EstablishContacts(this,io_rRepository,o_rResult);
91 PE_StructElement::~PE_StructElement()
95 void
96 PE_StructElement::ProcessToken( const Token & i_rToken )
98 i_rToken.Trigger(*this);
101 void
102 PE_StructElement::Process_Default()
104 if (eState == expect_type)
106 SetResult( not_done, push_sure, pPE_Type.Ptr() );
107 eState = expect_name;
109 else {
110 csv_assert(false);
114 void
115 PE_StructElement::Process_Identifier( const TokIdentifier & i_rToken )
117 csv_assert(*i_rToken.Text() != 0);
119 if (eState == expect_type)
121 if ( *pCurStructTemplateParam == i_rToken.Text() )
123 nType = lhf_FindTemplateParamType();
124 SetResult( done, stay );
125 eState = expect_name;
127 else // No template parameter type existing, or not matching:
129 SetResult( not_done, push_sure, pPE_Type.Ptr() );
130 eState = expect_name;
133 else if (eState == expect_name)
135 sName = i_rToken.Text();
136 SetResult( done, stay );
137 eState = expect_finish;
139 else {
140 csv_assert(false);
144 void
145 PE_StructElement::Process_Punctuation( const TokPunctuation &)
147 csv_assert(eState == expect_finish);
149 SetResult( done, pop_success );
152 void
153 PE_StructElement::InitData()
155 eState = expect_type;
157 nType = 0;
158 sName = "";
161 void
162 PE_StructElement::TransferData()
164 csv_assert(pResult != 0 AND pCurStruct != 0);
166 ary::idl::StructElement *
167 pCe = 0;
168 if (bIsExceptionElement)
170 pCe = & Gate().Ces().Store_ExceptionMember(
171 *pCurStruct,
172 sName,
173 nType );
175 else
177 pCe = & Gate().Ces().Store_StructMember(
178 *pCurStruct,
179 sName,
180 nType );
182 *pResult = pCe->CeId();
183 PassDocuAt(*pCe);
185 eState = e_none;
188 UnoIDL_PE &
189 PE_StructElement::MyPE()
191 return *this;
194 ary::idl::Type_id
195 PE_StructElement::lhf_FindTemplateParamType() const
197 const ary::idl::CodeEntity &
198 rCe = Gate().Ces().Find_Ce(*pCurStruct);
199 const ary::idl::Struct &
200 rStruct = static_cast< const ary::idl::Struct& >(rCe);
201 return rStruct.TemplateParameterType();
205 } // namespace uidl
206 } // namespace csi
208 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */