Update ooo320-m1
[ooovba.git] / autodoc / source / parser / cpp / pe_class.hxx
blob5c6f865395c3d0aa72e264ae505f5bf814b5a346
1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 *
5 * Copyright 2008 by Sun Microsystems, Inc.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * $RCSfile: pe_class.hxx,v $
10 * $Revision: 1.4 $
12 * This file is part of OpenOffice.org.
14 * OpenOffice.org is free software: you can redistribute it and/or modify
15 * it under the terms of the GNU Lesser General Public License version 3
16 * only, as published by the Free Software Foundation.
18 * OpenOffice.org is distributed in the hope that it will be useful,
19 * but WITHOUT ANY WARRANTY; without even the implied warranty of
20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 * GNU Lesser General Public License version 3 for more details
22 * (a copy is included in the LICENSE file that accompanied this code).
24 * You should have received a copy of the GNU Lesser General Public License
25 * version 3 along with OpenOffice.org. If not, see
26 * <http://www.openoffice.org/license.html>
27 * for a copy of the LGPLv3 License.
29 ************************************************************************/
31 #ifndef ADC_CPP_PE_CLASS_HXX
32 #define ADC_CPP_PE_CLASS_HXX
36 // USED SERVICES
37 // BASE CLASSES
38 #include "cpp_pe.hxx"
39 // OTHER
40 #include <semantic/callf.hxx>
41 #include <semantic/sub_peu.hxx>
42 #include <ary/cpp/c_types4cpp.hxx>
43 #include <ary/cpp/c_slntry.hxx>
44 #include "all_toks.hxx"
46 namespace ary
48 namespace cpp
50 class Class;
55 namespace cpp
59 using ary::cpp::E_Protection;
60 using ary::cpp::E_Virtuality;
63 class PE_Base;
64 class PE_Enum;
65 class PE_Typedef;
66 class PE_VarFunc;
67 class PE_Ignore;
68 class PE_Defines;
71 class PE_Class : public cpp::Cpp_PE
73 public:
74 enum E_State
76 start, /// before class, struct or union
77 expectName, /// after class, struct or union
78 gotName, /// after name, before : or {
79 bodyStd, /// after {
80 inProtection, /// after public, protected or private and before ":"
81 afterDecl, /// after ending }
82 size_of_states
85 enum E_KindOfResult
87 is_declaration, // normal
88 is_implicit_declaration, // like in: class Abc { public int n; } aAbc;
89 is_predeclaration, // like: class Abc;
90 is_qualified_typename // like in: class Abc * fx();
94 PE_Class(
95 Cpp_PE * i_pParent );
96 ~PE_Class();
98 virtual void Call_Handler(
99 const cpp::Token & i_rTok );
100 virtual Cpp_PE * Handle_ChildFailure();
102 E_KindOfResult Result_KindOf() const;
103 const String & Result_LocalName() const;
104 const String & Result_FirstNameSegment() const;
106 private:
107 typedef SubPe< PE_Class, PE_Base > SP_Base;
108 // typedef SubPe< PE_Class, PE_Enum> SP_Enum;
109 typedef SubPe< PE_Class, PE_Typedef> SP_Typedef;
110 typedef SubPe< PE_Class, PE_VarFunc> SP_VarFunc;
111 typedef SubPe< PE_Class, PE_Ignore > SP_Ignore;
112 typedef SubPe< PE_Class, PE_Defines> SP_Defines;
114 typedef SubPeUse< PE_Class, PE_Base> SPU_Base;
115 // typedef SubPeUse< PE_Class, PE_Enum> SPU_Enum;
116 typedef SubPeUse< PE_Class, PE_Typedef> SPU_Typedef;
117 typedef SubPeUse< PE_Class, PE_VarFunc> SPU_VarFunc;
118 typedef SubPeUse< PE_Class, PE_Ignore> SPU_Ignore;
119 typedef SubPeUse< PE_Class, PE_Defines> SPU_Defines;
121 typedef ary::cpp::List_Bases BaseList;
122 typedef ary::cpp::S_Classes_Base Base;
123 typedef ary::cpp::E_Protection E_Protection;
125 void Setup_StatusFunctions();
126 virtual void InitData();
127 virtual void TransferData();
128 void Hdl_SyntaxError( const char *);
129 void Init_CurObject();
131 void SpReturn_Base();
133 void On_start_class( const char * );
134 void On_start_struct( const char * );
135 void On_start_union( const char * );
137 void On_expectName_Identifier( const char * );
138 void On_expectName_SwBracket_Left( const char * );
139 void On_expectName_Colon( const char * );
141 void On_gotName_SwBracket_Left( const char * );
142 void On_gotName_Semicolon( const char * );
143 void On_gotName_Colon( const char * );
144 void On_gotName_Return2Type( const char * );
146 void On_bodyStd_VarFunc( const char * );
147 void On_bodyStd_ClassKey( const char * );
148 void On_bodyStd_enum( const char * );
149 void On_bodyStd_typedef( const char * );
150 void On_bodyStd_public( const char * );
151 void On_bodyStd_protected( const char * );
152 void On_bodyStd_private( const char * );
153 void On_bodyStd_template( const char * );
154 void On_bodyStd_friend( const char * );
155 void On_bodyStd_using( const char * );
156 void On_bodyStd_SwBracket_Right( const char * );
157 void On_bodyStd_DefineName(const char * );
158 void On_bodyStd_MacroName(const char * );
160 void On_inProtection_Colon( const char * );
162 void On_afterDecl_Semicolon( const char * );
163 void On_afterDecl_Return2Type( const char * );
165 // DATA
166 Dyn< PeStatusArray<PE_Class> >
167 pStati;
169 Dyn<SP_Base> pSpBase;
170 // Dyn<SP_Enum> pSpEnum;
171 Dyn<SP_Typedef> pSpTypedef;
172 Dyn<SP_VarFunc> pSpVarFunc;
173 Dyn<SP_Ignore> pSpIgnore;
174 Dyn<SP_Defines> pSpDefs;
176 Dyn<SPU_Base> pSpuBase;
177 // Dyn<SPU_Enum> pSpuEnum;
178 Dyn<SPU_Typedef> pSpuTypedef;
179 Dyn<SPU_VarFunc> pSpuVarFunc;
181 Dyn<SPU_Ignore> pSpuTemplate;
182 Dyn<SPU_Ignore> pSpuUsing;
183 Dyn<SPU_Ignore> pSpuIgnoreFailure;
184 Dyn<SPU_Defines> pSpuDefs;
188 String sLocalName;
189 ary::cpp::E_ClassKey
190 eClassKey;
191 ary::cpp::Class * pCurObject;
192 BaseList aBases;
194 E_KindOfResult eResult_KindOf;
199 // IMPLEMENTATION
201 inline PE_Class::E_KindOfResult
202 PE_Class::Result_KindOf() const
204 return eResult_KindOf;
207 inline const String &
208 PE_Class::Result_LocalName() const
210 return sLocalName;
213 inline const String &
214 PE_Class::Result_FirstNameSegment() const
216 return sLocalName;
222 } // namespace cpp
225 #if 0 // Branches
227 class struct union
228 -> Class
229 -> Predeclaration
231 typedef
232 -> Typedef
234 enum
235 -> Enum
237 TypeDeclaration
238 -> Function In Class
239 -> Variable
241 public, protected, private
242 -> Protection declaration
244 friend
245 -> Friend Class
246 -> Friend Function
248 virtual
249 -> Function In Class
251 using
252 -> Using Declaration
255 #endif // 0
258 #endif