Bump for 3.6-28
[LibreOffice.git] / autodoc / source / parser_i / idl / pe_evalu.cxx
blob6ce7c91a1b8959d25e4f85f184ff490cdbebc3ff
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*************************************************************************
4 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
6 * Copyright 2000, 2010 Oracle and/or its affiliates.
8 * OpenOffice.org - a multi-platform office productivity suite
10 * This file is part of OpenOffice.org.
12 * OpenOffice.org is free software: you can redistribute it and/or modify
13 * it under the terms of the GNU Lesser General Public License version 3
14 * only, as published by the Free Software Foundation.
16 * OpenOffice.org is distributed in the hope that it will be useful,
17 * but WITHOUT ANY WARRANTY; without even the implied warranty of
18 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 * GNU Lesser General Public License version 3 for more details
20 * (a copy is included in the LICENSE file that accompanied this code).
22 * You should have received a copy of the GNU Lesser General Public License
23 * version 3 along with OpenOffice.org. If not, see
24 * <http://www.openoffice.org/license.html>
25 * for a copy of the LGPLv3 License.
27 ************************************************************************/
29 #include "sal/config.h"
31 #include "sal/types.h"
33 #include <precomp.h>
34 #include <s2_luidl/pe_evalu.hxx>
36 // NOT FULLY DECLARED SERVICES
37 #include <ary/idl/i_enumvalue.hxx>
38 #include <ary/idl/i_gate.hxx>
39 #include <ary/idl/ip_ce.hxx>
40 #include <ary/doc/d_oldidldocu.hxx>
41 #include <s2_luidl/tk_ident.hxx>
42 #include <s2_luidl/tk_punct.hxx>
43 #include <s2_luidl/tk_const.hxx>
46 namespace csi
48 namespace uidl
52 #ifdef DF
53 #undef DF
54 #endif
55 #define DF &PE_Value::On_Default
57 PE_Value::F_TOK
58 PE_Value::aDispatcher[PE_Value::e_STATES_MAX][PE_Value::tt_MAX] =
59 { { DF, DF, DF }, // e_none
60 { &PE_Value::On_expect_name_Identifier,
61 DF, DF }, // expect_name
62 { DF, &PE_Value::On_got_name_Punctuation,
63 &PE_Value::On_got_name_Assignment } // got_name
68 inline void
69 PE_Value::CallHandler( const char * i_sTokenText,
70 E_TokenType i_eTokenType )
71 { (this->*aDispatcher[eState][i_eTokenType])(i_sTokenText); }
77 PE_Value::PE_Value( String & o_rName,
78 String & o_rAssignment,
79 bool i_bIsConst )
80 : eState(e_none),
81 pName(&o_rName),
82 pAssignment(&o_rAssignment),
83 bIsConst(i_bIsConst)
87 void
88 PE_Value::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);
95 PE_Value::~PE_Value()
99 void
100 PE_Value::ProcessToken( const Token & i_rToken )
102 i_rToken.Trigger(*this);
105 void
106 PE_Value::Process_Identifier( const TokIdentifier & i_rToken )
108 CallHandler(i_rToken.Text(), tt_identifier);
111 void
112 PE_Value::Process_Punctuation( const TokPunctuation & i_rToken )
114 CallHandler(i_rToken.Text(), tt_punctuation);
117 void
118 PE_Value::Process_Assignment( const TokAssignment & i_rToken )
120 CallHandler(i_rToken.Text(), tt_assignment);
123 void
124 PE_Value::On_expect_name_Identifier(const char * i_sText)
126 *pName = i_sText;
127 SetResult(done,stay);
128 eState = got_name;
131 void
132 PE_Value::On_got_name_Punctuation(const char * i_sText)
134 if ( (i_sText[0] == ',' AND NOT IsConst())
135 OR (i_sText[0] == ';' AND IsConst()) )
137 SetResult(done,pop_success);
138 eState = e_none;
140 else if (i_sText[0] == '}' AND NOT IsConst())
142 SetResult(not_done,pop_success);
143 eState = e_none;
145 else
146 On_Default(i_sText);
149 void
150 PE_Value::On_got_name_Assignment(const char * i_sText)
152 *pAssignment = i_sText;
153 SetResult(done,pop_success);
154 eState = e_none;
157 void
158 PE_Value::On_Default(SAL_UNUSED_PARAMETER const char * )
160 SetResult(not_done,pop_failure);
163 void
164 PE_Value::InitData()
166 eState = expect_name;
168 *pName = "";
169 *pAssignment = "";
172 void
173 PE_Value::TransferData()
175 csv_assert(pName->length() > 0);
176 eState = e_none;
179 UnoIDL_PE &
180 PE_Value::MyPE()
182 return *this;
185 } // namespace uidl
186 } // namespace csi
188 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */