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 
29 #ifndef ADC_CPP_PE_PARAM_HXX
30 #define ADC_CPP_PE_PARAM_HXX
31 
32 // BASE CLASSES
33 #include "cpp_pe.hxx"
34 // USED SERVICES
35 #include <semantic/callf.hxx>
36 #include <semantic/sub_peu.hxx>
37 #include <ary/cpp/c_vfflag.hxx>
38 
39 
40 
41 
42 namespace cpp
43 {
44     class PE_Type;
45     class PE_Variable;
46 
47 
48 
49 
50 class PE_Parameter : public Cpp_PE
51 {
52   public:
53 	enum E_State
54 	{
55 		start,
56 		expectName,
57 		afterName,
58         finished,
59 		size_of_states
60 	};
61     typedef ary::cpp::S_Parameter       S_ParamInfo;
62 
63 	explicit			PE_Parameter(
64 							Cpp_PE *			i_pParent );
65 						~PE_Parameter();
66 
67 	virtual void		Call_Handler(
68 							const cpp::Token &	i_rTok );
69 
70 	ary::cpp::Type_id   Result_FrontType() const;
71 	const S_ParamInfo & Result_ParamInfo() const;
72 
73   private:
74 	typedef SubPe< PE_Parameter, PE_Type >		    SP_Type;
75 	typedef SubPeUse< PE_Parameter, PE_Type >		SPU_Type;
76 	typedef SubPe< PE_Parameter, PE_Variable >	    SP_Variable;
77 	typedef SubPeUse< PE_Parameter, PE_Variable >	SPU_Variable;
78 
79 	void				Setup_StatusFunctions();
80 	virtual void		InitData();
81 	virtual void		TransferData();
82 	void  				Hdl_SyntaxError( const char *);
83 
84 	void				SpInit_Type();       // Type and Ignore.
85 	void				SpInit_Variable();
86 	void				SpReturn_Type();
87 	void				SpReturn_Variable();
88 
89 	void				On_start_Type(const char * i_sText);
90 	void				On_start_Bracket_Right(const char * i_sText);
91     void                On_start_Ellipse(const char * i_sText);
92 
93 	void				On_expectName_Identifier(const char * i_sText);
94 	void				On_expectName_ArrayBracket_Left(const char * i_sText);
95 	void				On_expectName_Bracket_Right(const char * i_sText);
96 	void				On_expectName_Comma(const char * i_sText);
97 
98 	void				On_afterName_ArrayBracket_Left(const char * i_sText);
99 	void				On_afterName_Bracket_Right(const char * i_sText);
100 	void				On_afterName_Comma(const char * i_sText);
101 	void				On_afterName_Assign(const char * i_sText);
102 
103 	void				On_finished_Bracket_Right(const char * i_sText);
104 	void				On_finished_Comma(const char * i_sText);
105 
106     // DATA
107 	Dyn< PeStatusArray<PE_Parameter> >
108 						pStati;
109 
110 	Dyn<SP_Type>	    pSpType;
111 	Dyn<SPU_Type>	 	pSpuType;
112 	Dyn<SP_Variable>	pSpVariable;
113 	Dyn<SPU_Variable>	pSpuVariable;
114 
115 	S_ParamInfo         aResultParamInfo;
116 };
117 
118 
119 
120 
121 // IMPLEMENTATION
122 inline ary::cpp::Type_id
123 PE_Parameter::Result_FrontType() const
124 {
125     return aResultParamInfo.nType;
126 }
127 
128 inline const PE_Parameter::S_ParamInfo &
129 PE_Parameter::Result_ParamInfo() const
130 {
131     return aResultParamInfo;
132 }
133 
134 
135 
136 
137 }   // namespace cpp
138 #endif
139