1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
3 * This file is part of the LibreOffice project.
5 * This Source Code Form is subject to the terms of the Mozilla Public
6 * License, v. 2.0. If a copy of the MPL was not distributed with this
7 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
9 * This file incorporates work covered by the following license notice:
11 * Licensed to the Apache Software Foundation (ASF) under one or more
12 * contributor license agreements. See the NOTICE file distributed
13 * with this work for additional information regarding copyright
14 * ownership. The ASF licenses this file to you under the Apache
15 * License, Version 2.0 (the "License"); you may not use this file
16 * except in compliance with the License. You may obtain a copy of
17 * the License at http://www.apache.org/licenses/LICENSE-2.0 .
20 #include "sal/config.h"
22 #include "sal/types.h"
25 #include <s2_luidl/pe_enum2.hxx>
28 // NOT FULLY DECLARED SERVICES
29 #include <ary/idl/i_enum.hxx>
30 #include <ary/idl/i_enumvalue.hxx>
31 #include <ary/idl/i_gate.hxx>
32 #include <ary/idl/ip_ce.hxx>
33 #include <ary/doc/d_oldidldocu.hxx>
34 #include <s2_luidl/pe_evalu.hxx>
35 #include <s2_luidl/tk_punct.hxx>
36 #include <s2_luidl/tk_ident.hxx>
37 #include <s2_luidl/tk_keyw.hxx>
49 #define DF &PE_Enum::On_Default
52 PE_Enum::aDispatcher
[PE_Enum::e_STATES_MAX
][PE_Enum::tt_MAX
] =
53 { { DF
, DF
}, // e_none
54 { &PE_Enum::On_expect_name_Identifier
,
56 { DF
, &PE_Enum::On_expect_curl_bracket_open_Punctuation
}, // expect_curl_bracket_open
57 { &PE_Enum::On_expect_value_Identifier
,
58 &PE_Enum::On_expect_value_Punctuation
}, // expect_value
59 { DF
, &PE_Enum::On_expect_finish_Punctuation
} // expect_finish
65 PE_Enum::CallHandler( const char * i_sTokenText
,
66 E_TokenType i_eTokenType
)
67 { (this->*aDispatcher
[eState
][i_eTokenType
])(i_sTokenText
); }
80 pPE_Value
= new PE_Value(sName
, sAssignment
, false);
84 PE_Enum::EstablishContacts( UnoIDL_PE
* io_pParentPE
,
85 ary::Repository
& io_rRepository
,
86 TokenProcessing_Result
& o_rResult
)
88 UnoIDL_PE::EstablishContacts(io_pParentPE
,io_rRepository
,o_rResult
);
89 pPE_Value
->EstablishContacts(this,io_rRepository
,o_rResult
);
97 PE_Enum::ProcessToken( const Token
& i_rToken
)
99 i_rToken
.Trigger(*this);
103 PE_Enum::Process_Identifier( const TokIdentifier
& i_rToken
)
105 CallHandler(i_rToken
.Text(), tt_identifier
);
109 PE_Enum::Process_Punctuation( const TokPunctuation
& i_rToken
)
111 CallHandler(i_rToken
.Text(), tt_punctuation
);
115 PE_Enum::On_expect_name_Identifier(const char * i_sText
)
119 SetResult(done
,stay
);
120 eState
= expect_curl_bracket_open
;
124 PE_Enum::On_expect_curl_bracket_open_Punctuation(const char * i_sText
)
126 if ( i_sText
[0] == '{')
130 rCe
= Gate().Ces().Store_Enum(CurNamespace().CeId(), sData_Name
);
132 nDataId
= rCe
.CeId();
134 SetResult(done
,stay
);
135 eState
= expect_value
;
144 PE_Enum::On_expect_value_Punctuation(const char * i_sText
)
146 if ( i_sText
[0] == '}' )
148 SetResult(done
,stay
);
149 eState
= expect_finish
;
158 PE_Enum::On_expect_value_Identifier(SAL_UNUSED_PARAMETER
const char *)
160 SetResult( not_done
, push_sure
, pPE_Value
.Ptr() );
164 PE_Enum::On_expect_finish_Punctuation(const char * i_sText
)
166 if ( i_sText
[0] == ';')
168 SetResult(done
,pop_success
);
178 PE_Enum::On_Default(SAL_UNUSED_PARAMETER
const char * )
180 SetResult(not_done
,pop_failure
);
185 PE_Enum::EmptySingleValueData()
192 PE_Enum::CreateSingleValue()
194 ary::idl::EnumValue
&
195 rCe
= Gate().Ces().Store_EnumValue( nDataId
, sName
, sAssignment
);
196 pPE_Value
->PassDocuAt(rCe
);
202 eState
= expect_name
;
207 EmptySingleValueData();
211 PE_Enum::ReceiveData()
217 if (sName
.length() == 0)
224 EmptySingleValueData();
227 SetResult(not_done
, pop_failure
);
233 PE_Enum::TransferData()
235 csv_assert(sData_Name
.length() > 0);
248 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */