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_attri.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_attri.hxx>
35 // NOT FULLY DEFINED SERVICES
36 #include <ary/idl/i_gate.hxx>
37 #include <ary/idl/i_attribute.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_type2.hxx>
42 #include <s2_luidl/pe_vari2.hxx>
43 #include <s2_luidl/tk_keyw.hxx>
44 #include <s2_luidl/tk_ident.hxx>
45 #include <s2_luidl/tk_punct.hxx>
56 PE_Attribute::PE_Attribute( const Ce_id
& i_rCurOwner
)
58 pCurOwner(&i_rCurOwner
),
67 pPE_Variable
= new PE_Variable(nCurParsedType
, sCurParsedName
);
68 pPE_Exception
= new PE_Type(nCurParsedType
);
72 PE_Attribute::EstablishContacts( UnoIDL_PE
* io_pParentPE
,
73 ary::Repository
& io_rRepository
,
74 TokenProcessing_Result
& o_rResult
)
76 UnoIDL_PE::EstablishContacts(io_pParentPE
,io_rRepository
,o_rResult
);
77 pPE_Variable
->EstablishContacts(this,io_rRepository
,o_rResult
);
78 pPE_Exception
->EstablishContacts(this,io_rRepository
,o_rResult
);
81 PE_Attribute::~PE_Attribute()
86 PE_Attribute::ProcessToken( const Token
& i_rToken
)
88 i_rToken
.Trigger(*this);
92 PE_Attribute::Process_Identifier( const TokIdentifier
& i_rToken
)
97 SetResult(not_done
, push_sure
, pPE_Variable
.Ptr());
101 if (strcmp(i_rToken
.Text(),"get") == 0)
103 SetResult(done
, stay
);
106 else if (strcmp(i_rToken
.Text(),"set") == 0)
108 SetResult(done
, stay
);
113 SetResult(not_done
, pop_failure
);
119 SetResult(not_done
, push_sure
, pPE_Exception
.Ptr());
122 SetResult(not_done
, pop_failure
);
127 PE_Attribute::Process_Stereotype( const TokStereotype
& i_rToken
)
129 if (eState
!= e_start
)
131 SetResult(not_done
, pop_failure
);
136 switch (i_rToken
.Id())
138 case TokStereotype::ste_readonly
:
141 case TokStereotype::ste_bound
:
145 SetResult(not_done
, pop_failure
);
150 SetResult(done
, stay
);
154 PE_Attribute::Process_MetaType( const TokMetaType
& i_rToken
)
156 if (eState
!= e_start OR i_rToken
.Id() != TokMetaType::mt_attribute
)
158 SetResult(not_done
, pop_failure
);
163 SetResult(done
, stay
);
167 PE_Attribute::Process_Punctuation( const TokPunctuation
& i_rToken
)
172 SetResult(done
, stay
);
175 switch(i_rToken
.Id())
177 case TokPunctuation::Semicolon
:
178 SetResult(done
, pop_success
);
181 case TokPunctuation::Comma
:
182 SetResult(not_done
, pop_failure
);
183 Cerr() << "Autodoc does not support comma separated attributes, because those are discouraged by IDL policies." << Endl();
185 case TokPunctuation::CurledBracketOpen
:
186 SetResult(done
, stay
);
187 eState
= in_raise_std
;
190 SetResult(not_done
, pop_failure
);
194 SetResult(done
, stay
);
195 if (i_rToken
.Id() == TokPunctuation::CurledBracketClose
)
202 SetResult(done
, stay
);
203 if (i_rToken
.Id() == TokPunctuation::Semicolon
)
205 eState
= in_raise_std
;
214 PE_Attribute::Process_Raises()
216 if (eState
== in_get OR eState
== in_set
)
218 SetResult(done
, stay
);
221 SetResult(not_done
, pop_failure
);
225 PE_Attribute::Process_Default()
227 if (eState
== e_start
)
229 SetResult(not_done
, push_sure
, pPE_Variable
.Ptr());
230 eState
= in_variable
;
232 else if (eState
== in_get OR eState
== in_set
)
233 SetResult(not_done
, push_sure
, pPE_Exception
.Ptr());
235 SetResult(not_done
, pop_failure
);
239 PE_Attribute::InitData()
251 PE_Attribute::TransferData()
257 PE_Attribute::ReceiveData()
262 csv_assert(pCurOwner
->IsValid());
263 pCurAttribute
= &Gate().Ces().Store_Attribute(
269 PassDocuAt(*pCurAttribute
);
274 csv_assert(pCurAttribute
!= 0);
275 pCurAttribute
->Add_GetException(nCurParsedType
);
279 csv_assert(pCurAttribute
!= 0);
280 pCurAttribute
->Add_SetException(nCurParsedType
);