1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5 * Copyright 2008 by Sun Microsystems, Inc.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * $RCSfile: pe_tydf2.cxx,v $
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 ************************************************************************/
32 #include <s2_luidl/pe_tydf2.hxx>
34 // NOT FULLY DECLARED SERVICES
35 #include <ary/idl/i_gate.hxx>
36 #include <ary/idl/i_typedef.hxx>
37 #include <ary/idl/ip_ce.hxx>
38 #include <ary/doc/d_oldidldocu.hxx>
39 #include <s2_luidl/pe_type2.hxx>
40 #include <s2_luidl/tk_ident.hxx>
41 #include <s2_luidl/tk_punct.hxx>
42 #include <s2_luidl/tk_const.hxx>
54 #define DF &PE_Typedef::On_Default
57 PE_Typedef::aDispatcher
[PE_Typedef::e_STATES_MAX
][PE_Typedef::tt_MAX
] =
58 { { DF
, DF
, DF
}, // e_none
59 { &PE_Typedef::On_expect_description_Any
,
60 &PE_Typedef::On_expect_description_Any
,
61 DF
}, // expect_description
62 { DF
, &PE_Typedef::On_expect_name_Identifier
,
64 { DF
, DF
, &PE_Typedef::On_got_name_Punctuation
} // got_name
70 PE_Typedef::CallHandler( const char * i_sTokenText
,
71 E_TokenType i_eTokenType
)
72 { (this->*aDispatcher
[eState
][i_eTokenType
])(i_sTokenText
); }
78 PE_Typedef::PE_Typedef()
84 pPE_Type
= new PE_Type(nType
);
88 PE_Typedef::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
);
93 pPE_Type
->EstablishContacts(this,io_rRepository
,o_rResult
);
96 PE_Typedef::~PE_Typedef()
101 PE_Typedef::ProcessToken( const Token
& i_rToken
)
103 i_rToken
.Trigger(*this);
107 PE_Typedef::Process_Identifier( const TokIdentifier
& i_rToken
)
109 CallHandler(i_rToken
.Text(), tt_identifier
);
113 PE_Typedef::Process_Punctuation( const TokPunctuation
& i_rToken
)
115 CallHandler(i_rToken
.Text(), tt_punctuation
);
119 PE_Typedef::Process_Default()
121 CallHandler("", tt_any
);
125 PE_Typedef::On_expect_description_Any(const char *)
127 SetResult(not_done
,push_sure
, pPE_Type
.Ptr());
131 PE_Typedef::On_expect_name_Identifier(const char * i_sText
)
134 SetResult(done
,stay
);
139 PE_Typedef::On_got_name_Punctuation(const char * i_sText
)
141 if ( i_sText
[0] == ';' )
143 SetResult(done
,pop_success
);
151 PE_Typedef::On_Default(const char * )
153 SetResult(not_done
,pop_failure
);
157 PE_Typedef::InitData()
159 eState
= expect_description
;
165 PE_Typedef::ReceiveData()
167 eState
= expect_name
;
171 PE_Typedef::TransferData()
174 rCe
= Gate().Ces().Store_Typedef(CurNamespace().CeId(), sName
, nType
);