Update ooo320-m1
[ooovba.git] / autodoc / source / parser_i / idl / pe_tydf2.cxx
blob665ee4a9f018edeb87bbc86325f693c30ebb30ee
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_tydf2.cxx,v $
10 * $Revision: 1.10 $
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 <s2_luidl/pe_tydf2.hxx>
34 // NOT FULLY DECLARED SERVICES
35 #include <ary/idl/i_gate.hxx>
36 #include <ary/idl/i_typedef.hxx>
37 #include <ary/idl/ip_ce.hxx>
38 #include <ary/doc/d_oldidldocu.hxx>
39 #include <s2_luidl/pe_type2.hxx>
40 #include <s2_luidl/tk_ident.hxx>
41 #include <s2_luidl/tk_punct.hxx>
42 #include <s2_luidl/tk_const.hxx>
45 namespace csi
47 namespace uidl
51 #ifdef DF
52 #undef DF
53 #endif
54 #define DF &PE_Typedef::On_Default
56 PE_Typedef::F_TOK
57 PE_Typedef::aDispatcher[PE_Typedef::e_STATES_MAX][PE_Typedef::tt_MAX] =
58 { { DF, DF, DF }, // e_none
59 { &PE_Typedef::On_expect_description_Any,
60 &PE_Typedef::On_expect_description_Any,
61 DF }, // expect_description
62 { DF, &PE_Typedef::On_expect_name_Identifier,
63 DF }, // expect_name
64 { DF, DF, &PE_Typedef::On_got_name_Punctuation } // got_name
69 inline void
70 PE_Typedef::CallHandler( const char * i_sTokenText,
71 E_TokenType i_eTokenType )
72 { (this->*aDispatcher[eState][i_eTokenType])(i_sTokenText); }
78 PE_Typedef::PE_Typedef()
79 : eState(e_none),
80 pPE_Type(0),
81 nType(0),
82 sName()
84 pPE_Type = new PE_Type(nType);
87 void
88 PE_Typedef::EstablishContacts( UnoIDL_PE * io_pParentPE,
89 ary::Repository & io_rRepository,
90 TokenProcessing_Result & o_rResult )
92 UnoIDL_PE::EstablishContacts(io_pParentPE,io_rRepository,o_rResult);
93 pPE_Type->EstablishContacts(this,io_rRepository,o_rResult);
96 PE_Typedef::~PE_Typedef()
100 void
101 PE_Typedef::ProcessToken( const Token & i_rToken )
103 i_rToken.Trigger(*this);
106 void
107 PE_Typedef::Process_Identifier( const TokIdentifier & i_rToken )
109 CallHandler(i_rToken.Text(), tt_identifier);
112 void
113 PE_Typedef::Process_Punctuation( const TokPunctuation & i_rToken )
115 CallHandler(i_rToken.Text(), tt_punctuation);
118 void
119 PE_Typedef::Process_Default()
121 CallHandler("", tt_any);
124 void
125 PE_Typedef::On_expect_description_Any(const char *)
127 SetResult(not_done,push_sure, pPE_Type.Ptr());
130 void
131 PE_Typedef::On_expect_name_Identifier(const char * i_sText)
133 sName = i_sText;
134 SetResult(done,stay);
135 eState = got_name;
138 void
139 PE_Typedef::On_got_name_Punctuation(const char * i_sText)
141 if ( i_sText[0] == ';' )
143 SetResult(done,pop_success);
144 eState = e_none;
146 else
147 On_Default(i_sText);
150 void
151 PE_Typedef::On_Default(const char * )
153 SetResult(not_done,pop_failure);
156 void
157 PE_Typedef::InitData()
159 eState = expect_description;
160 nType = 0;
161 sName = "";
164 void
165 PE_Typedef::ReceiveData()
167 eState = expect_name;
170 void
171 PE_Typedef::TransferData()
173 ary::idl::Typedef &
174 rCe = Gate().Ces().Store_Typedef(CurNamespace().CeId(), sName, nType);
175 PassDocuAt(rCe);
176 eState = e_none;
179 UnoIDL_PE &
180 PE_Typedef::MyPE()
182 return *this;
185 } // namespace uidl
186 } // namespace csi