1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5 * Copyright 2008 by Sun Microsystems, Inc.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * $RCSfile: pe_base.cxx,v $
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 ************************************************************************/
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"
48 static const PE_Base::Base aNullBase_
;
51 PE_Base::PE_Base( Cpp_PE
* i_pParent
)
53 pStati(new PeStatusArray
<PE_Base
>)
58 Setup_StatusFunctions();
61 pSpType
= new SP_Type(*this);
62 pSpuBaseName
= new SPU_BaseName(*pSpType
, 0, &PE_Base::SpReturn_BaseName
);
71 PE_Base::Call_Handler( const cpp::Token
& i_rTok
)
73 pStati
->Cur().Call_Handler(i_rTok
.TypeId(), i_rTok
.Text());
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
,
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
,
103 SEMPARSE_CREATE_STATUS(PE_Base
, startOfNext
, Hdl_SyntaxError
);
104 SEMPARSE_CREATE_STATUS(PE_Base
, inName
, Hdl_SyntaxError
);
108 PE_Base::Hdl_SyntaxError( const char * i_sText
)
110 StdHandlingOfSyntaxError(i_sText
);
116 pStati
->SetCur(startOfNext
);
117 csv::erase_container(aBaseIds
);
118 aBaseIds
.push_back(aNullBase_
);
122 PE_Base::TransferData()
128 PE_Base::SpReturn_BaseName()
130 CurObject().nId
= pSpuBaseName
->Child().Result_Type().Id();
132 static StreamStr
aBaseName(100);
134 pSpuBaseName
->Child().Result_Type().Get_Text( aBaseName
, Env().AryGate() );
136 Env().Event_Class_FinishedBase(aBaseName
.c_str());
140 PE_Base::On_startOfNext_public(const char *)
142 SetTokenResult(done
, stay
);
143 pStati
->SetCur(inName
);
145 CurObject().eProtection
= ary::cpp::PROTECT_public
;
149 PE_Base::On_startOfNext_protected(const char *)
151 SetTokenResult(done
, stay
);
152 pStati
->SetCur(inName
);
154 CurObject().eProtection
= ary::cpp::PROTECT_protected
;
158 PE_Base::On_startOfNext_private(const char *)
160 SetTokenResult(done
, stay
);
161 pStati
->SetCur(inName
);
163 CurObject().eProtection
= ary::cpp::PROTECT_private
;
167 PE_Base::On_startOfNext_virtual(const char *)
169 SetTokenResult(done
, stay
);
171 CurObject().eVirtuality
= ary::cpp::VIRTUAL_virtual
;
175 PE_Base::On_startOfNext_Identifier(const char * )
177 pSpuBaseName
->Push(not_done
);
181 PE_Base::On_startOfNext_DoubleColon(const char *)
183 pSpuBaseName
->Push(not_done
);
187 PE_Base::On_inName_Identifier(const char * )
189 pSpuBaseName
->Push(not_done
);
193 PE_Base::On_inName_virtual(const char *)
195 SetTokenResult(done
, stay
);
197 CurObject().eVirtuality
= ary::cpp::VIRTUAL_virtual
;
201 PE_Base::On_inName_DoubleColon(const char *)
203 pSpuBaseName
->Push(not_done
);
207 PE_Base::On_inName_Comma(const char *)
209 SetTokenResult(done
, stay
);
210 pStati
->SetCur(startOfNext
);
212 aBaseIds
.push_back( aNullBase_
);
216 PE_Base::On_inName_SwBracket_Left(const char *)
218 SetTokenResult(not_done
, pop_success
);