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 23 24 #ifndef X2C_CR_HTML_HXX 25 #define X2C_CR_HTML_HXX 26 27 28 #include <string.h> 29 #include <fstream> 30 #include "../support/sistr.hxx" 31 #include "../support/syshelp.hxx" 32 33 34 class XmlElement; 35 class SglTextElement; 36 class MultipleTextElement; 37 38 39 class HtmlCreator 40 { 41 public: 42 HtmlCreator( 43 const char * i_pOutputFileName, 44 const XmlElement & i_rDocument, 45 const Simstr & i_sIDL_BaseDirectory ); 46 ~HtmlCreator(); 47 48 void Run(); 49 50 void StartTable(); 51 void FinishTable(); 52 void StartBigCell( 53 const char * i_sTitle ); 54 void FinishBigCell(); 55 56 void Write_SglTextElement( 57 const SglTextElement & 58 i_rElement, 59 bool i_bStrong = false ); 60 void Write_MultiTextElement( 61 const MultipleTextElement & 62 i_rElement ); 63 void Write_SglText( 64 const Simstr & i_sName, 65 const Simstr & i_sValue ); 66 void Write_ReferenceDocu( 67 const Simstr & i_sName, 68 const Simstr & i_sRef, 69 const Simstr & i_sRole, 70 const Simstr & i_sTitle ); 71 private: 72 void StartRow(); 73 void FinishRow(); 74 void StartCell( 75 const char * i_pWidth ); 76 void FinishCell(); 77 78 void WriteElementName( 79 const Simstr & i_sName, 80 bool i_bStrong ); WriteStr(const char * i_sStr)81 void WriteStr( 82 const char * i_sStr ) 83 { aFile.write( i_sStr, (int) strlen(i_sStr) ); } 84 // DATA 85 std::ofstream aFile; 86 const XmlElement & rDocument; 87 Simstr sIdl_BaseDirectory; 88 }; 89 90 91 92 93 #endif 94 95 96