1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5 * Copyright 2008 by Sun Microsystems, Inc.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * $RCSfile: pe_class.hxx,v $
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
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"
59 using ary::cpp::E_Protection
;
60 using ary::cpp::E_Virtuality
;
71 class PE_Class
: public cpp::Cpp_PE
76 start
, /// before class, struct or union
77 expectName
, /// after class, struct or union
78 gotName
, /// after name, before : or {
80 inProtection
, /// after public, protected or private and before ":"
81 afterDecl
, /// after ending }
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();
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;
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 * );
166 Dyn
< PeStatusArray
<PE_Class
> >
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
;
191 ary::cpp::Class
* pCurObject
;
194 E_KindOfResult eResult_KindOf
;
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
213 inline const String
&
214 PE_Class::Result_FirstNameSegment() const
241 public, protected, private
242 -> Protection declaration