merge the formfield patch from ooo-build
[ooovba.git] / autodoc / source / parser_i / idl / pe_property.cxx
blob3cc472ec41a602a99853324e7f27c11e5887049c
1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 *
5 * Copyright 2008 by Sun Microsystems, Inc.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * $RCSfile: pe_property.cxx,v $
10 * $Revision: 1.7 $
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 ************************************************************************/
31 #include <precomp.h>
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>
48 namespace csi
50 namespace uidl
55 PE_Property::PE_Property( const Ce_id & i_rCurOwner )
56 : eState(e_none),
57 pCurOwner(&i_rCurOwner),
58 pPE_Variable(0),
59 nCurParsedType(0),
60 sCurParsedName(),
61 bIsOptional(false),
62 aStereotypes()
64 pPE_Variable = new PE_Variable(nCurParsedType, sCurParsedName);
67 void
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()
80 void
81 PE_Property::ProcessToken( const Token & i_rToken )
83 i_rToken.Trigger(*this);
86 void
87 PE_Property::Process_Stereotype( const TokStereotype & i_rToken )
89 switch (i_rToken.Id())
91 case TokStereotype::ste_optional:
92 bIsOptional = true;
93 break;
94 case TokStereotype::ste_readonly:
95 aStereotypes.Set_Flag(Stereotypes::readonly);
96 break;
97 case TokStereotype::ste_bound:
98 aStereotypes.Set_Flag(Stereotypes::bound);
99 break;
100 case TokStereotype::ste_constrained:
101 aStereotypes.Set_Flag(Stereotypes::constrained);
102 break;
103 case TokStereotype::ste_maybeambiguous:
104 aStereotypes.Set_Flag(Stereotypes::maybeambiguous);
105 break;
106 case TokStereotype::ste_maybedefault:
107 aStereotypes.Set_Flag(Stereotypes::maybedefault);
108 break;
109 case TokStereotype::ste_maybevoid:
110 aStereotypes.Set_Flag(Stereotypes::maybevoid);
111 break;
112 case TokStereotype::ste_removable:
113 aStereotypes.Set_Flag(Stereotypes::removable);
114 break;
115 case TokStereotype::ste_transient:
116 aStereotypes.Set_Flag(Stereotypes::transient);
117 break;
119 default:
120 SetResult(not_done, pop_failure);
121 eState = e_none;
122 return;
125 SetResult(done, stay);
128 void
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;
137 return;
139 } // endif (eState == e_start)
141 SetResult(not_done, pop_failure);
142 eState = e_none;
145 void
146 PE_Property::Process_Punctuation( const TokPunctuation & i_rToken )
148 switch (eState)
150 case e_start:
151 SetResult(done, stay);
152 break;
153 case expect_variable:
154 if (i_rToken.Id() == TokPunctuation::Semicolon)
156 SetResult(done, pop_success);
157 eState = e_none;
159 else if (i_rToken.Id() == TokPunctuation::Comma)
160 SetResult(done, stay);
161 else
162 SetResult(not_done, pop_failure);
163 break;
164 default:
165 csv_assert(false);
169 void
170 PE_Property::Process_Default()
172 if (eState == expect_variable)
174 SetResult(not_done, push_sure, pPE_Variable.Ptr());
175 eState = in_variable;
177 else
178 SetResult(not_done, pop_failure);
181 void
182 PE_Property::InitData()
184 eState = e_start;
186 nCurParsedType = 0;
187 sCurParsedName = "";
189 // bIsOptional and
190 // aStereotypes
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!
197 void
198 PE_Property::TransferData()
200 if (bIsOptional)
202 SetOptional();
203 bIsOptional = false;
206 ary::idl::CodeEntity *
207 pCe = 0;
208 csv_assert(pCurOwner->IsValid());
210 pCe = &Gate().Ces().Store_Property( *pCurOwner,
211 sCurParsedName,
212 nCurParsedType,
213 aStereotypes );
215 csv_assert(pCe != 0);
216 PassDocuAt(*pCe);
218 nCurParsedType = 0;
219 sCurParsedName.clear();
220 aStereotypes = Stereotypes();
222 eState = e_none;
225 void
226 PE_Property::ReceiveData()
228 eState = expect_variable;
232 UnoIDL_PE &
233 PE_Property::MyPE()
235 return *this;
239 } // namespace uidl
240 } // namespace csi