Line data Source code
1 : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 : /*
3 : * This file is part of the LibreOffice project.
4 : *
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/.
8 : *
9 : * This file incorporates work covered by the following license notice:
10 : *
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 .
18 : */
19 :
20 : #include "sal/config.h"
21 :
22 : #include "sal/types.h"
23 :
24 : #include <precomp.h>
25 : #include <s2_luidl/pe_tydf2.hxx>
26 :
27 : // NOT FULLY DECLARED SERVICES
28 : #include <ary/idl/i_gate.hxx>
29 : #include <ary/idl/i_typedef.hxx>
30 : #include <ary/idl/ip_ce.hxx>
31 : #include <ary/doc/d_oldidldocu.hxx>
32 : #include <s2_luidl/pe_type2.hxx>
33 : #include <s2_luidl/tk_ident.hxx>
34 : #include <s2_luidl/tk_punct.hxx>
35 : #include <s2_luidl/tk_const.hxx>
36 :
37 :
38 : namespace csi
39 : {
40 : namespace uidl
41 : {
42 :
43 :
44 : #ifdef DF
45 : #undef DF
46 : #endif
47 : #define DF &PE_Typedef::On_Default
48 :
49 : PE_Typedef::F_TOK
50 : PE_Typedef::aDispatcher[PE_Typedef::e_STATES_MAX][PE_Typedef::tt_MAX] =
51 : { { DF, DF, DF }, // e_none
52 : { &PE_Typedef::On_expect_description_Any,
53 : &PE_Typedef::On_expect_description_Any,
54 : DF }, // expect_description
55 : { DF, &PE_Typedef::On_expect_name_Identifier,
56 : DF }, // expect_name
57 : { DF, DF, &PE_Typedef::On_got_name_Punctuation } // got_name
58 : };
59 :
60 :
61 :
62 : inline void
63 54 : PE_Typedef::CallHandler( const char * i_sTokenText,
64 : E_TokenType i_eTokenType )
65 54 : { (this->*aDispatcher[eState][i_eTokenType])(i_sTokenText); }
66 :
67 :
68 :
69 :
70 :
71 3 : PE_Typedef::PE_Typedef()
72 : : eState(e_none),
73 : pPE_Type(0),
74 : nType(0),
75 3 : sName()
76 : {
77 3 : pPE_Type = new PE_Type(nType);
78 3 : }
79 :
80 : void
81 3 : PE_Typedef::EstablishContacts( UnoIDL_PE * io_pParentPE,
82 : ary::Repository & io_rRepository,
83 : TokenProcessing_Result & o_rResult )
84 : {
85 3 : UnoIDL_PE::EstablishContacts(io_pParentPE,io_rRepository,o_rResult);
86 3 : pPE_Type->EstablishContacts(this,io_rRepository,o_rResult);
87 3 : }
88 :
89 6 : PE_Typedef::~PE_Typedef()
90 : {
91 6 : }
92 :
93 : void
94 54 : PE_Typedef::ProcessToken( const Token & i_rToken )
95 : {
96 54 : i_rToken.Trigger(*this);
97 54 : }
98 :
99 : void
100 18 : PE_Typedef::Process_Identifier( const TokIdentifier & i_rToken )
101 : {
102 18 : CallHandler(i_rToken.Text(), tt_identifier);
103 18 : }
104 :
105 : void
106 18 : PE_Typedef::Process_Punctuation( const TokPunctuation & i_rToken )
107 : {
108 18 : CallHandler(i_rToken.Text(), tt_punctuation);
109 18 : }
110 :
111 : void
112 18 : PE_Typedef::Process_Default()
113 : {
114 18 : CallHandler("", tt_any);
115 18 : }
116 :
117 : void
118 18 : PE_Typedef::On_expect_description_Any(SAL_UNUSED_PARAMETER const char *)
119 : {
120 18 : SetResult(not_done,push_sure, pPE_Type.Ptr());
121 18 : }
122 :
123 : void
124 18 : PE_Typedef::On_expect_name_Identifier(const char * i_sText)
125 : {
126 18 : sName = i_sText;
127 18 : SetResult(done,stay);
128 18 : eState = got_name;
129 18 : }
130 :
131 : void
132 18 : PE_Typedef::On_got_name_Punctuation(const char * i_sText)
133 : {
134 18 : if ( i_sText[0] == ';' )
135 : {
136 18 : SetResult(done,pop_success);
137 18 : eState = e_none;
138 : }
139 : else
140 0 : On_Default(i_sText);
141 18 : }
142 :
143 : void
144 0 : PE_Typedef::On_Default(SAL_UNUSED_PARAMETER const char * )
145 : {
146 0 : SetResult(not_done,pop_failure);
147 0 : }
148 :
149 : void
150 18 : PE_Typedef::InitData()
151 : {
152 18 : eState = expect_description;
153 18 : nType = 0;
154 18 : sName = "";
155 18 : }
156 :
157 : void
158 18 : PE_Typedef::ReceiveData()
159 : {
160 18 : eState = expect_name;
161 18 : }
162 :
163 : void
164 18 : PE_Typedef::TransferData()
165 : {
166 : ary::idl::Typedef &
167 18 : rCe = Gate().Ces().Store_Typedef(CurNamespace().CeId(), sName, nType);
168 18 : PassDocuAt(rCe);
169 18 : eState = e_none;
170 18 : }
171 :
172 : UnoIDL_PE &
173 0 : PE_Typedef::MyPE()
174 : {
175 0 : return *this;
176 : }
177 :
178 : } // namespace uidl
179 3 : } // namespace csi
180 :
181 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|