merge the formfield patch from ooo-build
[ooovba.git] / autodoc / source / parser_i / idl / pe_evalu.cxx
blob7f03cc5c98cf943944ba468ee8b9d9aac8cdd94e
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_evalu.cxx,v $
10 * $Revision: 1.9 $
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_evalu.hxx>
34 // NOT FULLY DECLARED SERVICES
35 #include <ary/idl/i_enumvalue.hxx>
36 #include <ary/idl/i_gate.hxx>
37 #include <ary/idl/ip_ce.hxx>
38 #include <ary/doc/d_oldidldocu.hxx>
39 #include <s2_luidl/tk_ident.hxx>
40 #include <s2_luidl/tk_punct.hxx>
41 #include <s2_luidl/tk_const.hxx>
44 namespace csi
46 namespace uidl
50 #ifdef DF
51 #undef DF
52 #endif
53 #define DF &PE_Value::On_Default
55 PE_Value::F_TOK
56 PE_Value::aDispatcher[PE_Value::e_STATES_MAX][PE_Value::tt_MAX] =
57 { { DF, DF, DF }, // e_none
58 { &PE_Value::On_expect_name_Identifier,
59 DF, DF }, // expect_name
60 { DF, &PE_Value::On_got_name_Punctuation,
61 &PE_Value::On_got_name_Assignment } // got_name
66 inline void
67 PE_Value::CallHandler( const char * i_sTokenText,
68 E_TokenType i_eTokenType )
69 { (this->*aDispatcher[eState][i_eTokenType])(i_sTokenText); }
75 PE_Value::PE_Value( String & o_rName,
76 String & o_rAssignment,
77 bool i_bIsConst )
78 : eState(e_none),
79 pName(&o_rName),
80 pAssignment(&o_rAssignment),
81 bIsConst(i_bIsConst)
85 void
86 PE_Value::EstablishContacts( UnoIDL_PE * io_pParentPE,
87 ary::Repository & io_rRepository,
88 TokenProcessing_Result & o_rResult )
90 UnoIDL_PE::EstablishContacts(io_pParentPE,io_rRepository,o_rResult);
93 PE_Value::~PE_Value()
97 void
98 PE_Value::ProcessToken( const Token & i_rToken )
100 i_rToken.Trigger(*this);
103 void
104 PE_Value::Process_Identifier( const TokIdentifier & i_rToken )
106 CallHandler(i_rToken.Text(), tt_identifier);
109 void
110 PE_Value::Process_Punctuation( const TokPunctuation & i_rToken )
112 CallHandler(i_rToken.Text(), tt_punctuation);
115 void
116 PE_Value::Process_Assignment( const TokAssignment & i_rToken )
118 CallHandler(i_rToken.Text(), tt_assignment);
121 void
122 PE_Value::On_expect_name_Identifier(const char * i_sText)
124 *pName = i_sText;
125 SetResult(done,stay);
126 eState = got_name;
129 void
130 PE_Value::On_got_name_Punctuation(const char * i_sText)
132 if ( (i_sText[0] == ',' AND NOT IsConst())
133 OR (i_sText[0] == ';' AND IsConst()) )
135 SetResult(done,pop_success);
136 eState = e_none;
138 else if (i_sText[0] == '}' AND NOT IsConst())
140 SetResult(not_done,pop_success);
141 eState = e_none;
143 else
144 On_Default(i_sText);
147 void
148 PE_Value::On_got_name_Assignment(const char * i_sText)
150 *pAssignment = i_sText;
151 SetResult(done,pop_success);
152 eState = e_none;
155 void
156 PE_Value::On_Default(const char * )
158 SetResult(not_done,pop_failure);
161 void
162 PE_Value::InitData()
164 eState = expect_name;
166 *pName = "";
167 *pAssignment = "";
170 void
171 PE_Value::TransferData()
173 csv_assert(pName->length() > 0);
174 eState = e_none;
177 UnoIDL_PE &
178 PE_Value::MyPE()
180 return *this;
183 } // namespace uidl
184 } // namespace csi