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 ADC_CPP_PE_ENUM_HXX 29 #define ADC_CPP_PE_ENUM_HXX 30 31 32 33 34 // USED SERVICES 35 // BASE CLASSES 36 #include "cpp_pe.hxx" 37 // COMPONENTS 38 #include <semantic/callf.hxx> 39 #include <semantic/sub_peu.hxx> 40 // PARAMETERS 41 // #include "all_toks.hxx" 42 43 44 namespace cpp { 45 46 47 class PE_EnumValue; 48 49 class PE_Enum : public cpp::Cpp_PE 50 { 51 public: 52 enum E_State 53 { 54 expectName, /// after "enum" 55 gotName, /// after name, before : or { 56 bodyStd, /// after { 57 afterBlock, /// after ending } 58 size_of_states 59 }; 60 61 enum E_KindOfResult 62 { 63 is_declaration, // normal 64 is_implicit_declaration, // like in: enum Abc { rot, gelb, blau } aAbc; 65 is_qualified_typename // like in: enum Abc * fx(); 66 67 }; 68 PE_Enum( 69 Cpp_PE * i_pParent ); 70 ~PE_Enum(); 71 72 virtual void Call_Handler( 73 const cpp::Token & i_rTok ); 74 75 E_KindOfResult Result_KindOf() const; 76 const String & Result_LocalName() const; 77 const String & Result_FirstNameSegment() const; 78 79 private: 80 typedef SubPe< PE_Enum, PE_EnumValue > SP_EnumValue; 81 typedef SubPeUse< PE_Enum, PE_EnumValue> SPU_EnumValue; 82 83 void Setup_StatusFunctions(); 84 virtual void InitData(); 85 virtual void TransferData(); 86 void Hdl_SyntaxError( const char *); 87 88 void On_expectName_Identifier( const char * ); 89 void On_expectName_SwBracket_Left( const char * ); 90 91 void On_gotName_SwBracket_Left( const char * ); 92 void On_gotName_Return2Type( const char * ); 93 94 void On_bodyStd_Identifier( const char * ); 95 void On_bodyStd_SwBracket_Right( const char * ); 96 97 void On_afterBlock_Semicolon( const char * ); 98 void On_afterBlock_Return2Type( const char * ); 99 100 // DATA 101 Dyn< PeStatusArray<PE_Enum> > 102 pStati; 103 Dyn<SP_EnumValue> pSpValue; 104 Dyn<SPU_EnumValue> pSpuValue; 105 106 String sLocalName; 107 ary::cpp::Enum * pCurObject; 108 109 E_KindOfResult eResult_KindOf; 110 }; 111 112 113 114 // IMPLEMENTATION 115 inline PE_Enum::E_KindOfResult 116 PE_Enum::Result_KindOf() const 117 { 118 return eResult_KindOf; 119 } 120 121 inline const String & 122 PE_Enum::Result_LocalName() const 123 { 124 return sLocalName; 125 } 126 127 inline const String & 128 PE_Enum::Result_FirstNameSegment() const 129 { 130 return sLocalName; 131 } 132 133 134 } // namespace cpp 135 136 137 #endif 138 139