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 ADC_DISPLAY_HTMLFACTORY_HXX
25 #define ADC_DISPLAY_HTMLFACTORY_HXX
26 
27 
28 
29 // USED SERVICES
30 	// BASE CLASSES
31 	// COMPONENTS
32 #include "outputstack.hxx"
33 	// PARAMETERS
34 #include <udm/xml/xmlitem.hxx>
35 #include <udm/html/htmlitem.hxx>
36 
37 namespace Xml = ::csi::xml;
38 namespace Html = ::csi::html;
39 
40 /** @resp
41     Base class for HTML page creators (factories) for code entites or
42     similar items.
43 */
44 template <class ENV>
45 class HtmlFactory
46 {
47   public:
48     // INQUIRY
Env() const49     ENV &               Env() const             { return *pEnv; }
CurOut() const50     Xml::Element &      CurOut() const          { return aDestination.Out(); }
51 
52     // ACCESS
Out() const53     OutputStack &       Out() const             { return aDestination; }
54 
55   protected:
HtmlFactory(ENV & io_rEnv,Xml::Element * o_pOut=0)56                         HtmlFactory(
57                             ENV &               io_rEnv,
58                             Xml::Element *      o_pOut = 0 )
59                             :   pEnv(&io_rEnv)  { if (o_pOut != 0) aDestination.Enter(*o_pOut); }
~HtmlFactory()60                         ~HtmlFactory() {}
61   private:
62     // DATA
63     ENV *               pEnv;
64     mutable OutputStack aDestination;
65 };
66 
67 
68 /** @resp
69     Base class for HTML paragraph creators, which are to be put into
70     a parent HTML element.
71 */
72 class HtmlMaker
73 {
74   public:
75 
76     // INQUIRY
CurOut() const77     Xml::Element &      CurOut() const          { return *pOut; }
78 
79   protected:
HtmlMaker(Xml::Element & o_rOut)80                         HtmlMaker(
81                             Xml::Element &      o_rOut )
82                             :   pOut(&o_rOut)   {}
83   private:
84     // DATA
85     Xml::Element *      pOut;
86 };
87 
88 
89 
90 
91 // IMPLEMENTATION
92 
93 
94 
95 
96 #endif
97 
98 
99