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_property.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_property.hxx>
35 // NOT FULLY DEFINED SERVICES
36 #include <ary/idl/i_gate.hxx>
37 #include <ary/idl/i_property.hxx>
38 #include <ary/idl/i_service.hxx>
39 #include <ary/idl/ip_ce.hxx>
40 #include <ary/doc/d_oldidldocu.hxx>
41 #include <s2_luidl/pe_vari2.hxx>
42 #include <s2_luidl/tk_keyw.hxx>
43 #include <s2_luidl/tk_ident.hxx>
44 #include <s2_luidl/tk_punct.hxx>
55 PE_Property::PE_Property( const Ce_id
& i_rCurOwner
)
57 pCurOwner(&i_rCurOwner
),
64 pPE_Variable
= new PE_Variable(nCurParsedType
, sCurParsedName
);
68 PE_Property::EstablishContacts( UnoIDL_PE
* io_pParentPE
,
69 ary::Repository
& io_rRepository
,
70 TokenProcessing_Result
& o_rResult
)
72 UnoIDL_PE::EstablishContacts(io_pParentPE
,io_rRepository
,o_rResult
);
73 pPE_Variable
->EstablishContacts(this,io_rRepository
,o_rResult
);
76 PE_Property::~PE_Property()
81 PE_Property::ProcessToken( const Token
& i_rToken
)
83 i_rToken
.Trigger(*this);
87 PE_Property::Process_Stereotype( const TokStereotype
& i_rToken
)
89 switch (i_rToken
.Id())
91 case TokStereotype::ste_optional
:
94 case TokStereotype::ste_readonly
:
95 aStereotypes
.Set_Flag(Stereotypes::readonly
);
97 case TokStereotype::ste_bound
:
98 aStereotypes
.Set_Flag(Stereotypes::bound
);
100 case TokStereotype::ste_constrained
:
101 aStereotypes
.Set_Flag(Stereotypes::constrained
);
103 case TokStereotype::ste_maybeambiguous
:
104 aStereotypes
.Set_Flag(Stereotypes::maybeambiguous
);
106 case TokStereotype::ste_maybedefault
:
107 aStereotypes
.Set_Flag(Stereotypes::maybedefault
);
109 case TokStereotype::ste_maybevoid
:
110 aStereotypes
.Set_Flag(Stereotypes::maybevoid
);
112 case TokStereotype::ste_removable
:
113 aStereotypes
.Set_Flag(Stereotypes::removable
);
115 case TokStereotype::ste_transient
:
116 aStereotypes
.Set_Flag(Stereotypes::transient
);
120 SetResult(not_done
, pop_failure
);
125 SetResult(done
, stay
);
129 PE_Property::Process_MetaType( const TokMetaType
& i_rToken
)
131 if (eState
== e_start
)
133 if ( i_rToken
.Id() == TokMetaType::mt_property
)
135 SetResult(done
, stay
);
136 eState
= expect_variable
;
139 } // endif (eState == e_start)
141 SetResult(not_done
, pop_failure
);
146 PE_Property::Process_Punctuation( const TokPunctuation
& i_rToken
)
151 SetResult(done
, stay
);
153 case expect_variable
:
154 if (i_rToken
.Id() == TokPunctuation::Semicolon
)
156 SetResult(done
, pop_success
);
159 else if (i_rToken
.Id() == TokPunctuation::Comma
)
160 SetResult(done
, stay
);
162 SetResult(not_done
, pop_failure
);
170 PE_Property::Process_Default()
172 if (eState
== expect_variable
)
174 SetResult(not_done
, push_sure
, pPE_Variable
.Ptr());
175 eState
= in_variable
;
178 SetResult(not_done
, pop_failure
);
182 PE_Property::InitData()
191 // may be preset by the PE_Service-(or PE_Interface-)parent
192 // with PresetOptional() or
193 // PresetStereotype()
194 // - therefore it must not be set here!
198 PE_Property::TransferData()
206 ary::idl::CodeEntity
*
208 csv_assert(pCurOwner
->IsValid());
210 pCe
= &Gate().Ces().Store_Property( *pCurOwner
,
215 csv_assert(pCe
!= 0);
219 sCurParsedName
.clear();
220 aStereotypes
= Stereotypes();
226 PE_Property::ReceiveData()
228 eState
= expect_variable
;