1 /************************************************************** 2 * 3 * Licensed to the Apache Software Foundation (ASF) under one 4 * or more contributor license agreements. See the NOTICE file 5 * distributed with this work for additional information 6 * regarding copyright ownership. The ASF licenses this file 7 * to you under the Apache License, Version 2.0 (the 8 * "License"); you may not use this file except in compliance 9 * with the License. You may obtain a copy of the License at 10 * 11 * http://www.apache.org/licenses/LICENSE-2.0 12 * 13 * Unless required by applicable law or agreed to in writing, 14 * software distributed under the License is distributed on an 15 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 16 * KIND, either express or implied. See the License for the 17 * specific language governing permissions and limitations 18 * under the License. 19 * 20 *************************************************************/ 21 22 23 24 #ifndef ADC_CPP_PE_ENUM_HXX 25 #define ADC_CPP_PE_ENUM_HXX 26 27 28 29 30 // USED SERVICES 31 // BASE CLASSES 32 #include "cpp_pe.hxx" 33 // COMPONENTS 34 #include <semantic/callf.hxx> 35 #include <semantic/sub_peu.hxx> 36 // PARAMETERS 37 // #include "all_toks.hxx" 38 39 40 namespace cpp { 41 42 43 class PE_EnumValue; 44 45 class PE_Enum : public cpp::Cpp_PE 46 { 47 public: 48 enum E_State 49 { 50 expectName, /// after "enum" 51 gotName, /// after name, before : or { 52 bodyStd, /// after { 53 afterBlock, /// after ending } 54 size_of_states 55 }; 56 57 enum E_KindOfResult 58 { 59 is_declaration, // normal 60 is_implicit_declaration, // like in: enum Abc { rot, gelb, blau } aAbc; 61 is_qualified_typename // like in: enum Abc * fx(); 62 63 }; 64 PE_Enum( 65 Cpp_PE * i_pParent ); 66 ~PE_Enum(); 67 68 virtual void Call_Handler( 69 const cpp::Token & i_rTok ); 70 71 E_KindOfResult Result_KindOf() const; 72 const String & Result_LocalName() const; 73 const String & Result_FirstNameSegment() const; 74 75 private: 76 typedef SubPe< PE_Enum, PE_EnumValue > SP_EnumValue; 77 typedef SubPeUse< PE_Enum, PE_EnumValue> SPU_EnumValue; 78 79 void Setup_StatusFunctions(); 80 virtual void InitData(); 81 virtual void TransferData(); 82 void Hdl_SyntaxError( const char *); 83 84 void On_expectName_Identifier( const char * ); 85 void On_expectName_SwBracket_Left( const char * ); 86 87 void On_gotName_SwBracket_Left( const char * ); 88 void On_gotName_Return2Type( const char * ); 89 90 void On_bodyStd_Identifier( const char * ); 91 void On_bodyStd_SwBracket_Right( const char * ); 92 93 void On_afterBlock_Semicolon( const char * ); 94 void On_afterBlock_Return2Type( const char * ); 95 96 // DATA 97 Dyn< PeStatusArray<PE_Enum> > 98 pStati; 99 Dyn<SP_EnumValue> pSpValue; 100 Dyn<SPU_EnumValue> pSpuValue; 101 102 String sLocalName; 103 ary::cpp::Enum * pCurObject; 104 105 E_KindOfResult eResult_KindOf; 106 }; 107 108 109 110 // IMPLEMENTATION 111 inline PE_Enum::E_KindOfResult 112 PE_Enum::Result_KindOf() const 113 { 114 return eResult_KindOf; 115 } 116 117 inline const String & 118 PE_Enum::Result_LocalName() const 119 { 120 return sLocalName; 121 } 122 123 inline const String & 124 PE_Enum::Result_FirstNameSegment() const 125 { 126 return sLocalName; 127 } 128 129 130 } // namespace cpp 131 132 133 #endif 134 135