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