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 ************************************************************************/
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>
53 PE_StructElement::PE_StructElement( RStructElement
& o_rResult
,
54 const RStruct
& i_rCurStruct
,
55 const String
& i_rCurStructTemplateParam
)
58 pCurStruct(&i_rCurStruct
),
59 bIsExceptionElement(false),
63 pCurStructTemplateParam(&i_rCurStructTemplateParam
)
65 pPE_Type
= new PE_Type(nType
);
68 PE_StructElement::PE_StructElement( RStructElement
& o_rResult
,
69 const RStruct
& i_rCurExc
)
72 pCurStruct(&i_rCurExc
),
73 bIsExceptionElement(true),
77 pCurStructTemplateParam(&C_sNone
)
79 pPE_Type
= new PE_Type(nType
);
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()
96 PE_StructElement::ProcessToken( const Token
& i_rToken
)
98 i_rToken
.Trigger(*this);
102 PE_StructElement::Process_Default()
104 if (eState
== expect_type
)
106 SetResult( not_done
, push_sure
, pPE_Type
.Ptr() );
107 eState
= expect_name
;
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
;
145 PE_StructElement::Process_Punctuation( const TokPunctuation
&)
147 csv_assert(eState
== expect_finish
);
149 SetResult( done
, pop_success
);
153 PE_StructElement::InitData()
155 eState
= expect_type
;
162 PE_StructElement::TransferData()
164 csv_assert(pResult
!= 0 AND pCurStruct
!= 0);
166 ary::idl::StructElement
*
168 if (bIsExceptionElement
)
170 pCe
= & Gate().Ces().Store_ExceptionMember(
177 pCe
= & Gate().Ces().Store_StructMember(
182 *pResult
= pCe
->CeId();
189 PE_StructElement::MyPE()
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();
208 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */