merge the formfield patch from ooo-build
[ooovba.git] / autodoc / source / parser / cpp / pe_vari.hxx
blob8db0661705390f3d44bbedba7f9d4bc68d9dc2a5
1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 *
5 * Copyright 2008 by Sun Microsystems, Inc.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * $RCSfile: pe_vari.hxx,v $
10 * $Revision: 1.4 $
12 * This file is part of OpenOffice.org.
14 * OpenOffice.org is free software: you can redistribute it and/or modify
15 * it under the terms of the GNU Lesser General Public License version 3
16 * only, as published by the Free Software Foundation.
18 * OpenOffice.org is distributed in the hope that it will be useful,
19 * but WITHOUT ANY WARRANTY; without even the implied warranty of
20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 * GNU Lesser General Public License version 3 for more details
22 * (a copy is included in the LICENSE file that accompanied this code).
24 * You should have received a copy of the GNU Lesser General Public License
25 * version 3 along with OpenOffice.org. If not, see
26 * <http://www.openoffice.org/license.html>
27 * for a copy of the LGPLv3 License.
29 ************************************************************************/
31 #ifndef ADC_CPP_PE_VARI_HXX
32 #define ADC_CPP_PE_VARI_HXX
36 // USED SERVICES
37 // BASE CLASSES
38 #include "cpp_pe.hxx"
39 // COMPONENTS
40 #include <semantic/callf.hxx>
41 #include <semantic/sub_peu.hxx>
42 #include <ary/cpp/c_types4cpp.hxx>
43 #include <ary/cpp/c_vfflag.hxx>
44 // PARAMETERS
47 namespace cpp {
49 class PE_Expression;
52 class PE_Variable : public Cpp_PE
54 public:
55 enum E_State
57 afterName, //
58 afterSize, // after ]
59 expectFinish, // after InitExpression
60 size_of_states
62 PE_Variable(
63 Cpp_PE * i_pParent );
64 ~PE_Variable();
66 /** @return
67 Bit 0x0001 != 0, if there is a size and
68 bit 0x0002 != 0, if there is an initialisation.
70 UINT16 Result_Pattern() const;
71 const String & Result_SizeExpression() const;
72 const String & Result_InitExpression() const;
74 virtual void Call_Handler(
75 const cpp::Token & i_rTok );
77 private:
78 typedef SubPe< PE_Variable, PE_Expression > SP_Expression;
79 typedef SubPeUse< PE_Variable, PE_Expression> SPU_Expression;
81 void Setup_StatusFunctions();
82 virtual void InitData();
83 virtual void TransferData();
84 void Hdl_SyntaxError(const char *);
86 void SpReturn_ArraySizeExpression();
87 void SpReturn_InitExpression();
89 void On_afterName_ArrayBracket_Left(const char * i_sText);
90 void On_afterName_Semicolon(const char * i_sText);
91 void On_afterName_Comma(const char * i_sText);
92 void On_afterName_Assign(const char * i_sText);
94 void On_afterSize_ArrayBracket_Right(const char * i_sText);
96 void On_expectFinish_Semicolon(const char * i_sText);
97 void On_expectFinish_Comma(const char * i_sText);
98 void On_expectFinish_Bracket_Right(const char * i_sText);
100 // DATA
101 Dyn< PeStatusArray<PE_Variable> >
102 pStati;
104 Dyn<SP_Expression> pSpExpression;
105 Dyn<SPU_Expression> pSpuArraySizeExpression;
106 Dyn<SPU_Expression> pSpuInitExpression;
108 String sResultSizeExpression;
109 String sResultInitExpression;
114 // IMPLEMENTATION
117 inline UINT16
118 PE_Variable::Result_Pattern() const
119 { return ( sResultSizeExpression.length() > 0 ? 1 : 0 )
120 + ( sResultInitExpression.length() > 0 ? 2 : 0 ); }
121 inline const String &
122 PE_Variable::Result_SizeExpression() const
123 { return sResultSizeExpression; }
124 inline const String &
125 PE_Variable::Result_InitExpression() const
126 { return sResultInitExpression; }
129 } // namespace cpp
132 #endif