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_FUNC2_HXX
25 #define ADC_UIDL_PE_FUNC2_HXX
26 
27 
28 
29 // USED SERVICES
30 	// BASE CLASSES
31 // #include <ary/idl/i_gate.hxx>
32 // #include <ary/idl/ip_ce.hxx>
33 #include <s2_luidl/parsenv2.hxx>
34 #include <s2_luidl/pestate.hxx>
35 	// COMPONENTS
36 #include <ary/idl/i_param.hxx>
37 	// PARAMETERS
38 
39 namespace ary
40 {
41  	namespace idl
42     {
43      	class Function;
44     }
45 }
46 
47 
48 namespace csi
49 {
50 namespace uidl
51 {
52 
53 class PE_Type;
54 class PE_Variable;
55 
56 class PE_Function : public UnoIDL_PE,
57 					public ParseEnvState
58 {
59   public:
60 	typedef ary::idl::Ce_id		RParent;
61 	typedef ary::idl::Ce_id		RFunction;
62 
63     enum E_Constructor { constructor };
64 
65     /// Constructor for interfaces.
66 						PE_Function(
67 							const RParent &	    i_rCurInterface );
68 
69     /// Constructor for single interface based services.
70 						PE_Function(
71 							const RParent &	    i_rCurService,
72 							E_Constructor       i_eCtorMarker );
73 
74 	virtual void	 	EstablishContacts(
75 							UnoIDL_PE *			io_pParentPE,
76 							ary::Repository &	io_rRepository,
77 							TokenProcessing_Result &
78 												o_rResult );
79 	virtual				~PE_Function();
80 
81 	virtual void	  	ProcessToken(
82 							const Token &		i_rToken );
83 
84 	virtual void		Process_Stereotype(
85 							const TokStereotype &
86 												i_rToken );
87 	virtual void		Process_Identifier(
88 							const TokIdentifier &
89 												i_rToken );
90 	virtual void		Process_Punctuation(
91 							const TokPunctuation &
92 												i_rToken );
93 	virtual void		Process_BuiltInType(
94 							const TokBuiltInType &
95 												i_rToken );
96 	virtual void		Process_ParameterHandling(
97 							const TokParameterHandling &
98 												i_rToken );
99 	virtual void		Process_Raises();
100 	virtual void		Process_Default();
101 
102   private:
103 	enum E_State
104 	{
105 		e_none,
106 		e_start,
107 		in_return_type,
108 		expect_name,
109 		expect_params_list,
110 		expect_parameter,
111 		expect_parameter_variable,
112 		in_parameter_variable,
113         expect_parameter_separator,
114 		params_finished,
115 		expect_exceptions_list,
116 		expect_exception,
117 		in_exception,
118 		expect_exception_separator,
119 		exceptions_finished
120 	};
121 
122 	void				GoIntoReturnType();
123 	void				GoIntoParameterVariable();
124 	void				GoIntoException();
125 	void				OnDefault();
126 
127 	virtual void		InitData();
128 	virtual void		ReceiveData();
129 	virtual void		TransferData();
130 	virtual UnoIDL_PE &	MyPE();
131 
132     // DATA
133 	E_State             eState;
134 
135 	String              sData_Name;
136     ary::idl::Type_id   nData_ReturnType;
137     bool                bData_Oneway;
138     ary::idl::Function *
139                         pCurFunction;
140 
141 	const RParent *	    pCurParent;
142 
143 	Dyn<PE_Type>		pPE_Type;
144 	ary::idl::Type_id   nCurParsedType;		// ReturnType or Exception
145 
146 	String 			    sName;
147 
148 	Dyn<PE_Variable>	pPE_Variable;
149 	ary::idl::E_ParameterDirection
150 						eCurParsedParam_Direction;
151 	ary::idl::Type_id   nCurParsedParam_Type;
152 	String 			    sCurParsedParam_Name;
153 	bool                bIsForConstructors;
154 };
155 
156 
157 
158 }   // namespace uidl
159 }   // namespace csi
160 
161 
162 #endif
163 
164