xref: /trunk/main/xml2cmp/source/xcd/cr_html.hxx (revision dd7bc091be5d2f779fa787352b100cd34d3a1c9c)
1*dd7bc091SAndrew Rist /**************************************************************
2cdf0e10cSrcweir  *
3*dd7bc091SAndrew Rist  * Licensed to the Apache Software Foundation (ASF) under one
4*dd7bc091SAndrew Rist  * or more contributor license agreements.  See the NOTICE file
5*dd7bc091SAndrew Rist  * distributed with this work for additional information
6*dd7bc091SAndrew Rist  * regarding copyright ownership.  The ASF licenses this file
7*dd7bc091SAndrew Rist  * to you under the Apache License, Version 2.0 (the
8*dd7bc091SAndrew Rist  * "License"); you may not use this file except in compliance
9*dd7bc091SAndrew Rist  * with the License.  You may obtain a copy of the License at
10cdf0e10cSrcweir  *
11*dd7bc091SAndrew Rist  *   http://www.apache.org/licenses/LICENSE-2.0
12cdf0e10cSrcweir  *
13*dd7bc091SAndrew Rist  * Unless required by applicable law or agreed to in writing,
14*dd7bc091SAndrew Rist  * software distributed under the License is distributed on an
15*dd7bc091SAndrew Rist  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16*dd7bc091SAndrew Rist  * KIND, either express or implied.  See the License for the
17*dd7bc091SAndrew Rist  * specific language governing permissions and limitations
18*dd7bc091SAndrew Rist  * under the License.
19cdf0e10cSrcweir  *
20*dd7bc091SAndrew Rist  *************************************************************/
21*dd7bc091SAndrew Rist 
22*dd7bc091SAndrew Rist 
23cdf0e10cSrcweir 
24cdf0e10cSrcweir #ifndef X2C_CR_HTML_HXX
25cdf0e10cSrcweir #define X2C_CR_HTML_HXX
26cdf0e10cSrcweir 
27cdf0e10cSrcweir 
28cdf0e10cSrcweir #include <string.h>
29cdf0e10cSrcweir #include <fstream>
30cdf0e10cSrcweir #include "../support/sistr.hxx"
31cdf0e10cSrcweir #include "../support/syshelp.hxx"
32cdf0e10cSrcweir 
33cdf0e10cSrcweir 
34cdf0e10cSrcweir class XmlElement;
35cdf0e10cSrcweir class SglTextElement;
36cdf0e10cSrcweir class MultipleTextElement;
37cdf0e10cSrcweir 
38cdf0e10cSrcweir 
39cdf0e10cSrcweir class HtmlCreator
40cdf0e10cSrcweir {
41cdf0e10cSrcweir   public:
42cdf0e10cSrcweir                         HtmlCreator(
43cdf0e10cSrcweir                             const char *        i_pOutputFileName,
44cdf0e10cSrcweir                             const XmlElement &  i_rDocument,
45cdf0e10cSrcweir                             const Simstr &      i_sIDL_BaseDirectory );
46cdf0e10cSrcweir                         ~HtmlCreator();
47cdf0e10cSrcweir 
48cdf0e10cSrcweir     void                Run();
49cdf0e10cSrcweir 
50cdf0e10cSrcweir     void                StartTable();
51cdf0e10cSrcweir     void                FinishTable();
52cdf0e10cSrcweir     void                StartBigCell(
53cdf0e10cSrcweir                             const char *        i_sTitle );
54cdf0e10cSrcweir     void                FinishBigCell();
55cdf0e10cSrcweir 
56cdf0e10cSrcweir     void                Write_SglTextElement(
57cdf0e10cSrcweir                             const SglTextElement &
58cdf0e10cSrcweir                                                 i_rElement,
59cdf0e10cSrcweir                             bool                i_bStrong = false );
60cdf0e10cSrcweir     void                Write_MultiTextElement(
61cdf0e10cSrcweir                             const MultipleTextElement &
62cdf0e10cSrcweir                                                 i_rElement );
63cdf0e10cSrcweir     void                Write_SglText(
64cdf0e10cSrcweir                             const Simstr &      i_sName,
65cdf0e10cSrcweir                             const Simstr &      i_sValue );
66cdf0e10cSrcweir     void                Write_ReferenceDocu(
67cdf0e10cSrcweir                             const Simstr &      i_sName,
68cdf0e10cSrcweir                             const Simstr &      i_sRef,
69cdf0e10cSrcweir                             const Simstr &      i_sRole,
70cdf0e10cSrcweir                             const Simstr &      i_sTitle );
71cdf0e10cSrcweir   private:
72cdf0e10cSrcweir     void                StartRow();
73cdf0e10cSrcweir     void                FinishRow();
74cdf0e10cSrcweir     void                StartCell(
75cdf0e10cSrcweir                             const char *        i_pWidth );
76cdf0e10cSrcweir     void                FinishCell();
77cdf0e10cSrcweir 
78cdf0e10cSrcweir     void                WriteElementName(
79cdf0e10cSrcweir                             const Simstr &      i_sName,
80cdf0e10cSrcweir                             bool                i_bStrong );
81cdf0e10cSrcweir     void                WriteStr(
82cdf0e10cSrcweir                             const char *        i_sStr )
83cdf0e10cSrcweir                                                 { aFile.write( i_sStr, (int) strlen(i_sStr) ); }
84cdf0e10cSrcweir     // DATA
85cdf0e10cSrcweir     std::ofstream       aFile;
86cdf0e10cSrcweir     const XmlElement &  rDocument;
87cdf0e10cSrcweir     Simstr              sIdl_BaseDirectory;
88cdf0e10cSrcweir };
89cdf0e10cSrcweir 
90cdf0e10cSrcweir 
91cdf0e10cSrcweir 
92cdf0e10cSrcweir 
93cdf0e10cSrcweir #endif
94cdf0e10cSrcweir 
95cdf0e10cSrcweir 
96