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 "adc_cmd_parse.hxx"
33 // NOT FULLY DEFINED SERVICES
34 #include <cosv/tpl/tpltools.hxx>
36 #include "adc_cmds.hxx"
37 #include "cmd_run.hxx"
49 const String
C_FileEnding_idl("*.idl");
52 CHECK( bool b
, const String
& text
)
55 throw X_CommandLine( text
);
58 } // anonymous namespace
62 //************************** S_LanguageInfo ***********************//
64 S_LanguageInfo::~S_LanguageInfo()
69 S_LanguageInfo::do_Init( opt_iter
& it
,
72 ++it
; // Cur is language.
73 CHECKOPT( it
!= itEnd AND
78 if ( *it
== C_arg_Idl
) {
87 case idl
: aExtensions
.push_back( C_FileEnding_idl
);
88 CommandLine::Get_().Set_IdlUsed();
90 default: // do nothing.
94 ++it
; // Cur is next option.
98 S_LanguageInfo::InitExtensions( opt_iter
& it
,
102 CHECKOPT( it
!= itEnd
AND (*it
).char_at(0) == '.',
104 C_opt_ExtensionsAll
);
106 StreamLock
slCheck(150);
107 slCheck() << C_opt_ExtensionsAll
108 << " used without previous "
111 CHECK( eLanguage
!= none
,
115 aExtensions
.push_back(*it
);
117 } while (it
!= itEnd
AND (*it
).char_at(0) == '.');
122 //************************** Parse ***********************//
128 sDevelopersManual_RefFilePath()
134 csv::erase_container_of_heap_ptrs(aProjects
);
138 Parse::do_Init( opt_iter
& it
,
141 for ( ; it
!= itEnd
; )
143 if (*it
== C_opt_Name
)
144 do_clName(it
, itEnd
);
145 else if (*it
== C_opt_LangAll
)
146 aGlobalLanguage
.Init(it
, itEnd
);
147 else if (*it
== C_opt_ExtensionsAll
)
148 aGlobalLanguage
.InitExtensions(it
, itEnd
);
149 else if (*it
== C_opt_DevmanFile
)
150 do_clDevManual(it
, itEnd
);
151 else if (*it
== C_opt_Project
)
152 do_clProject(it
, itEnd
);
153 else if ( *it
== C_opt_SourceTree
154 OR
*it
== C_opt_SourceDir
155 OR
*it
== C_opt_SourceFile
)
156 do_clDefaultProject(it
, itEnd
);
163 Parse::do_clName( opt_iter
& it
,
167 CHECKOPT( it
!= itEnd
AND (*it
).char_at(0) != '-',
170 sRepositoryName
= *it
;
175 Parse::do_clDevManual( opt_iter
& it
,
179 CHECKOPT( it
!= itEnd
AND (*it
).char_at(0) != '-',
182 sDevelopersManual_RefFilePath
= *it
;
187 Parse::do_clProject( opt_iter
& it
,
190 if ( aProjects
.size() == 1 )
192 if ( aProjects
.front()->IsDefault() )
193 throw X_CommandLine( "Both, named projects and a default project, cannot be used together." );
196 S_ProjectData
* dpProject
= new S_ProjectData(aGlobalLanguage
);
198 dpProject
->Init(it
, itEnd
);
199 aProjects
.push_back(dpProject
);
203 Parse::do_clDefaultProject( opt_iter
& it
,
206 if ( !aProjects
.empty() )
208 throw X_CommandLine( "Both, named projects and a default project, cannot be used together." );
211 S_ProjectData
* dpProject
= new S_ProjectData( aGlobalLanguage
,
212 S_ProjectData::default_prj
);
213 dpProject
->Init(it
, itEnd
);
214 aProjects
.push_back(dpProject
);
218 Parse::do_Run() const
222 return aParser
.Perform();
226 Parse::inq_RunningRank() const
228 return static_cast<int>(rank_Parse
);
233 //************************** S_Sources ***********************//
236 S_Sources::do_Init( opt_iter
& it
,
241 csv_assert((*it
)[0] == '-');
243 for ( ; it
!= itEnd
; ++it
)
247 if (*it
== C_opt_SourceTree
)
249 else if (*it
== C_opt_SourceDir
)
250 pList
= &aDirectories
;
251 else if (*it
== C_opt_SourceFile
)
257 pList
->push_back(*it
);
263 //************************** S_ProjectData ***********************//
266 S_ProjectData::S_ProjectData( const S_LanguageInfo
& i_globalLanguage
)
269 aLanguage(i_globalLanguage
),
275 S_ProjectData::S_ProjectData( const S_LanguageInfo
& i_globalLanguage
,
279 aLanguage(i_globalLanguage
),
285 S_ProjectData::~S_ProjectData()
290 S_ProjectData::do_Init( opt_iter
& it
,
295 CHECKOPT( it
!= itEnd
AND (*it
).char_at(0) != '-',
301 CHECKOPT( it
!= itEnd
AND (*it
).char_at(0) != '-',
304 aRootDirectory
.Set((*it
).c_str(), true);
308 for ( ; it
!= itEnd
; )
310 if ( *it
== C_opt_SourceTree
311 OR
*it
== C_opt_SourceDir
312 OR
*it
== C_opt_SourceFile
)
313 aFiles
.Init(it
, itEnd
);
314 // else if (*it == C_opt_Lang)
315 // aLanguage.Init(it, itEnd);
316 // else if (*it == C_opt_Extensions)
317 // aLanguage.InitExtensions(it, itEnd);
323 } // namespace command
324 } // namespace autodoc
328 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */