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_attri.hxx>
33 // NOT FULLY DEFINED SERVICES
34 #include <ary/idl/i_gate.hxx>
35 #include <ary/idl/i_attribute.hxx>
36 #include <ary/idl/i_service.hxx>
37 #include <ary/idl/ip_ce.hxx>
38 #include <ary/doc/d_oldidldocu.hxx>
39 #include <s2_luidl/pe_type2.hxx>
40 #include <s2_luidl/pe_vari2.hxx>
41 #include <s2_luidl/tk_keyw.hxx>
42 #include <s2_luidl/tk_ident.hxx>
43 #include <s2_luidl/tk_punct.hxx>
54 PE_Attribute::PE_Attribute( const Ce_id
& i_rCurOwner
)
56 pCurOwner(&i_rCurOwner
),
65 pPE_Variable
= new PE_Variable(nCurParsedType
, sCurParsedName
);
66 pPE_Exception
= new PE_Type(nCurParsedType
);
70 PE_Attribute::EstablishContacts( UnoIDL_PE
* io_pParentPE
,
71 ary::Repository
& io_rRepository
,
72 TokenProcessing_Result
& o_rResult
)
74 UnoIDL_PE::EstablishContacts(io_pParentPE
,io_rRepository
,o_rResult
);
75 pPE_Variable
->EstablishContacts(this,io_rRepository
,o_rResult
);
76 pPE_Exception
->EstablishContacts(this,io_rRepository
,o_rResult
);
79 PE_Attribute::~PE_Attribute()
84 PE_Attribute::ProcessToken( const Token
& i_rToken
)
86 i_rToken
.Trigger(*this);
90 PE_Attribute::Process_Identifier( const TokIdentifier
& i_rToken
)
95 SetResult(not_done
, push_sure
, pPE_Variable
.Ptr());
99 if (strcmp(i_rToken
.Text(),"get") == 0)
101 SetResult(done
, stay
);
104 else if (strcmp(i_rToken
.Text(),"set") == 0)
106 SetResult(done
, stay
);
111 SetResult(not_done
, pop_failure
);
117 SetResult(not_done
, push_sure
, pPE_Exception
.Ptr());
120 SetResult(not_done
, pop_failure
);
125 PE_Attribute::Process_Stereotype( const TokStereotype
& i_rToken
)
127 if (eState
!= e_start
)
129 SetResult(not_done
, pop_failure
);
134 switch (i_rToken
.Id())
136 case TokStereotype::ste_readonly
:
139 case TokStereotype::ste_bound
:
143 SetResult(not_done
, pop_failure
);
148 SetResult(done
, stay
);
152 PE_Attribute::Process_MetaType( const TokMetaType
& i_rToken
)
154 if (eState
!= e_start OR i_rToken
.Id() != TokMetaType::mt_attribute
)
156 SetResult(not_done
, pop_failure
);
161 SetResult(done
, stay
);
165 PE_Attribute::Process_Punctuation( const TokPunctuation
& i_rToken
)
170 SetResult(done
, stay
);
173 switch(i_rToken
.Id())
175 case TokPunctuation::Semicolon
:
176 SetResult(done
, pop_success
);
179 case TokPunctuation::Comma
:
180 SetResult(not_done
, pop_failure
);
181 Cerr() << "Autodoc does not support comma separated attributes, because those are discouraged by IDL policies." << Endl();
183 case TokPunctuation::CurledBracketOpen
:
184 SetResult(done
, stay
);
185 eState
= in_raise_std
;
188 SetResult(not_done
, pop_failure
);
192 SetResult(done
, stay
);
193 if (i_rToken
.Id() == TokPunctuation::CurledBracketClose
)
200 SetResult(done
, stay
);
201 if (i_rToken
.Id() == TokPunctuation::Semicolon
)
203 eState
= in_raise_std
;
212 PE_Attribute::Process_Raises()
214 if (eState
== in_get OR eState
== in_set
)
216 SetResult(done
, stay
);
219 SetResult(not_done
, pop_failure
);
223 PE_Attribute::Process_Default()
225 if (eState
== e_start
)
227 SetResult(not_done
, push_sure
, pPE_Variable
.Ptr());
228 eState
= in_variable
;
230 else if (eState
== in_get OR eState
== in_set
)
231 SetResult(not_done
, push_sure
, pPE_Exception
.Ptr());
233 SetResult(not_done
, pop_failure
);
237 PE_Attribute::InitData()
249 PE_Attribute::TransferData()
255 PE_Attribute::ReceiveData()
260 csv_assert(pCurOwner
->IsValid());
261 pCurAttribute
= &Gate().Ces().Store_Attribute(
267 PassDocuAt(*pCurAttribute
);
272 csv_assert(pCurAttribute
!= 0);
273 pCurAttribute
->Add_GetException(nCurParsedType
);
277 csv_assert(pCurAttribute
!= 0);
278 pCurAttribute
->Add_SetException(nCurParsedType
);
297 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */