merge the formfield patch from ooo-build
[ooovba.git] / autodoc / source / parser / cpp / pe_base.cxx
blob8be287005d56e574e96039dd5d865f090ef4cbf2
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_base.cxx,v $
10 * $Revision: 1.8 $
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 #include <precomp.h>
32 #include "pe_base.hxx"
35 // NOT FULLY DECLARED SERVICES
36 #include <cosv/tpl/tpltools.hxx>
37 #include <ary/cpp/c_gate.hxx>
38 #include <ary/cpp/c_type.hxx>
39 #include "pe_type.hxx"
44 namespace cpp
48 static const PE_Base::Base aNullBase_;
51 PE_Base::PE_Base( Cpp_PE * i_pParent )
52 : Cpp_PE(i_pParent),
53 pStati(new PeStatusArray<PE_Base>)
54 // aBaseIds,
55 // pSpType,
56 // pSpuBaseName
58 Setup_StatusFunctions();
59 aBaseIds.reserve(4);
61 pSpType = new SP_Type(*this);
62 pSpuBaseName = new SPU_BaseName(*pSpType, 0, &PE_Base::SpReturn_BaseName);
66 PE_Base::~PE_Base()
70 void
71 PE_Base::Call_Handler( const cpp::Token & i_rTok )
73 pStati->Cur().Call_Handler(i_rTok.TypeId(), i_rTok.Text());
76 void
77 PE_Base::Setup_StatusFunctions()
79 typedef CallFunction<PE_Base>::F_Tok F_Tok;
80 static F_Tok stateF_startOfNext[] = { &PE_Base::On_startOfNext_Identifier,
81 &PE_Base::On_startOfNext_public,
82 &PE_Base::On_startOfNext_protected,
83 &PE_Base::On_startOfNext_private,
84 &PE_Base::On_startOfNext_virtual,
85 &PE_Base::On_startOfNext_DoubleColon };
86 static INT16 stateT_startOfNext[] = { Tid_Identifier,
87 Tid_public,
88 Tid_protected,
89 Tid_private,
90 Tid_virtual,
91 Tid_DoubleColon };
92 static F_Tok stateF_inName[] = { &PE_Base::On_inName_Identifier,
93 &PE_Base::On_inName_virtual,
94 &PE_Base::On_inName_SwBracket_Left,
95 &PE_Base::On_inName_DoubleColon,
96 &PE_Base::On_inName_Comma };
97 static INT16 stateT_inName[] = { Tid_Identifier,
98 Tid_virtual,
99 Tid_SwBracket_Left,
100 Tid_DoubleColon,
101 Tid_Comma };
103 SEMPARSE_CREATE_STATUS(PE_Base, startOfNext, Hdl_SyntaxError);
104 SEMPARSE_CREATE_STATUS(PE_Base, inName, Hdl_SyntaxError);
107 void
108 PE_Base::Hdl_SyntaxError( const char * i_sText)
110 StdHandlingOfSyntaxError(i_sText);
113 void
114 PE_Base::InitData()
116 pStati->SetCur(startOfNext);
117 csv::erase_container(aBaseIds);
118 aBaseIds.push_back(aNullBase_);
121 void
122 PE_Base::TransferData()
124 // Does nothing.
127 void
128 PE_Base::SpReturn_BaseName()
130 CurObject().nId = pSpuBaseName->Child().Result_Type().Id();
132 static StreamStr aBaseName(100);
133 aBaseName.seekp(0);
134 pSpuBaseName->Child().Result_Type().Get_Text( aBaseName, Env().AryGate() );
136 Env().Event_Class_FinishedBase(aBaseName.c_str());
139 void
140 PE_Base::On_startOfNext_public(const char *)
142 SetTokenResult(done, stay);
143 pStati->SetCur(inName);
145 CurObject().eProtection = ary::cpp::PROTECT_public;
148 void
149 PE_Base::On_startOfNext_protected(const char *)
151 SetTokenResult(done, stay);
152 pStati->SetCur(inName);
154 CurObject().eProtection = ary::cpp::PROTECT_protected;
157 void
158 PE_Base::On_startOfNext_private(const char *)
160 SetTokenResult(done, stay);
161 pStati->SetCur(inName);
163 CurObject().eProtection = ary::cpp::PROTECT_private;
166 void
167 PE_Base::On_startOfNext_virtual(const char *)
169 SetTokenResult(done, stay);
171 CurObject().eVirtuality = ary::cpp::VIRTUAL_virtual;
174 void
175 PE_Base::On_startOfNext_Identifier(const char * )
177 pSpuBaseName->Push(not_done);
180 void
181 PE_Base::On_startOfNext_DoubleColon(const char *)
183 pSpuBaseName->Push(not_done);
186 void
187 PE_Base::On_inName_Identifier(const char * )
189 pSpuBaseName->Push(not_done);
192 void
193 PE_Base::On_inName_virtual(const char *)
195 SetTokenResult(done, stay);
197 CurObject().eVirtuality = ary::cpp::VIRTUAL_virtual;
200 void
201 PE_Base::On_inName_DoubleColon(const char *)
203 pSpuBaseName->Push(not_done);
206 void
207 PE_Base::On_inName_Comma(const char *)
209 SetTokenResult(done, stay);
210 pStati->SetCur(startOfNext);
212 aBaseIds.push_back( aNullBase_ );
215 void
216 PE_Base::On_inName_SwBracket_Left(const char *)
218 SetTokenResult(not_done, pop_success);
222 } // namespace cpp