1 /**************************************************************
2  *
3  * Licensed to the Apache Software Foundation (ASF) under one
4  * or more contributor license agreements.  See the NOTICE file
5  * distributed with this work for additional information
6  * regarding copyright ownership.  The ASF licenses this file
7  * to you under the Apache License, Version 2.0 (the
8  * "License"); you may not use this file except in compliance
9  * with the License.  You may obtain a copy of the License at
10  *
11  *   http://www.apache.org/licenses/LICENSE-2.0
12  *
13  * Unless required by applicable law or agreed to in writing,
14  * software distributed under the License is distributed on an
15  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16  * KIND, either express or implied.  See the License for the
17  * specific language governing permissions and limitations
18  * under the License.
19  *
20  *************************************************************/
21 
22 
23 
24 #ifndef ADC_UIDL_PE_IFACE_HXX
25 #define ADC_UIDL_PE_IFACE_HXX
26 
27 
28 
29 // USED SERVICES
30 	// BASE CLASSES
31 #include <s2_luidl/parsenv2.hxx>
32 #include <s2_luidl/pestate.hxx>
33 	// COMPONENTS
34 	// PARAMETERS
35 
36 namespace ary
37 {
38 namespace idl
39 {
40     class Interface;
41 }
42 }
43 
44 namespace csi
45 {
46 namespace uidl
47 {
48 
49 
50 
51 class PE_Function;
52 class PE_Attribute;
53 class PE_Type;
54 
55 class PE_Interface : public UnoIDL_PE,
56 					 public ParseEnvState
57 {
58   public:
59 						PE_Interface();
60 	virtual				~PE_Interface();
61 
62 	virtual void	 	EstablishContacts(
63 							UnoIDL_PE *			io_pParentPE,
64 							ary::Repository &	io_rRepository,
65 							TokenProcessing_Result &
66 												o_rResult );
67 	virtual void	  	ProcessToken(
68 							const Token &		i_rToken );
69 
70 	virtual void		Process_MetaType(
71 							const TokMetaType &	i_rToken );
72 	virtual void		Process_Identifier(
73 							const TokIdentifier &
74 												i_rToken );
75 	virtual void		Process_Punctuation(
76 							const TokPunctuation &
77 												i_rToken );
78 	virtual void		Process_NameSeparator();
79 	virtual void		Process_BuiltInType(
80 							const TokBuiltInType &
81 												i_rToken );
82 	virtual void		Process_TypeModifier(
83 							const TokTypeModifier &
84 												i_rToken );
85 	virtual void		Process_Stereotype(
86 							const TokStereotype &
87 												i_rToken );
88 	virtual void		Process_Default();
89 
90   private:
91 	enum E_State        /// @ATTENTION  Do not change existing values (except of e_STATES_MAX) !!! Else array-indices will break.
92 	{
93 		e_none = 0,
94 		need_uik,
95 		uik,
96 		need_ident,
97 		ident,
98 		need_interface,
99 		need_name,
100 		wait_for_base,
101 		in_base,            // in header, after ":"
102 		need_curlbr_open,
103 		e_std,
104 		in_function,
105 		in_attribute,
106 		need_finish,
107 		in_base_interface,  // in body, after "interface"
108 		e_STATES_MAX
109 	};
110 	enum E_TokenType	/// @ATTENTION  Do not change existing values (except of tt_MAX) !!! Else array-indices will break.
111 	{
112 		tt_metatype = 0,
113 		tt_identifier = 1,
114 		tt_punctuation = 2,
115 		tt_startoftype = 3,
116 		tt_stereotype = 4,
117 		tt_MAX
118 	};
119 	typedef void (PE_Interface::*F_TOK)(const char *);
120 
121 
122 	void				On_need_uik_MetaType(const char * i_sText);
123 	void				On_uik_Identifier(const char * i_sText);
124 	void				On_uik_Punctuation(const char * i_sText);
125 	void				On_need_ident_MetaType(const char * i_sText);
126 	void				On_ident_Identifier(const char * i_sText);
127 	void				On_ident_Punctuation(const char * i_sText);
128 	void				On_need_interface_MetaType(const char * i_sText);
129 	void				On_need_name_Identifer(const char * i_sText);
130 	void				On_wait_for_base_Punctuation(const char * i_sText);
131 	void				On_need_curlbr_open_Punctuation(const char * i_sText);
132 	void				On_std_Metatype(const char * i_sText);
133 	void				On_std_Punctuation(const char * i_sText);
134 	void				On_std_Stereotype(const char * i_sText);
135 	void				On_std_GotoFunction(const char * i_sText);
136 	void				On_std_GotoAttribute(const char * i_sText);
137 	void				On_std_GotoBaseInterface(const char * i_sText);
138 	void				On_need_finish_Punctuation(const char * i_sText);
139 	void				On_Default(const char * i_sText);
140 
141 	void				CallHandler(
142 							const char *		i_sTokenText,
143 							E_TokenType			i_eTokenType );
144 
145 	virtual void		InitData();
146 	virtual void		TransferData();
147 	virtual void		ReceiveData();
148 	virtual UnoIDL_PE &	MyPE();
149 
150     void                store_Interface();
151 
152 	// DATA
153 	static F_TOK		aDispatcher[e_STATES_MAX][tt_MAX];
154 
155 	E_State				eState;
156 	String              sData_Name;
157 	bool				bIsPreDeclaration;
158 	ary::idl::Interface *
159 	                    pCurInterface;
160 	ary::idl::Ce_id     nCurInterface;
161 
162 	Dyn<PE_Function>	pPE_Function;
163 	Dyn<PE_Attribute>	pPE_Attribute;
164 
165 	Dyn<PE_Type>		pPE_Type;
166 	ary::idl::Type_id	nCurParsed_Base;
167 	bool                bOptionalMember;
168 };
169 
170 
171 
172 // IMPLEMENTATION
173 
174 
175 }   // namespace uidl
176 }   // namespace csi
177 
178 
179 #endif
180 
181