1*78bc99aaSAndrew Rist /************************************************************** 2cdf0e10cSrcweir * 3*78bc99aaSAndrew Rist * Licensed to the Apache Software Foundation (ASF) under one 4*78bc99aaSAndrew Rist * or more contributor license agreements. See the NOTICE file 5*78bc99aaSAndrew Rist * distributed with this work for additional information 6*78bc99aaSAndrew Rist * regarding copyright ownership. The ASF licenses this file 7*78bc99aaSAndrew Rist * to you under the Apache License, Version 2.0 (the 8*78bc99aaSAndrew Rist * "License"); you may not use this file except in compliance 9*78bc99aaSAndrew Rist * with the License. You may obtain a copy of the License at 10cdf0e10cSrcweir * 11*78bc99aaSAndrew Rist * http://www.apache.org/licenses/LICENSE-2.0 12cdf0e10cSrcweir * 13*78bc99aaSAndrew Rist * Unless required by applicable law or agreed to in writing, 14*78bc99aaSAndrew Rist * software distributed under the License is distributed on an 15*78bc99aaSAndrew Rist * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 16*78bc99aaSAndrew Rist * KIND, either express or implied. See the License for the 17*78bc99aaSAndrew Rist * specific language governing permissions and limitations 18*78bc99aaSAndrew Rist * under the License. 19cdf0e10cSrcweir * 20*78bc99aaSAndrew Rist *************************************************************/ 21cdf0e10cSrcweir 22cdf0e10cSrcweir #include <precomp.h> 23cdf0e10cSrcweir #include <s2_luidl/pe_vari2.hxx> 24cdf0e10cSrcweir 25cdf0e10cSrcweir 26cdf0e10cSrcweir // NOT FULLY DECLARED SERVICES 27cdf0e10cSrcweir #include <ary/idl/i_gate.hxx> 28cdf0e10cSrcweir #include <ary/idl/i_property.hxx> 29cdf0e10cSrcweir #include <ary/idl/ip_ce.hxx> 30cdf0e10cSrcweir #include <ary/doc/d_oldidldocu.hxx> 31cdf0e10cSrcweir #include <s2_luidl/pe_type2.hxx> 32cdf0e10cSrcweir #include <s2_luidl/tk_keyw.hxx> 33cdf0e10cSrcweir #include <s2_luidl/tk_ident.hxx> 34cdf0e10cSrcweir #include <s2_luidl/tk_punct.hxx> 35cdf0e10cSrcweir 36cdf0e10cSrcweir 37cdf0e10cSrcweir namespace csi 38cdf0e10cSrcweir { 39cdf0e10cSrcweir namespace uidl 40cdf0e10cSrcweir { 41cdf0e10cSrcweir 42cdf0e10cSrcweir 43cdf0e10cSrcweir PE_Variable::PE_Variable( ary::idl::Type_id & i_rResult_Type, 44cdf0e10cSrcweir String & i_rResult_Name ) 45cdf0e10cSrcweir : eState(e_none), 46cdf0e10cSrcweir pResult_Type(&i_rResult_Type), 47cdf0e10cSrcweir pResult_Name(&i_rResult_Name), 48cdf0e10cSrcweir pPE_Type(0) 49cdf0e10cSrcweir { 50cdf0e10cSrcweir pPE_Type = new PE_Type(i_rResult_Type); 51cdf0e10cSrcweir } 52cdf0e10cSrcweir 53cdf0e10cSrcweir void 54cdf0e10cSrcweir PE_Variable::EstablishContacts( UnoIDL_PE * io_pParentPE, 55cdf0e10cSrcweir ary::Repository & io_rRepository, 56cdf0e10cSrcweir TokenProcessing_Result & o_rResult ) 57cdf0e10cSrcweir { 58cdf0e10cSrcweir UnoIDL_PE::EstablishContacts(io_pParentPE,io_rRepository,o_rResult); 59cdf0e10cSrcweir pPE_Type->EstablishContacts(this,io_rRepository,o_rResult); 60cdf0e10cSrcweir } 61cdf0e10cSrcweir 62cdf0e10cSrcweir PE_Variable::~PE_Variable() 63cdf0e10cSrcweir { 64cdf0e10cSrcweir } 65cdf0e10cSrcweir 66cdf0e10cSrcweir void 67cdf0e10cSrcweir PE_Variable::ProcessToken( const Token & i_rToken ) 68cdf0e10cSrcweir { 69cdf0e10cSrcweir i_rToken.Trigger(*this); 70cdf0e10cSrcweir } 71cdf0e10cSrcweir 72cdf0e10cSrcweir 73cdf0e10cSrcweir void 74cdf0e10cSrcweir PE_Variable::Process_Default() 75cdf0e10cSrcweir { 76cdf0e10cSrcweir if (eState == expect_type) 77cdf0e10cSrcweir { 78cdf0e10cSrcweir SetResult( not_done, push_sure, pPE_Type.Ptr() ); 79cdf0e10cSrcweir } 80cdf0e10cSrcweir else{ 81cdf0e10cSrcweir csv_assert(false); 82cdf0e10cSrcweir } 83cdf0e10cSrcweir } 84cdf0e10cSrcweir 85cdf0e10cSrcweir void 86cdf0e10cSrcweir PE_Variable::Process_Identifier( const TokIdentifier & i_rToken ) 87cdf0e10cSrcweir { 88cdf0e10cSrcweir if (eState == expect_type) 89cdf0e10cSrcweir { 90cdf0e10cSrcweir SetResult( not_done, push_sure, pPE_Type.Ptr() ); 91cdf0e10cSrcweir } 92cdf0e10cSrcweir else if (eState == expect_name) 93cdf0e10cSrcweir { 94cdf0e10cSrcweir *pResult_Name = i_rToken.Text(); 95cdf0e10cSrcweir SetResult( done, stay ); 96cdf0e10cSrcweir eState = expect_finish; 97cdf0e10cSrcweir } 98cdf0e10cSrcweir else { 99cdf0e10cSrcweir csv_assert(false); 100cdf0e10cSrcweir } 101cdf0e10cSrcweir } 102cdf0e10cSrcweir 103cdf0e10cSrcweir void 104cdf0e10cSrcweir PE_Variable::Process_Punctuation( const TokPunctuation & ) 105cdf0e10cSrcweir { 106cdf0e10cSrcweir if (eState == expect_finish) 107cdf0e10cSrcweir { 108cdf0e10cSrcweir SetResult( not_done, pop_success ); 109cdf0e10cSrcweir eState = e_none; 110cdf0e10cSrcweir } 111cdf0e10cSrcweir else if (eState == expect_name) 112cdf0e10cSrcweir { 113cdf0e10cSrcweir SetResult( not_done, pop_success ); 114cdf0e10cSrcweir eState = e_none; 115cdf0e10cSrcweir } 116cdf0e10cSrcweir else { 117cdf0e10cSrcweir csv_assert(false); 118cdf0e10cSrcweir } 119cdf0e10cSrcweir } 120cdf0e10cSrcweir 121cdf0e10cSrcweir void 122cdf0e10cSrcweir PE_Variable::Process_BuiltInType( const TokBuiltInType & i_rToken ) 123cdf0e10cSrcweir { 124cdf0e10cSrcweir if (eState == expect_type) 125cdf0e10cSrcweir { 126cdf0e10cSrcweir SetResult( not_done, push_sure, pPE_Type.Ptr() ); 127cdf0e10cSrcweir } 128cdf0e10cSrcweir else if (eState == expect_name AND i_rToken.Id() == TokBuiltInType::bty_ellipse) 129cdf0e10cSrcweir { 130cdf0e10cSrcweir SetResult( not_done, pop_success ); 131cdf0e10cSrcweir eState = e_none; 132cdf0e10cSrcweir } 133cdf0e10cSrcweir else { 134cdf0e10cSrcweir csv_assert(false); 135cdf0e10cSrcweir } 136cdf0e10cSrcweir } 137cdf0e10cSrcweir 138cdf0e10cSrcweir void 139cdf0e10cSrcweir PE_Variable::InitData() 140cdf0e10cSrcweir { 141cdf0e10cSrcweir eState = expect_type; 142cdf0e10cSrcweir 143cdf0e10cSrcweir *pResult_Type = 0; 144cdf0e10cSrcweir *pResult_Name = ""; 145cdf0e10cSrcweir } 146cdf0e10cSrcweir 147cdf0e10cSrcweir void 148cdf0e10cSrcweir PE_Variable::ReceiveData() 149cdf0e10cSrcweir { 150cdf0e10cSrcweir eState = expect_name; 151cdf0e10cSrcweir } 152cdf0e10cSrcweir 153cdf0e10cSrcweir void 154cdf0e10cSrcweir PE_Variable::TransferData() 155cdf0e10cSrcweir { 156cdf0e10cSrcweir eState = e_none; 157cdf0e10cSrcweir } 158cdf0e10cSrcweir 159cdf0e10cSrcweir UnoIDL_PE & 160cdf0e10cSrcweir PE_Variable::MyPE() 161cdf0e10cSrcweir { 162cdf0e10cSrcweir return *this; 163cdf0e10cSrcweir } 164cdf0e10cSrcweir 165cdf0e10cSrcweir } // namespace uidl 166cdf0e10cSrcweir } // namespace csi 167cdf0e10cSrcweir 168