Update ooo320-m1
[ooovba.git] / autodoc / source / parser / cpp / pe_tpltp.cxx
blob3bbc9ab7214f695ea8715f15989b2be39b35a595
1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 *
5 * Copyright 2008 by Sun Microsystems, Inc.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * $RCSfile: pe_tpltp.cxx,v $
10 * $Revision: 1.10 $
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 ************************************************************************/
31 #include <precomp.h>
32 #include "pe_tpltp.hxx"
35 // NOT FULLY DECLARED SERVICES
36 #include <cosv/tpl/tpltools.hxx>
40 namespace cpp {
44 PE_TemplateTop::PE_TemplateTop( Cpp_PE * i_pParent )
45 : Cpp_PE(i_pParent),
46 pStati( new PeStatusArray<PE_TemplateTop> ),
47 // aResult_Parameters,
48 bCurIsConstant(false)
50 Setup_StatusFunctions();
54 PE_TemplateTop::~PE_TemplateTop()
58 void
59 PE_TemplateTop::Call_Handler( const cpp::Token & i_rTok )
61 pStati->Cur().Call_Handler(i_rTok.TypeId(), i_rTok.Text());
64 void
65 PE_TemplateTop::Setup_StatusFunctions()
67 typedef CallFunction<PE_TemplateTop>::F_Tok F_Tok;
69 static F_Tok stateF_start[] = { &PE_TemplateTop::On_start_Less };
70 static INT16 stateT_start[] = { Tid_Less };
72 static F_Tok stateF_expect_qualifier[]= { &PE_TemplateTop::On_expect_qualifier_ClassOrTypename,
73 &PE_TemplateTop::On_expect_qualifier_Greater,
74 &PE_TemplateTop::On_expect_qualifier_ClassOrTypename };
75 static INT16 stateT_expect_qualifier[]= { Tid_class,
76 Tid_Greater,
77 Tid_typename };
79 static F_Tok stateF_expect_name[] = { &PE_TemplateTop::On_expect_name_Identifier };
80 static INT16 stateT_expect_name[] = { Tid_Identifier };
82 static F_Tok stateF_expect_separator[]= { &PE_TemplateTop::On_expect_separator_Comma,
83 &PE_TemplateTop::On_expect_separator_Greater };
84 static INT16 stateT_expect_separator[]= { Tid_Comma,
85 Tid_Greater };
87 SEMPARSE_CREATE_STATUS(PE_TemplateTop, start, Hdl_SyntaxError);
88 SEMPARSE_CREATE_STATUS(PE_TemplateTop, expect_qualifier, On_expect_qualifier_Other);
89 SEMPARSE_CREATE_STATUS(PE_TemplateTop, expect_name, Hdl_SyntaxError);
90 SEMPARSE_CREATE_STATUS(PE_TemplateTop, expect_separator, Hdl_SyntaxError);
93 void
94 PE_TemplateTop::InitData()
96 pStati->SetCur(start);
97 csv::erase_container(aResult_Parameters);
98 bCurIsConstant = false;
101 void
102 PE_TemplateTop::TransferData()
104 pStati->SetCur(size_of_states);
107 void
108 PE_TemplateTop::Hdl_SyntaxError(const char * i_sText)
110 StdHandlingOfSyntaxError(i_sText);
113 void
114 PE_TemplateTop::On_start_Less( const char *)
116 SetTokenResult(done, stay);
117 pStati->SetCur(expect_qualifier);
120 void
121 PE_TemplateTop::On_expect_qualifier_ClassOrTypename( const char *)
123 SetTokenResult(done, stay);
124 pStati->SetCur(expect_name);
127 void
128 PE_TemplateTop::On_expect_qualifier_Greater(const char *)
130 SetTokenResult(done, pop_success);
133 void
134 PE_TemplateTop::On_expect_qualifier_Other( const char *)
136 SetTokenResult(done, stay);
137 pStati->SetCur(expect_name);
139 bCurIsConstant = true;
142 void
143 PE_TemplateTop::On_expect_name_Identifier( const char * i_sText)
145 SetTokenResult(done, stay);
146 pStati->SetCur(expect_separator);
148 StreamLock sl(50);
149 if ( NOT bCurIsConstant )
151 String sText( sl() << "typename " << i_sText << c_str );
152 aResult_Parameters.push_back(sText);
154 else //
156 String sText( sl() << "constant " << i_sText << c_str );
157 aResult_Parameters.push_back(sText);
158 bCurIsConstant = false;
159 } // endif
162 void
163 PE_TemplateTop::On_expect_separator_Comma( const char *)
165 SetTokenResult(done, stay);
166 pStati->SetCur(expect_qualifier);
169 void
170 PE_TemplateTop::On_expect_separator_Greater( const char *)
172 SetTokenResult(done, pop_success);
178 } // namespace cpp