1 /************************************************************************* 2 * 3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 4 * 5 * Copyright 2000, 2010 Oracle and/or its affiliates. 6 * 7 * OpenOffice.org - a multi-platform office productivity suite 8 * 9 * This file is part of OpenOffice.org. 10 * 11 * OpenOffice.org is free software: you can redistribute it and/or modify 12 * it under the terms of the GNU Lesser General Public License version 3 13 * only, as published by the Free Software Foundation. 14 * 15 * OpenOffice.org is distributed in the hope that it will be useful, 16 * but WITHOUT ANY WARRANTY; without even the implied warranty of 17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 18 * GNU Lesser General Public License version 3 for more details 19 * (a copy is included in the LICENSE file that accompanied this code). 20 * 21 * You should have received a copy of the GNU Lesser General Public License 22 * version 3 along with OpenOffice.org. If not, see 23 * <http://www.openoffice.org/license.html> 24 * for a copy of the LGPLv3 License. 25 * 26 ************************************************************************/ 27 28 #ifndef LUIDL_PE_EXCP_HXX 29 #define LUIDL_PE_EXCP_HXX 30 31 32 33 // USED SERVICES 34 // BASE CLASSES 35 #include <s2_luidl/parsenv2.hxx> 36 #include <s2_luidl/pestate.hxx> 37 // COMPONENTS 38 #include <s2_luidl/semnode.hxx> 39 #include <ary/qualiname.hxx> 40 // PARAMETERS 41 42 43 44 namespace csi 45 { 46 namespace prl 47 { 48 class TNamespace; 49 } 50 } 51 52 53 54 namespace csi 55 { 56 namespace uidl 57 { 58 59 60 class Exception; 61 class StructElement; 62 class PE_StructElement; 63 class PE_Type; 64 65 66 class PE_Exception : public UnoIDL_PE 67 { 68 public: 69 PE_Exception(); 70 virtual void EstablishContacts( 71 UnoIDL_PE * io_pParentPE, 72 ary::Repository & io_rRepository, 73 TokenProcessing_Result & 74 o_rResult ); 75 ~PE_Exception(); 76 virtual void ProcessToken( 77 const Token & i_rToken ); 78 79 private: 80 struct S_Work 81 { 82 S_Work(); 83 84 void InitData(); 85 void Prepare_PE_QualifiedName(); 86 void Prepare_PE_Element(); 87 void Data_Set_Name( 88 const char * i_sName ); 89 // DATA 90 String sData_Name; 91 bool bIsPreDeclaration; 92 ary::idl::Ce_id nCurStruct; 93 94 Dyn<PE_StructElement> 95 pPE_Element; 96 ary::idl::Ce_id nCurParsed_ElementRef; 97 Dyn<PE_Type> pPE_Type; 98 ary::idl::Type_id nCurParsed_Base; 99 }; 100 101 struct S_Stati; 102 class PE_StructState; 103 friend struct S_Stati; 104 friend class PE_StructState; 105 106 107 class PE_StructState : public ParseEnvState 108 { 109 public: 110 111 protected: 112 PE_StructState( 113 PE_Exception & i_rStruct ) 114 : rStruct(i_rStruct) {} 115 void MoveState( 116 ParseEnvState & i_rState ) const; 117 void SetResult( 118 E_TokenDone i_eDone, 119 E_EnvStackAction i_eWhat2DoWithEnvStack, 120 UnoIDL_PE * i_pParseEnv2Push = 0 ) const 121 { rStruct.SetResult(i_eDone, i_eWhat2DoWithEnvStack, i_pParseEnv2Push); } 122 123 S_Stati & Stati() const { return *rStruct.pStati; } 124 S_Work & Work() const { return rStruct.aWork; } 125 PE_Exception & PE() const { return rStruct; } 126 127 private: 128 virtual UnoIDL_PE & MyPE(); 129 // DATA 130 PE_Exception & rStruct; 131 }; 132 133 class State_None : public PE_StructState 134 { 135 public: 136 State_None( 137 PE_Exception & i_rStruct ) 138 : PE_StructState(i_rStruct) {} 139 }; 140 class State_WaitForName : public PE_StructState 141 { // -> Name 142 public: 143 State_WaitForName( 144 PE_Exception & i_rStruct ) 145 : PE_StructState(i_rStruct) {} 146 virtual void Process_Identifier( 147 const TokIdentifier & 148 i_rToken ); 149 }; 150 class State_GotName : public PE_StructState 151 { // -> : { ; 152 public: 153 State_GotName( 154 PE_Exception & i_rStruct ) 155 : PE_StructState(i_rStruct) {} 156 virtual void Process_Punctuation( 157 const TokPunctuation & 158 i_rToken ); 159 }; 160 class State_WaitForBase : public PE_StructState 161 { // -> Base 162 public: 163 State_WaitForBase( 164 PE_Exception & i_rStruct ) 165 : PE_StructState(i_rStruct) {} 166 virtual void On_SubPE_Left(); 167 }; 168 class State_GotBase : public PE_StructState 169 { // -> { 170 public: 171 State_GotBase( 172 PE_Exception & i_rStruct ) 173 : PE_StructState(i_rStruct) {} 174 virtual void Process_Punctuation( 175 const TokPunctuation & 176 i_rToken ); 177 }; 178 class State_WaitForElement : public PE_StructState 179 { // -> Typ } 180 public: 181 State_WaitForElement( 182 PE_Exception & i_rStruct ) 183 : PE_StructState(i_rStruct) {} 184 virtual void Process_Identifier( 185 const TokIdentifier & 186 i_rToken ); 187 virtual void Process_NameSeparator(); 188 virtual void Process_BuiltInType( 189 const TokBuiltInType & 190 i_rToken ); 191 virtual void Process_TypeModifier( 192 const TokTypeModifier & 193 i_rToken ); 194 virtual void Process_Punctuation( 195 const TokPunctuation & 196 i_rToken ); 197 // virtual void On_SubPE_Left(); 198 }; 199 class State_WaitForFinish : public PE_StructState 200 { // -> ; 201 public: 202 State_WaitForFinish( 203 PE_Exception & i_rStruct ) 204 : PE_StructState(i_rStruct) {} 205 virtual void Process_Punctuation( 206 const TokPunctuation & 207 i_rToken ); 208 }; 209 210 struct S_Stati 211 { 212 S_Stati( 213 PE_Exception & io_rStruct ); 214 void SetState( 215 ParseEnvState & i_rNextState ) 216 { pCurStatus = &i_rNextState; } 217 218 State_None aNone; 219 State_WaitForName aWaitForName; 220 State_GotName aGotName; 221 State_WaitForBase aWaitForBase; 222 State_GotBase aGotBase; 223 State_WaitForElement 224 aWaitForElement; 225 State_WaitForFinish aWaitForFinish; 226 227 ParseEnvState * pCurStatus; 228 }; 229 230 virtual void InitData(); 231 virtual void TransferData(); 232 virtual void ReceiveData(); 233 234 public: 235 236 void store_Exception(); 237 238 private: 239 240 S_Stati & Stati() { return *pStati; } 241 S_Work & Work() { return aWork; } 242 243 // DATA 244 S_Work aWork; 245 Dyn<S_Stati> pStati; 246 }; 247 248 249 inline void 250 PE_Exception::PE_StructState::MoveState( 251 ParseEnvState & i_rState ) const 252 { rStruct.Stati().SetState(i_rState); } 253 254 } // namespace uidl 255 } // namespace csi 256 257 258 #endif 259 260