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"
34 #include <s2_luidl/pe_enum2.hxx>
37 // NOT FULLY DECLARED SERVICES
38 #include <ary/idl/i_enum.hxx>
39 #include <ary/idl/i_enumvalue.hxx>
40 #include <ary/idl/i_gate.hxx>
41 #include <ary/idl/ip_ce.hxx>
42 #include <ary/doc/d_oldidldocu.hxx>
43 #include <s2_luidl/pe_evalu.hxx>
44 #include <s2_luidl/tk_punct.hxx>
45 #include <s2_luidl/tk_ident.hxx>
46 #include <s2_luidl/tk_keyw.hxx>
58 #define DF &PE_Enum::On_Default
61 PE_Enum::aDispatcher
[PE_Enum::e_STATES_MAX
][PE_Enum::tt_MAX
] =
62 { { DF
, DF
}, // e_none
63 { &PE_Enum::On_expect_name_Identifier
,
65 { DF
, &PE_Enum::On_expect_curl_bracket_open_Punctuation
}, // expect_curl_bracket_open
66 { &PE_Enum::On_expect_value_Identifier
,
67 &PE_Enum::On_expect_value_Punctuation
}, // expect_value
68 { DF
, &PE_Enum::On_expect_finish_Punctuation
} // expect_finish
74 PE_Enum::CallHandler( const char * i_sTokenText
,
75 E_TokenType i_eTokenType
)
76 { (this->*aDispatcher
[eState
][i_eTokenType
])(i_sTokenText
); }
89 pPE_Value
= new PE_Value(sName
, sAssignment
, false);
93 PE_Enum::EstablishContacts( UnoIDL_PE
* io_pParentPE
,
94 ary::Repository
& io_rRepository
,
95 TokenProcessing_Result
& o_rResult
)
97 UnoIDL_PE::EstablishContacts(io_pParentPE
,io_rRepository
,o_rResult
);
98 pPE_Value
->EstablishContacts(this,io_rRepository
,o_rResult
);
106 PE_Enum::ProcessToken( const Token
& i_rToken
)
108 i_rToken
.Trigger(*this);
112 PE_Enum::Process_Identifier( const TokIdentifier
& i_rToken
)
114 CallHandler(i_rToken
.Text(), tt_identifier
);
118 PE_Enum::Process_Punctuation( const TokPunctuation
& i_rToken
)
120 CallHandler(i_rToken
.Text(), tt_punctuation
);
124 PE_Enum::On_expect_name_Identifier(const char * i_sText
)
128 SetResult(done
,stay
);
129 eState
= expect_curl_bracket_open
;
133 PE_Enum::On_expect_curl_bracket_open_Punctuation(const char * i_sText
)
135 if ( i_sText
[0] == '{')
139 rCe
= Gate().Ces().Store_Enum(CurNamespace().CeId(), sData_Name
);
141 nDataId
= rCe
.CeId();
143 SetResult(done
,stay
);
144 eState
= expect_value
;
153 PE_Enum::On_expect_value_Punctuation(const char * i_sText
)
155 if ( i_sText
[0] == '}' )
157 SetResult(done
,stay
);
158 eState
= expect_finish
;
167 PE_Enum::On_expect_value_Identifier(SAL_UNUSED_PARAMETER
const char *)
169 SetResult( not_done
, push_sure
, pPE_Value
.Ptr() );
173 PE_Enum::On_expect_finish_Punctuation(const char * i_sText
)
175 if ( i_sText
[0] == ';')
177 SetResult(done
,pop_success
);
187 PE_Enum::On_Default(SAL_UNUSED_PARAMETER
const char * )
189 SetResult(not_done
,pop_failure
);
194 PE_Enum::EmptySingleValueData()
201 PE_Enum::CreateSingleValue()
203 ary::idl::EnumValue
&
204 rCe
= Gate().Ces().Store_EnumValue( nDataId
, sName
, sAssignment
);
205 pPE_Value
->PassDocuAt(rCe
);
211 eState
= expect_name
;
216 EmptySingleValueData();
220 PE_Enum::ReceiveData()
226 if (sName
.length() == 0)
233 EmptySingleValueData();
236 SetResult(not_done
, pop_failure
);
242 PE_Enum::TransferData()
244 csv_assert(sData_Name
.length() > 0);
257 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */