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: unoidl.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 <parser/unoidl.hxx>
35 // NOT FULLY DECLARED SERVICES
37 #include <cosv/file.hxx>
38 #include <ary/ary.hxx>
39 #include <ary/idl/i_gate.hxx>
40 #include <ary/doc/d_oldidldocu.hxx>
41 #include <parser/parserinfo.hxx>
42 #include <tools/filecoll.hxx>
43 #include <tools/tkpchars.hxx>
44 #include <s2_luidl/tkp_uidl.hxx>
45 #include <s2_luidl/distrib.hxx>
46 #include <s2_luidl/pe_file2.hxx>
47 #include <s2_dsapi/cx_dsapi.hxx>
48 #include <adc_msg.hxx>
49 #include <x_parse2.hxx>
57 class FileParsePerformers
63 ParserInfo
& io_rParserInfo
);
66 const char * i_sFullPath
);
71 CharacterSource aFileLoader
;
72 Dyn
<csi::uidl::TokenParser_Uidl
>
74 csi::uidl::TokenDistributor
76 Dyn
<csi::uidl::PE_File
>
77 pFileParseEnvironment
;
80 ParserInfo
& rParserInfo
;
84 IdlParser::IdlParser( ary::Repository
& io_rRepository
)
85 : pRepository(&io_rRepository
)
90 IdlParser::Run( const autodoc::FileCollector_Ifc
& i_rFiles
)
92 Dyn
<FileParsePerformers
>
94 new FileParsePerformers(*pRepository
,
95 static_cast< ParserInfo
& >(*this)) );
97 FileCollector::const_iterator iEnd
= i_rFiles
.End();
98 for ( FileCollector::const_iterator iter
= i_rFiles
.Begin();
102 Cout() << (*iter
) << " ..."<< Endl();
106 pFileParsePerformers
->ParseFile(*iter
);
108 catch (X_AutodocParser
&)
111 TheMessages().Out_ParseError(CurFile(), CurLine());
113 = new FileParsePerformers(*pRepository
,
114 static_cast< ParserInfo
& >(*this));
118 Cout() << "Unknown error." << Endl();
120 // pFileParsePerformers = new FileParsePerformers( *pRepository );
124 pFileParsePerformers
->ConnectLinks();
127 FileParsePerformers::FileParsePerformers( ary::Repository
& io_rRepository
,
128 ParserInfo
& io_rParserInfo
)
130 aDistributor(io_rRepository
, io_rParserInfo
),
131 rRepository( io_rRepository
),
132 rParserInfo(io_rParserInfo
)
134 DYN
csi::dsapi::Context_Docu
*
136 = new csi::dsapi::Context_Docu( aDistributor
.DocuTokens_Receiver() );
137 pTokens
= new csi::uidl::TokenParser_Uidl( aDistributor
.CodeTokens_Receiver(), *dpDocuContext
);
138 pFileParseEnvironment
139 = new csi::uidl::PE_File(aDistributor
,rParserInfo
);
141 aDistributor
.SetTokenProvider(*pTokens
);
142 aDistributor
.SetTopParseEnvironment(*pFileParseEnvironment
);
146 FileParsePerformers::ParseFile( const char * i_sFullPath
)
148 csv::File
aFile(i_sFullPath
);
150 aFile
.open( csv::CFM_READ
);
151 csv_assert( aFile
.is_open() );
152 aFileLoader
.LoadText(aFile
);
155 rParserInfo
.Set_CurFile(i_sFullPath
, true); // true = count lines
156 pTokens
->Start(aFileLoader
);
157 aDistributor
.Reset();
160 aDistributor
.TradeToken();
161 } while ( NOT aFileLoader
.IsFinished() );
165 FileParsePerformers::ConnectLinks()
168 // rRepository.RwGate_Idl().ConnectAdditionalLinks();
171 } // namespace autodoc