Bump for 3.6-28
[LibreOffice.git] / autodoc / source / exes / adc_uni / cmd_run.cxx
blob9767ad7fd0289fad39a429481328e86f2ca0a7c6
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 ************************************************************************/
29 #include <precomp.h>
30 #include "cmd_run.hxx"
33 // NOT FULLY DEFINED SERVICES
34 #include <cosv/file.hxx>
35 #include <cosv/x.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>
45 #include <adc_cl.hxx>
46 #include "adc_cmd_parse.hxx"
47 #include "adc_cmds.hxx"
49 namespace autodoc
51 namespace command
53 namespace run
56 Parser::Parser( const Parse & i_command )
57 : rCommand(i_command),
58 pCppDocuInterpreter(),
59 pIdlParser()
63 Parser::~Parser()
67 bool
68 Parser::Perform()
70 Cout() << "Parsing the repository "
71 << rCommand.ReposyName()
72 << " ..."
73 << Endl();
74 try
76 ::ary::Repository &
77 rAry = CommandLine::Get_().TheRepository();
78 rAry.Set_Title(rCommand.ReposyName());
80 Dyn< FileCollector_Ifc >
81 pFiles( ParseToolsFactory().Create_FileCollector(6000) );
83 bool bIDL = false;
85 command::Parse::ProjectIterator
86 itEnd = rCommand.ProjectsEnd();
87 for ( command::Parse::ProjectIterator it = rCommand.ProjectsBegin();
88 it != itEnd;
89 ++it )
91 uintt nCount = GatherFiles( *pFiles, *(*it) );
92 Cout() << nCount
93 << " files found to parse in project "
94 << (*it)->Name()
95 << "."
96 << Endl();
98 switch ( (*it)->Language().eLanguage )
100 case command::S_LanguageInfo::idl:
102 Get_IdlParser().Run(*pFiles);
103 bIDL = true;
104 } break;
105 default:
106 Cerr() << "Project in yet unimplemented language skipped."
107 << Endl();
109 } // end for
111 if (bIDL)
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())
124 // {
125 // csv::File
126 // aFile(rCommand.DevelopersManual_RefFilePath(), csv::CFM_READ);
127 // if ( aFile.open() )
128 // {
129 // rIdl2sPilot.Read_Links2DevManual(aFile);
130 // aFile.close();
131 // }
132 // }
133 } // endif (bIDL)
135 return true;
137 } // end try
138 catch (csv::Exception & xx)
140 xx.GetInfo(Cerr());
141 Cerr() << " program will exit." << Endl();
143 return false;
147 IdlParser &
148 Parser::Get_IdlParser()
150 if ( NOT pIdlParser )
151 Create_IdlParser();
152 return *pIdlParser;
155 void
156 Parser::Create_IdlParser()
158 pIdlParser = new IdlParser(CommandLine::Get_().TheRepository());
161 const ParseToolsFactory_Ifc &
162 Parser::ParseToolsFactory()
164 return ParseToolsFactory_Ifc::GetIt_();
167 uintt
168 Parser::GatherFiles( FileCollector_Ifc & o_rFiles,
169 const S_ProjectData & i_rProject )
171 uintt ret = 0;
172 o_rFiles.EraseAll();
174 typedef StringVector StrVector;
175 typedef StrVector::const_iterator StrIterator;
176 const S_Sources &
177 rSources = i_rProject.Sources();
178 const StrVector &
179 rExtensions = i_rProject.Language().aExtensions;
181 StrIterator it;
182 StrIterator itTreesEnd = rSources.aTrees.end();
183 StrIterator itDirsEnd = rSources.aDirectories.end();
184 StrIterator itFilesEnd = rSources.aFiles.end();
185 StrIterator itExt;
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();
197 it != itDirsEnd;
198 ++it )
200 aDir.seekp( nProjectDir_AddPosition );
201 aDir << *it;
203 for ( itExt = rExtensions.begin();
204 itExt != itExtEnd;
205 ++itExt )
207 ret += o_rFiles.AddFilesFrom( aDir.c_str(),
208 *itExt,
209 FileCollector_Ifc::flat );
210 } // end for itExt
211 } // end for it
212 for ( it = rSources.aTrees.begin();
213 it != itTreesEnd;
214 ++it )
216 aDir.seekp( nProjectDir_AddPosition );
217 aDir << *it;
219 for ( itExt = rExtensions.begin();
220 itExt != itExtEnd;
221 ++itExt )
223 ret += o_rFiles.AddFilesFrom( aDir.c_str(),
224 *itExt,
225 FileCollector_Ifc::recursive );
226 } // end for itExt
227 } // end for it
228 for ( it = rSources.aFiles.begin();
229 it != itFilesEnd;
230 ++it )
232 aDir.seekp( nProjectDir_AddPosition );
233 aDir << *it;
235 o_rFiles.AddFile( aDir.c_str() );
236 } // end for it
237 ret += rSources.aFiles.size();
239 return ret;
243 } // namespace run
244 } // namespace command
245 } // namespace autodoc
250 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */