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_FILE_HXX 29 #define ADC_CPP_PE_FILE_HXX 30 31 32 33 // USED SERVICES 34 // BASE CLASSES 35 #include "cpp_pe.hxx" 36 // COMPONENTS 37 #include <semantic/callf.hxx> 38 #include <semantic/sub_peu.hxx> 39 // PARAMETERS 40 41 42 namespace cpp { 43 44 class PeEnvironment; 45 46 class PE_Namespace; 47 class PE_Enum; 48 class PE_Typedef; 49 class PE_VarFunc; 50 class PE_TemplateTop; 51 class PE_Defines; 52 class PE_Ignore; 53 54 #if 0 55 class PE_Template; 56 class PE_Extern; 57 #endif 58 59 60 class PE_File : public Cpp_PE 61 { 62 public: 63 enum E_State 64 { 65 std, /// before class, struct or union 66 in_extern, 67 in_externC, 68 size_of_states 69 }; 70 71 PE_File( 72 PeEnvironment & io_rEnv ); 73 ~PE_File(); 74 75 virtual void Call_Handler( 76 const cpp::Token & i_rTok ); 77 virtual Cpp_PE * Handle_ChildFailure(); 78 79 private: 80 typedef SubPe< PE_File, PE_Namespace> SP_Namespace; 81 typedef SubPe< PE_File, PE_Typedef> SP_Typedef; 82 typedef SubPe< PE_File, PE_VarFunc> SP_VarFunc; 83 typedef SubPe< PE_File, PE_TemplateTop> SP_Template; 84 typedef SubPe< PE_File, PE_Defines> SP_Defines; 85 typedef SubPe< PE_File, PE_Ignore > SP_Ignore; 86 #if 0 87 typedef SubPe< PE_File, PE_Using> SP_Using; 88 #endif // 0 89 90 typedef SubPeUse< PE_File, PE_Namespace> SPU_Namespace; 91 typedef SubPeUse< PE_File, PE_Typedef> SPU_Typedef; 92 typedef SubPeUse< PE_File, PE_VarFunc> SPU_VarFunc; 93 typedef SubPeUse< PE_File, PE_TemplateTop> SPU_Template; 94 typedef SubPeUse< PE_File, PE_Defines> SPU_Defines; 95 typedef SubPeUse< PE_File, PE_Ignore> SPU_Ignore; 96 97 void Setup_StatusFunctions(); 98 virtual void InitData(); 99 virtual void TransferData(); 100 void Hdl_SyntaxError( const char *); 101 102 void SpReturn_VarFunc(); 103 void SpReturn_Template(); 104 105 void On_std_namespace(const char * i_sText); 106 void On_std_ClassKey(const char * i_sText); 107 void On_std_typedef(const char * i_sText); 108 void On_std_enum(const char * i_sText); 109 void On_std_VarFunc(const char * i_sText); 110 void On_std_template(const char * i_sText); 111 void On_std_extern(const char * i_sText); 112 void On_std_using(const char * i_sText); 113 void On_std_SwBracketRight(const char * i_sText); 114 115 void On_std_DefineName(const char * i_sText); 116 void On_std_MacroName(const char * i_sText); 117 118 void On_in_extern_Constant(const char * i_sText); 119 void On_in_extern_Ignore(const char * i_sText); 120 void On_in_externC_SwBracket_Left(const char * i_sText); 121 void On_in_externC_NoBlock(const char * i_sText); 122 123 PeEnvironment & access_Env() { return *pEnv; } 124 125 126 // DATA 127 PeEnvironment * pEnv; 128 129 Dyn< PeStatusArray<PE_File> > 130 pStati; 131 132 Dyn<SP_Namespace> pSpNamespace; 133 Dyn<SP_Typedef> pSpTypedef; 134 Dyn<SP_VarFunc> pSpVarFunc; 135 Dyn<SP_Template> pSpTemplate; 136 Dyn<SP_Defines> pSpDefs; 137 138 Dyn<SP_Ignore> pSpIgnore; 139 #if 0 140 SP_Using aSpUsing; 141 #endif // 0 142 143 Dyn<SPU_Namespace> pSpuNamespace; 144 Dyn<SPU_Typedef> pSpuTypedef; 145 Dyn<SPU_VarFunc> pSpuVarFunc; 146 Dyn<SPU_Template> pSpuTemplate; 147 Dyn<SPU_Defines> pSpuDefs; 148 149 Dyn<SPU_Ignore> pSpuUsing; 150 Dyn<SPU_Ignore> pSpuIgnoreFailure; 151 152 bool bWithinSingleExternC; /** After 'extern "C"' without following '{', 153 waiting for the next function or variable to 154 set back to false. 155 */ 156 }; 157 158 } // namespace cpp 159 160 161 162 #if 0 // Branches 163 164 namespace 165 -> Named Namespace declaration 166 -> Unnamed Namespace declaration 167 -> Namespace alias definition 168 169 class struct union 170 -> Class 171 -> Predeclaration 172 173 typedef 174 -> Typedef 175 176 enum 177 -> Enum 178 179 extern 180 -> Extern-"C" 181 -> TypeDeclaration 182 183 TypeDeclaration 184 -> FunctionDecl 185 -> FunctionDef 186 -> Variable 187 188 template 189 -> TemplateClass 190 -> TemplateFunction 191 -> TemplateFunction/Method-Implementation 192 -> TemplatePredeclaration 193 194 } 195 -> End of Namespace 196 -> End of Extern-"C" 197 198 asm 199 -> AssemblerDeclaration 200 201 using 202 -> Using-Declaration 203 -> Using-Directive 204 205 #endif // 0 206 207 208 #endif 209 210