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_ExternNamespace("-extnsp"); 69 extern const String C_opt_ExternRoot("-extroot"); 70 71 72 73 //************************** CreateHTML ***********************// 74 75 CreateHtml::CreateHtml() 76 : sOutputRootDirectory(), 77 sDevelopersManual_HtmlRoot() 78 { 79 } 80 81 CreateHtml::~CreateHtml() 82 { 83 } 84 85 void 86 CreateHtml::do_Init( opt_iter & it, 87 opt_iter itEnd ) 88 { 89 ++it; 90 CHECKOPT( it != itEnd && (*it).char_at(0) != '-', 91 "output directory", C_opt_CreateHtml ); 92 sOutputRootDirectory = *it; 93 94 for ( ++it; 95 it != itEnd AND (*it == C_opt_DevmanRoot); 96 ++it ) 97 { 98 if (*it == C_opt_DevmanRoot) 99 { 100 ++it; 101 CHECKOPT( it != itEnd AND (*it).char_at(0) != '-', 102 "HTML root directory of Developers Guide", 103 C_opt_DevmanRoot ); 104 sDevelopersManual_HtmlRoot = *it; 105 } 106 } // end for 107 } 108 109 bool 110 CreateHtml::do_Run() const 111 { 112 if ( CommandLine::Get_().IdlUsed() ) 113 run_Idl(); 114 if ( CommandLine::Get_().CppUsed() ) 115 run_Cpp(); 116 return true; 117 } 118 119 int 120 CreateHtml::inq_RunningRank() const 121 { 122 return static_cast<int>(rank_CreateHtml); 123 } 124 125 void 126 CreateHtml::run_Idl() const 127 { 128 const ary::idl::Gate & 129 rGate = CommandLine::Get_().TheRepository().Gate_Idl(); 130 131 Cout() << "Creating HTML-output into the directory " 132 << sOutputRootDirectory 133 << "." 134 << Endl(); 135 136 const DisplayToolsFactory_Ifc & 137 rToolsFactory = DisplayToolsFactory_Ifc::GetIt_(); 138 Dyn<autodoc::HtmlDisplay_Idl_Ifc> 139 pDisplay( rToolsFactory.Create_HtmlDisplay_Idl() ); 140 141 DYN display::CorporateFrame & // KORR_FUTURE: Remove the need for const_cast 142 drFrame = const_cast< display::CorporateFrame& >(rToolsFactory.Create_StdFrame()); 143 if (NOT DevelopersManual_HtmlRoot().empty()) 144 drFrame.Set_DevelopersGuideHtmlRoot( DevelopersManual_HtmlRoot() ); 145 146 pDisplay->Run( sOutputRootDirectory, 147 rGate, 148 drFrame ); 149 } 150 151 void 152 CreateHtml::run_Cpp() const 153 { 154 const ary::Repository & 155 rReposy = CommandLine::Get_().TheRepository(); 156 const ary::cpp::Gate & 157 rGate = rReposy.Gate_Cpp(); 158 159 const DisplayToolsFactory_Ifc & 160 rToolsFactory = DisplayToolsFactory_Ifc::GetIt_(); 161 Dyn< autodoc::HtmlDisplay_UdkStd > 162 pDisplay( rToolsFactory.Create_HtmlDisplay_UdkStd() ); 163 164 pDisplay->Run( sOutputRootDirectory, 165 rGate, 166 rToolsFactory.Create_StdFrame() ); 167 } 168 169 170 } // namespace command 171 } // namespace autodoc 172