1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5 * Copyright 2008 by Sun Microsystems, Inc.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * $RCSfile: pe_selem.cxx,v $
12 * This file is part of OpenOffice.org.
14 * OpenOffice.org is free software: you can redistribute it and/or modify
15 * it under the terms of the GNU Lesser General Public License version 3
16 * only, as published by the Free Software Foundation.
18 * OpenOffice.org is distributed in the hope that it will be useful,
19 * but WITHOUT ANY WARRANTY; without even the implied warranty of
20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 * GNU Lesser General Public License version 3 for more details
22 * (a copy is included in the LICENSE file that accompanied this code).
24 * You should have received a copy of the GNU Lesser General Public License
25 * version 3 along with OpenOffice.org. If not, see
26 * <http://www.openoffice.org/license.html>
27 * for a copy of the LGPLv3 License.
29 ************************************************************************/
32 #include <s2_luidl/pe_selem.hxx>
34 // NOT FULLY DECLARED SERVICES
35 #include <ary/idl/i_gate.hxx>
36 #include <ary/idl/i_struct.hxx>
37 #include <ary/idl/i_structelem.hxx>
38 #include <ary/idl/ip_ce.hxx>
39 #include <ary/doc/d_oldidldocu.hxx>
40 #include <s2_luidl/pe_type2.hxx>
41 #include <s2_luidl/tk_ident.hxx>
42 #include <s2_luidl/tk_punct.hxx>
55 PE_StructElement::PE_StructElement( RStructElement
& o_rResult
,
56 const RStruct
& i_rCurStruct
,
57 const String
& i_rCurStructTemplateParam
)
60 pCurStruct(&i_rCurStruct
),
61 bIsExceptionElement(false),
65 pCurStructTemplateParam(&i_rCurStructTemplateParam
)
67 pPE_Type
= new PE_Type(nType
);
70 PE_StructElement::PE_StructElement( RStructElement
& o_rResult
,
71 const RStruct
& i_rCurExc
)
74 pCurStruct(&i_rCurExc
),
75 bIsExceptionElement(true),
79 pCurStructTemplateParam(&C_sNone
)
81 pPE_Type
= new PE_Type(nType
);
85 PE_StructElement::EstablishContacts( UnoIDL_PE
* io_pParentPE
,
86 ary::Repository
& io_rRepository
,
87 TokenProcessing_Result
& o_rResult
)
89 UnoIDL_PE::EstablishContacts(io_pParentPE
,io_rRepository
,o_rResult
);
90 pPE_Type
->EstablishContacts(this,io_rRepository
,o_rResult
);
93 PE_StructElement::~PE_StructElement()
98 PE_StructElement::ProcessToken( const Token
& i_rToken
)
100 i_rToken
.Trigger(*this);
104 PE_StructElement::Process_Default()
106 if (eState
== expect_type
)
108 SetResult( not_done
, push_sure
, pPE_Type
.Ptr() );
109 eState
= expect_name
;
117 PE_StructElement::Process_Identifier( const TokIdentifier
& i_rToken
)
119 csv_assert(*i_rToken
.Text() != 0);
121 if (eState
== expect_type
)
123 if ( *pCurStructTemplateParam
== i_rToken
.Text() )
125 nType
= lhf_FindTemplateParamType();
126 SetResult( done
, stay
);
127 eState
= expect_name
;
129 else // No template parameter type existing, or not matching:
131 SetResult( not_done
, push_sure
, pPE_Type
.Ptr() );
132 eState
= expect_name
;
135 else if (eState
== expect_name
)
137 sName
= i_rToken
.Text();
138 SetResult( done
, stay
);
139 eState
= expect_finish
;
147 PE_StructElement::Process_Punctuation( const TokPunctuation
&)
149 csv_assert(eState
== expect_finish
);
151 SetResult( done
, pop_success
);
155 PE_StructElement::InitData()
157 eState
= expect_type
;
164 PE_StructElement::TransferData()
166 csv_assert(pResult
!= 0 AND pCurStruct
!= 0);
168 ary::idl::StructElement
*
170 if (bIsExceptionElement
)
172 pCe
= & Gate().Ces().Store_ExceptionMember(
179 pCe
= & Gate().Ces().Store_StructMember(
184 *pResult
= pCe
->CeId();
191 PE_StructElement::MyPE()
197 PE_StructElement::lhf_FindTemplateParamType() const
199 const ary::idl::CodeEntity
&
200 rCe
= Gate().Ces().Find_Ce(*pCurStruct
);
201 const ary::idl::Struct
&
202 rStruct
= static_cast< const ary::idl::Struct
& >(rCe
);
203 return rStruct
.TemplateParameterType();