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_UIDL_PE_IFACE_HXX
29 #define ADC_UIDL_PE_IFACE_HXX
30 
31 
32 
33 // USED SERVICES
34 	// BASE CLASSES
35 #include <s2_luidl/parsenv2.hxx>
36 #include <s2_luidl/pestate.hxx>
37 	// COMPONENTS
38 	// PARAMETERS
39 
40 namespace ary
41 {
42 namespace idl
43 {
44     class Interface;
45 }
46 }
47 
48 namespace csi
49 {
50 namespace uidl
51 {
52 
53 
54 
55 class PE_Function;
56 class PE_Attribute;
57 class PE_Type;
58 
59 class PE_Interface : public UnoIDL_PE,
60 					 public ParseEnvState
61 {
62   public:
63 						PE_Interface();
64 	virtual				~PE_Interface();
65 
66 	virtual void	 	EstablishContacts(
67 							UnoIDL_PE *			io_pParentPE,
68 							ary::Repository &	io_rRepository,
69 							TokenProcessing_Result &
70 												o_rResult );
71 	virtual void	  	ProcessToken(
72 							const Token &		i_rToken );
73 
74 	virtual void		Process_MetaType(
75 							const TokMetaType &	i_rToken );
76 	virtual void		Process_Identifier(
77 							const TokIdentifier &
78 												i_rToken );
79 	virtual void		Process_Punctuation(
80 							const TokPunctuation &
81 												i_rToken );
82 	virtual void		Process_NameSeparator();
83 	virtual void		Process_BuiltInType(
84 							const TokBuiltInType &
85 												i_rToken );
86 	virtual void		Process_TypeModifier(
87 							const TokTypeModifier &
88 												i_rToken );
89 	virtual void		Process_Stereotype(
90 							const TokStereotype &
91 												i_rToken );
92 	virtual void		Process_Default();
93 
94   private:
95 	enum E_State        /// @ATTENTION  Do not change existing values (except of e_STATES_MAX) !!! Else array-indices will break.
96 	{
97 		e_none = 0,
98 		need_uik,
99 		uik,
100 		need_ident,
101 		ident,
102 		need_interface,
103 		need_name,
104 		wait_for_base,
105 		in_base,            // in header, after ":"
106 		need_curlbr_open,
107 		e_std,
108 		in_function,
109 		in_attribute,
110 		need_finish,
111 		in_base_interface,  // in body, after "interface"
112 		e_STATES_MAX
113 	};
114 	enum E_TokenType	/// @ATTENTION  Do not change existing values (except of tt_MAX) !!! Else array-indices will break.
115 	{
116 		tt_metatype = 0,
117 		tt_identifier = 1,
118 		tt_punctuation = 2,
119 		tt_startoftype = 3,
120 		tt_stereotype = 4,
121 		tt_MAX
122 	};
123 	typedef void (PE_Interface::*F_TOK)(const char *);
124 
125 
126 	void				On_need_uik_MetaType(const char * i_sText);
127 	void				On_uik_Identifier(const char * i_sText);
128 	void				On_uik_Punctuation(const char * i_sText);
129 	void				On_need_ident_MetaType(const char * i_sText);
130 	void				On_ident_Identifier(const char * i_sText);
131 	void				On_ident_Punctuation(const char * i_sText);
132 	void				On_need_interface_MetaType(const char * i_sText);
133 	void				On_need_name_Identifer(const char * i_sText);
134 	void				On_wait_for_base_Punctuation(const char * i_sText);
135 	void				On_need_curlbr_open_Punctuation(const char * i_sText);
136 	void				On_std_Metatype(const char * i_sText);
137 	void				On_std_Punctuation(const char * i_sText);
138 	void				On_std_Stereotype(const char * i_sText);
139 	void				On_std_GotoFunction(const char * i_sText);
140 	void				On_std_GotoAttribute(const char * i_sText);
141 	void				On_std_GotoBaseInterface(const char * i_sText);
142 	void				On_need_finish_Punctuation(const char * i_sText);
143 	void				On_Default(const char * i_sText);
144 
145 	void				CallHandler(
146 							const char *		i_sTokenText,
147 							E_TokenType			i_eTokenType );
148 
149 	virtual void		InitData();
150 	virtual void		TransferData();
151 	virtual void		ReceiveData();
152 	virtual UnoIDL_PE &	MyPE();
153 
154     void                store_Interface();
155 
156 	// DATA
157 	static F_TOK		aDispatcher[e_STATES_MAX][tt_MAX];
158 
159 	E_State				eState;
160 	String              sData_Name;
161 	bool				bIsPreDeclaration;
162 	ary::idl::Interface *
163 	                    pCurInterface;
164 	ary::idl::Ce_id     nCurInterface;
165 
166 	Dyn<PE_Function>	pPE_Function;
167 	Dyn<PE_Attribute>	pPE_Attribute;
168 
169 	Dyn<PE_Type>		pPE_Type;
170 	ary::idl::Type_id	nCurParsed_Base;
171 	bool                bOptionalMember;
172 };
173 
174 
175 
176 // IMPLEMENTATION
177 
178 
179 }   // namespace uidl
180 }   // namespace csi
181 
182 
183 #endif
184 
185