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