1 /*
2  * Licensed to the Apache Software Foundation (ASF) under one
3  * or more contributor license agreements. See the NOTICE file
4  * distributed with this work for additional information
5  * regarding copyright ownership. The ASF licenses this file
6  * to you under the Apache License, Version 2.0 (the  "License");
7  * you may not use this file except in compliance with the License.
8  * You may obtain a copy of the License at
9  *
10  *     http://www.apache.org/licenses/LICENSE-2.0
11  *
12  * Unless required by applicable law or agreed to in writing, software
13  * distributed under the License is distributed on an "AS IS" BASIS,
14  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15  * See the License for the specific language governing permissions and
16  * limitations under the License.
17  */
18 #if !defined(DOMSTRING_PRINTWRITER_HEADER_GUARD_1357924680)
19 #define DOMSTRING_PRINTWRITER_HEADER_GUARD_1357924680
20 
21 
22 
23 // Base include file.  Must be first.
24 #include <xalanc/PlatformSupport/PlatformSupportDefinitions.hpp>
25 
26 
27 
28 #include <xalanc/PlatformSupport/PrintWriter.hpp>
29 
30 
31 
32 #include <xalanc/XalanDOM/XalanDOMString.hpp>
33 
34 
35 
36 namespace XALAN_CPP_NAMESPACE {
37 
38 
39 
40 class XALAN_PLATFORMSUPPORT_EXPORT DOMStringPrintWriter : public PrintWriter
41 {
42 public:
43 
44     DOMStringPrintWriter(XalanDOMString&    theString);
45 
46     virtual
47     ~DOMStringPrintWriter();
48 
49     XalanDOMString&
getString() const50     getString() const
51     {
52         return *m_outputString;
53     }
54 
55     void
setString(XalanDOMString & newString)56     setString(XalanDOMString& newString)
57     {
58         m_outputString = &newString;
59     }
60 
61     // Output functions inherited from PrintWriter...
62 
63     virtual bool
64     checkError() const;
65 
66     virtual void
67     close();
68 
69     virtual void
70     flush();
71 
72     virtual void
73     write(
74             const char*     s,
75             size_t          theOffset = 0,
76             size_t          theLength = npos);
77 
78     virtual void
79     write(
80             const XalanDOMChar*         s,
81             XalanDOMString::size_type   theOffset = 0,
82             XalanDOMString::size_type   theLength = XalanDOMString::npos);
83 
84     virtual void
85     write(XalanDOMChar      c);
86 
87     virtual void
88     write(
89             const XalanDOMString&       s,
90             XalanDOMString::size_type   theOffset = 0,
91             XalanDOMString::size_type   theLength = XalanDOMString::npos);
92 
93 #if !defined(XALAN_BOOL_AS_INT)
94     virtual void
95     print(bool  b);
96 #endif
97 
98     virtual void
99     print(char  c);
100 
101     virtual void
102     print(
103             const char*     s,
104             size_t          theLength = npos);
105 
106     virtual void
107     print(
108             const XalanDOMChar*         s,
109             XalanDOMString::size_type   theLength = XalanDOMString::npos);
110 
111     virtual void
112     print(double    d);
113 
114     virtual void
115     print(XMLInt32   i);
116 
117     virtual void
118     print(XMLInt64  l);
119 
120     virtual void
121     print(const XalanDOMString&     s);
122 
123     virtual void
124     println();
125 
126 #if !defined(XALAN_BOOL_AS_INT)
127     virtual void
128     println(bool    x);
129 #endif
130 
131     virtual void
132     println(char    x);
133 
134     virtual void
135     println(
136             const char*     s,
137             size_t          theLength = npos);
138 
139     virtual void
140     println(
141             const XalanDOMChar*         s,
142             XalanDOMString::size_type   theLength = XalanDOMString::npos);
143 
144     virtual void
145     println(double  x);
146 
147     virtual void
148     println(XMLInt32     x);
149 
150     virtual void
151     println(XMLInt64    x);
152 
153     virtual void
154     println(const XalanDOMString&   s);
155 
156 protected:
157 
158     XalanDOMString*     m_outputString;
159 
160 private:
161 
162     // Not implemented
163     DOMStringPrintWriter(const DOMStringPrintWriter&);
164 
165     DOMStringPrintWriter&
166     operator=(const DOMStringPrintWriter&);
167 
168     bool
169     operator==(const DOMStringPrintWriter&);
170 };
171 
172 
173 
174 }
175 
176 
177 
178 #endif  // DOMSTRING_PRINTWRITER_HEADER_GUARD_1357924680
179