Update ooo320-m1
[ooovba.git] / autodoc / source / parser / cpp / pe_tydef.cxx
blob9ad846e735a66674ba07decb7352263d91bdb1d6
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_tydef.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_tydef.hxx"
35 // NOT FULLY DECLARED SERVICES
36 #include <ary/cpp/c_gate.hxx>
37 #include <ary/cpp/c_type.hxx>
38 #include <ary/cpp/cp_ce.hxx>
39 #include <all_toks.hxx>
40 #include "pe_type.hxx"
43 namespace cpp {
46 PE_Typedef::PE_Typedef(Cpp_PE * i_pParent )
47 : Cpp_PE(i_pParent),
48 pStati( new PeStatusArray<PE_Typedef> ),
49 // pSpType,
50 // pSpuType,
51 // sName
52 nType(0)
54 Setup_StatusFunctions();
56 pSpType = new SP_Type(*this);
57 pSpuType = new SPU_Type(*pSpType, 0, &PE_Typedef::SpReturn_Type);
60 PE_Typedef::~PE_Typedef()
64 void
65 PE_Typedef::Call_Handler( const cpp::Token & i_rTok )
67 pStati->Cur().Call_Handler(i_rTok.TypeId(), i_rTok.Text());
70 void
71 PE_Typedef::Setup_StatusFunctions()
73 typedef CallFunction<PE_Typedef>::F_Tok F_Tok;
74 static F_Tok stateF_start[] = { &PE_Typedef::On_start_typedef };
75 static INT16 stateT_start[] = { Tid_typedef };
77 static F_Tok stateF_expectName[] = { &PE_Typedef::On_expectName_Identifier };
78 static INT16 stateT_expectName[] = { Tid_Identifier };
80 static F_Tok stateF_afterName[] = { &PE_Typedef::On_afterName_Semicolon };
81 static INT16 stateT_afterName[] = { Tid_Semicolon };
83 SEMPARSE_CREATE_STATUS(PE_Typedef, start, Hdl_SyntaxError);
84 SEMPARSE_CREATE_STATUS(PE_Typedef, expectName, Hdl_SyntaxError);
85 SEMPARSE_CREATE_STATUS(PE_Typedef, afterName, Hdl_SyntaxError);
88 void
89 PE_Typedef::InitData()
91 pStati->SetCur(start);
93 sName.clear();
94 nType = 0;
97 void
98 PE_Typedef::TransferData()
100 pStati->SetCur(size_of_states);
102 ary::cpp::Typedef &
103 rTypedef = Env().AryGate().Ces().Store_Typedef(
104 Env().Context(), sName, nType );
105 Env().Event_Store_Typedef(rTypedef);
108 void
109 PE_Typedef::Hdl_SyntaxError( const char * i_sText)
111 StdHandlingOfSyntaxError(i_sText);
114 void
115 PE_Typedef::SpReturn_Type()
117 pStati->SetCur(expectName);
119 nType = pSpuType->Child().Result_Type().Id();
122 void
123 PE_Typedef::On_start_typedef( const char * )
125 pSpuType->Push(done);
128 void
129 PE_Typedef::On_expectName_Identifier( const char * i_sText )
131 SetTokenResult(done, stay);
132 pStati->SetCur(afterName);
134 sName = i_sText;
137 void
138 PE_Typedef::On_afterName_Semicolon( const char * )
140 SetTokenResult(done, pop_success);
143 } // namespace cpp