xref: /trunk/main/autodoc/source/exes/adc_uni/adc_cmds.cxx (revision cf6516809c57e1bb0a940545cca99cdad54d4ce2)
1d291ea28SAndrew Rist /**************************************************************
2cdf0e10cSrcweir  *
3d291ea28SAndrew Rist  * Licensed to the Apache Software Foundation (ASF) under one
4d291ea28SAndrew Rist  * or more contributor license agreements.  See the NOTICE file
5d291ea28SAndrew Rist  * distributed with this work for additional information
6d291ea28SAndrew Rist  * regarding copyright ownership.  The ASF licenses this file
7d291ea28SAndrew Rist  * to you under the Apache License, Version 2.0 (the
8d291ea28SAndrew Rist  * "License"); you may not use this file except in compliance
9d291ea28SAndrew Rist  * with the License.  You may obtain a copy of the License at
10cdf0e10cSrcweir  *
11d291ea28SAndrew Rist  *   http://www.apache.org/licenses/LICENSE-2.0
12cdf0e10cSrcweir  *
13d291ea28SAndrew Rist  * Unless required by applicable law or agreed to in writing,
14d291ea28SAndrew Rist  * software distributed under the License is distributed on an
15d291ea28SAndrew Rist  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16d291ea28SAndrew Rist  * KIND, either express or implied.  See the License for the
17d291ea28SAndrew Rist  * specific language governing permissions and limitations
18d291ea28SAndrew Rist  * under the License.
19cdf0e10cSrcweir  *
20d291ea28SAndrew Rist  *************************************************************/
21cdf0e10cSrcweir 
22cdf0e10cSrcweir #include <precomp.h>
23cdf0e10cSrcweir #include "adc_cmds.hxx"
24cdf0e10cSrcweir 
25cdf0e10cSrcweir 
26cdf0e10cSrcweir // NOT FULLY DEFINED SERVICES
27cdf0e10cSrcweir #include <ary/ary.hxx>
28cdf0e10cSrcweir #include <autodoc/displaying.hxx>
29cdf0e10cSrcweir #include <autodoc/dsp_html_std.hxx>
30cdf0e10cSrcweir #include <display/corframe.hxx>
31cdf0e10cSrcweir #include <adc_cl.hxx>
32cdf0e10cSrcweir 
33cdf0e10cSrcweir 
34cdf0e10cSrcweir namespace autodoc
35cdf0e10cSrcweir {
36cdf0e10cSrcweir namespace command
37cdf0e10cSrcweir {
38cdf0e10cSrcweir 
39cdf0e10cSrcweir extern const String C_opt_Include("-I:");
40cdf0e10cSrcweir 
41cdf0e10cSrcweir extern const String C_opt_Verbose("-v");
42cdf0e10cSrcweir 
43cdf0e10cSrcweir extern const String C_opt_Parse("-parse");
44cdf0e10cSrcweir extern const String C_opt_Name("-name");
45cdf0e10cSrcweir extern const String C_opt_LangAll("-lg");
46cdf0e10cSrcweir extern const String C_opt_ExtensionsAll("-extg");
47cdf0e10cSrcweir extern const String C_opt_DevmanFile("-dvgfile");
48cdf0e10cSrcweir extern const String C_opt_SinceFile("-sincefile");
49cdf0e10cSrcweir 
50cdf0e10cSrcweir extern const String C_arg_Cplusplus("c++");
51cdf0e10cSrcweir extern const String C_arg_Idl("idl");
52cdf0e10cSrcweir extern const String C_arg_Java("java");
53cdf0e10cSrcweir 
54cdf0e10cSrcweir extern const String C_opt_Project("-p");
55cdf0e10cSrcweir //extern const String C_opt_Lang;
56cdf0e10cSrcweir //extern const String C_opt_Extensions;
57cdf0e10cSrcweir extern const String C_opt_SourceDir("-d");
58cdf0e10cSrcweir extern const String C_opt_SourceTree("-t");
59cdf0e10cSrcweir extern const String C_opt_SourceFile("-f");
60cdf0e10cSrcweir 
61cdf0e10cSrcweir extern const String C_opt_CreateHtml("-html");
62cdf0e10cSrcweir extern const String C_opt_DevmanRoot("-dvgroot");
63cdf0e10cSrcweir 
64cdf0e10cSrcweir //extern const String C_opt_CreateXml("-xml");
65cdf0e10cSrcweir //extern const String C_opt_Load("-load");
66cdf0e10cSrcweir //extern const String C_opt_Save("-save");
67cdf0e10cSrcweir 
68*b32aa359SDamjan Jovanovic extern const String C_opt_IgnoreDefine("-ignoredefine");
69cdf0e10cSrcweir extern const String C_opt_ExternNamespace("-extnsp");
70cdf0e10cSrcweir extern const String C_opt_ExternRoot("-extroot");
71cdf0e10cSrcweir 
72cdf0e10cSrcweir 
73cdf0e10cSrcweir 
74cdf0e10cSrcweir //**************************        CreateHTML    ***********************//
75cdf0e10cSrcweir 
CreateHtml()76cdf0e10cSrcweir CreateHtml::CreateHtml()
77cdf0e10cSrcweir     :   sOutputRootDirectory(),
78cdf0e10cSrcweir         sDevelopersManual_HtmlRoot()
79cdf0e10cSrcweir {
80cdf0e10cSrcweir }
81cdf0e10cSrcweir 
~CreateHtml()82cdf0e10cSrcweir CreateHtml::~CreateHtml()
83cdf0e10cSrcweir {
84cdf0e10cSrcweir }
85cdf0e10cSrcweir 
86cdf0e10cSrcweir void
do_Init(opt_iter & it,opt_iter itEnd)87cdf0e10cSrcweir CreateHtml::do_Init( opt_iter &          it,
88cdf0e10cSrcweir                      opt_iter            itEnd )
89cdf0e10cSrcweir {
90cdf0e10cSrcweir     ++it;
91cdf0e10cSrcweir     CHECKOPT( it != itEnd && (*it).char_at(0) != '-',
92cdf0e10cSrcweir               "output directory", C_opt_CreateHtml );
93cdf0e10cSrcweir     sOutputRootDirectory = *it;
94cdf0e10cSrcweir 
95cdf0e10cSrcweir     for ( ++it;
96cdf0e10cSrcweir           it != itEnd AND (*it == C_opt_DevmanRoot);
97cdf0e10cSrcweir           ++it )
98cdf0e10cSrcweir     {
99cdf0e10cSrcweir         if (*it == C_opt_DevmanRoot)
100cdf0e10cSrcweir         {
101cdf0e10cSrcweir             ++it;
102cdf0e10cSrcweir             CHECKOPT( it != itEnd AND (*it).char_at(0) != '-',
103cdf0e10cSrcweir                       "HTML root directory of Developers Guide",
104cdf0e10cSrcweir                       C_opt_DevmanRoot );
105cdf0e10cSrcweir             sDevelopersManual_HtmlRoot = *it;
106cdf0e10cSrcweir         }
107cdf0e10cSrcweir     }   // end for
108cdf0e10cSrcweir }
109cdf0e10cSrcweir 
110cdf0e10cSrcweir bool
do_Run() const111cdf0e10cSrcweir CreateHtml::do_Run() const
112cdf0e10cSrcweir {
113cdf0e10cSrcweir     if ( CommandLine::Get_().IdlUsed() )
114cdf0e10cSrcweir         run_Idl();
115cdf0e10cSrcweir     if ( CommandLine::Get_().CppUsed() )
116cdf0e10cSrcweir         run_Cpp();
117cdf0e10cSrcweir     return true;
118cdf0e10cSrcweir }
119cdf0e10cSrcweir 
120cdf0e10cSrcweir int
inq_RunningRank() const121cdf0e10cSrcweir CreateHtml::inq_RunningRank() const
122cdf0e10cSrcweir {
123cdf0e10cSrcweir     return static_cast<int>(rank_CreateHtml);
124cdf0e10cSrcweir }
125cdf0e10cSrcweir 
126cdf0e10cSrcweir void
run_Idl() const127cdf0e10cSrcweir CreateHtml::run_Idl() const
128cdf0e10cSrcweir {
129cdf0e10cSrcweir     const ary::idl::Gate &
130cdf0e10cSrcweir         rGate = CommandLine::Get_().TheRepository().Gate_Idl();
131cdf0e10cSrcweir 
132cdf0e10cSrcweir     Cout() << "Creating HTML-output into the directory "
133cdf0e10cSrcweir               << sOutputRootDirectory
134cdf0e10cSrcweir               << "."
135cdf0e10cSrcweir               << Endl();
136cdf0e10cSrcweir 
137cdf0e10cSrcweir     const DisplayToolsFactory_Ifc &
138cdf0e10cSrcweir         rToolsFactory = DisplayToolsFactory_Ifc::GetIt_();
139cdf0e10cSrcweir     Dyn<autodoc::HtmlDisplay_Idl_Ifc>
140cdf0e10cSrcweir         pDisplay( rToolsFactory.Create_HtmlDisplay_Idl() );
141cdf0e10cSrcweir 
142cdf0e10cSrcweir     DYN display::CorporateFrame &   // KORR_FUTURE: Remove the need for const_cast
143cdf0e10cSrcweir         drFrame = const_cast< display::CorporateFrame& >(rToolsFactory.Create_StdFrame());
144cdf0e10cSrcweir     if (NOT DevelopersManual_HtmlRoot().empty())
145cdf0e10cSrcweir         drFrame.Set_DevelopersGuideHtmlRoot( DevelopersManual_HtmlRoot() );
146cdf0e10cSrcweir 
147cdf0e10cSrcweir     pDisplay->Run( sOutputRootDirectory,
148cdf0e10cSrcweir                    rGate,
149cdf0e10cSrcweir                    drFrame );
150cdf0e10cSrcweir }
151cdf0e10cSrcweir 
152cdf0e10cSrcweir void
run_Cpp() const153cdf0e10cSrcweir CreateHtml::run_Cpp() const
154cdf0e10cSrcweir {
155cdf0e10cSrcweir     const ary::Repository &
156cdf0e10cSrcweir         rReposy = CommandLine::Get_().TheRepository();
157cdf0e10cSrcweir     const ary::cpp::Gate &
158cdf0e10cSrcweir         rGate = rReposy.Gate_Cpp();
159cdf0e10cSrcweir 
160cdf0e10cSrcweir     const DisplayToolsFactory_Ifc &
161cdf0e10cSrcweir         rToolsFactory = DisplayToolsFactory_Ifc::GetIt_();
162cdf0e10cSrcweir     Dyn< autodoc::HtmlDisplay_UdkStd >
163cdf0e10cSrcweir         pDisplay( rToolsFactory.Create_HtmlDisplay_UdkStd() );
164cdf0e10cSrcweir 
165cdf0e10cSrcweir     pDisplay->Run( sOutputRootDirectory,
166cdf0e10cSrcweir                    rGate,
167cdf0e10cSrcweir                    rToolsFactory.Create_StdFrame() );
168cdf0e10cSrcweir }
169cdf0e10cSrcweir 
170cdf0e10cSrcweir 
171cdf0e10cSrcweir }   // namespace command
172cdf0e10cSrcweir }   // namespace autodoc
173