1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*************************************************************************
4 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
6 * Copyright 2000, 2010 Oracle and/or its affiliates.
8 * OpenOffice.org - a multi-platform office productivity suite
10 * This file is part of OpenOffice.org.
12 * OpenOffice.org is free software: you can redistribute it and/or modify
13 * it under the terms of the GNU Lesser General Public License version 3
14 * only, as published by the Free Software Foundation.
16 * OpenOffice.org is distributed in the hope that it will be useful,
17 * but WITHOUT ANY WARRANTY; without even the implied warranty of
18 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 * GNU Lesser General Public License version 3 for more details
20 * (a copy is included in the LICENSE file that accompanied this code).
22 * You should have received a copy of the GNU Lesser General Public License
23 * version 3 along with OpenOffice.org. If not, see
24 * <http://www.openoffice.org/license.html>
25 * for a copy of the LGPLv3 License.
27 ************************************************************************/
30 #include "cmd_run.hxx"
33 // NOT FULLY DEFINED SERVICES
34 #include <cosv/file.hxx>
36 #include <ary/ary.hxx>
37 #include <ary/idl/i_ce.hxx>
38 #include <ary/idl/i_gate.hxx>
39 #include <ary/idl/i_module.hxx>
40 #include <ary/idl/ip_ce.hxx>
41 #include <autodoc/filecoli.hxx>
42 #include <autodoc/parsing.hxx>
43 #include <autodoc/prs_docu.hxx>
44 #include <parser/unoidl.hxx>
46 #include "adc_cmd_parse.hxx"
47 #include "adc_cmds.hxx"
56 Parser::Parser( const Parse
& i_command
)
57 : rCommand(i_command
),
58 pCppDocuInterpreter(),
70 Cout() << "Parsing the repository "
71 << rCommand
.ReposyName()
77 rAry
= CommandLine::Get_().TheRepository();
78 rAry
.Set_Title(rCommand
.ReposyName());
80 Dyn
< FileCollector_Ifc
>
81 pFiles( ParseToolsFactory().Create_FileCollector(6000) );
85 command::Parse::ProjectIterator
86 itEnd
= rCommand
.ProjectsEnd();
87 for ( command::Parse::ProjectIterator it
= rCommand
.ProjectsBegin();
91 uintt nCount
= GatherFiles( *pFiles
, *(*it
) );
93 << " files found to parse in project "
98 switch ( (*it
)->Language().eLanguage
)
100 case command::S_LanguageInfo::idl
:
102 Get_IdlParser().Run(*pFiles
);
106 Cerr() << "Project in yet unimplemented language skipped."
113 rAry
.Gate_Idl().Calculate_AllSecondaryInformation(
114 rCommand
.DevelopersManual_RefFilePath() );
116 // ::ary::idl::SecondariesPilot &
117 // rIdl2sPilot = rAry.Gate_Idl().Secondaries();
119 // rIdl2sPilot.CheckAllInterfaceBases( rAry.Gate_Idl() );
120 // rIdl2sPilot.Connect_Types2Ces();
121 // rIdl2sPilot.Gather_CrossReferences();
123 // if (NOT rCommand.DevelopersManual_RefFilePath().empty())
126 // aFile(rCommand.DevelopersManual_RefFilePath(), csv::CFM_READ);
127 // if ( aFile.open() )
129 // rIdl2sPilot.Read_Links2DevManual(aFile);
138 catch (csv::Exception
& xx
)
141 Cerr() << " program will exit." << Endl();
148 Parser::Get_IdlParser()
150 if ( NOT pIdlParser
)
156 Parser::Create_IdlParser()
158 pIdlParser
= new IdlParser(CommandLine::Get_().TheRepository());
161 const ParseToolsFactory_Ifc
&
162 Parser::ParseToolsFactory()
164 return ParseToolsFactory_Ifc::GetIt_();
168 Parser::GatherFiles( FileCollector_Ifc
& o_rFiles
,
169 const S_ProjectData
& i_rProject
)
174 typedef StringVector StrVector
;
175 typedef StrVector::const_iterator StrIterator
;
177 rSources
= i_rProject
.Sources();
179 rExtensions
= i_rProject
.Language().aExtensions
;
182 StrIterator itTreesEnd
= rSources
.aTrees
.end();
183 StrIterator itDirsEnd
= rSources
.aDirectories
.end();
184 StrIterator itFilesEnd
= rSources
.aFiles
.end();
186 StrIterator itExtEnd
= rExtensions
.end();
188 csv::StreamStr
aDir(500);
189 i_rProject
.RootDirectory().Get( aDir
);
191 uintt nProjectDir_AddPosition
=
192 ( strcmp(aDir
.c_str(),".\\") == 0 OR
strcmp(aDir
.c_str(),"./") == 0 )
194 : uintt( aDir
.tellp() );
196 for ( it
= rSources
.aDirectories
.begin();
200 aDir
.seekp( nProjectDir_AddPosition
);
203 for ( itExt
= rExtensions
.begin();
207 ret
+= o_rFiles
.AddFilesFrom( aDir
.c_str(),
209 FileCollector_Ifc::flat
);
212 for ( it
= rSources
.aTrees
.begin();
216 aDir
.seekp( nProjectDir_AddPosition
);
219 for ( itExt
= rExtensions
.begin();
223 ret
+= o_rFiles
.AddFilesFrom( aDir
.c_str(),
225 FileCollector_Ifc::recursive
);
228 for ( it
= rSources
.aFiles
.begin();
232 aDir
.seekp( nProjectDir_AddPosition
);
235 o_rFiles
.AddFile( aDir
.c_str() );
237 ret
+= rSources
.aFiles
.size();
244 } // namespace command
245 } // namespace autodoc
250 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */