Xalan-C++ API Reference 1.12.0
XSLTResultTarget.hpp
Go to the documentation of this file.
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
19#if !defined(XALAN_XSLTRESULTTARGET_HEADER_GUARD)
20#define XALAN_XSLTRESULTTARGET_HEADER_GUARD
21
22// Base include file. Must be first.
23#include "XSLTDefinitions.hpp"
24
25
26
27#include <cstdio>
28#include <iosfwd>
29
30
31
33
34
35
36namespace XALAN_CPP_NAMESPACE {
37
38
39
40class FormatterListener;
41class Writer;
42
43
44
46{
47public:
48
49 typedef std::ostream StreamType;
50
51 typedef std::FILE FILE;
52
53
54 explicit
56
57 /**
58 * Create a new output target with a file name.
59 *
60 * @param fileName valid system file name
61 */
64
65 /**
66 * Create a new output target with a file name.
67 *
68 * @param fileName valid system file name
69 */
72
73 /**
74 * Create a new output target with a file name.
75 *
76 * @param fileName valid system file name
77 */
80
81 /**
82 * Create a new output target with a stream.
83 *
84 * @param byteStream a pointer to a std ostream for the output
85 */
88
89 /**
90 * Create a new output target with a stream.
91 *
92 * @param byteStream a reference to a std ostream for the output
93 */
96
97 /**
98 * Create a new output target with a character stream.
99 *
100 * @param characterStream pointer to character stream where the results
101 * will be written
102 */
105
106 /**
107 * Create a new output target with a stream.
108 *
109 * @param characterStream pointer to character stream where the results
110 * will be written
111 */
114
115 /**
116 * Create a new output target with a FormatterListener.
117 *
118 * @param flistener A FormatterListener instance for result tree events.
119 */
122
126
127 /**
128 * Set the file name where the results will be written.
129 *
130 * @param fileName system identifier as a string
131 */
132 void
134 {
135 if (fileName == 0)
136 {
137 m_fileName.clear();
138 }
139 else
140 {
141 m_fileName = fileName;
142 }
143 }
144
145 /**
146 * Set the file name where the results will be written.
147 *
148 * @param fileName system identifier as a string
149 */
150 void
152 {
153 m_fileName = fileName;
154 }
155
156 /**
157 * Get the file name where the results will be written to.
158 *
159 * @return file name string
160 */
161 const XalanDOMString&
163 {
164 return m_fileName;
165 }
166
167 /**
168 * Set the byte stream for this output target.
169 *
170 * @param byteStream pointer to byte stream that will contain the result
171 * document
172 */
173 void
175 {
176 m_byteStream = byteStream;
177 }
178
179 /**
180 * Get the byte stream for this output target.
181 *
182 * @return pointer to byte stream, or null if none was supplied.
183 */
184 StreamType*
186 {
187 return m_byteStream;
188 }
189
190 /**
191 * Set the character encoding, if known.
192 *
193 * @param encoding new encoding string
194 */
195 void
197 {
198 if (encoding == 0)
199 {
200 m_encoding.clear();
201 }
202 else
203 {
204 m_encoding = encoding;
205 }
206 }
207
208 /**
209 * Set the character encoding, if known.
210 *
211 * @param encoding new encoding string
212 */
213 void
215 {
216 m_encoding = encoding;
217 }
218
219 /**
220 * Get the character encoding in use.
221 *
222 * @return encoding string, or empty string if none was supplied.
223 */
224 const XalanDOMString&
226 {
227 return m_encoding;
228 }
229
230 /**
231 * Set the character stream for this output target.
232 *
233 * @param characterStream pointer to character stream that will contain
234 * the result document
235 */
236 void
238 {
239 m_characterStream = characterStream;
240 }
241
242 /**
243 * Get the character stream for this output target.
244 *
245 * @return pointer to character stream, or null if none was supplied.
246 */
247 Writer*
249 {
250 return m_characterStream;
251 }
252
253 /**
254 * Get the stream for this output target.
255 *
256 * @return pointer to stream, or null if none was supplied.
257 */
258 FILE*
259 getStream() const
260 {
261 return m_stream;
262 }
263
264 /**
265 * Set the stream for this output target.
266 *
267 * @theStream pointer to stream.
268 */
269 void
271 {
272 m_stream = theStream;
273 }
274
275 /**
276 * Set a FormatterListener to process the result tree events.
277 *
278 * @param handler pointer to new listener
279 */
280 void
282 {
283 m_formatterListener = handler;
284 }
285
286 /**
287 * Get the FormatterListener that will process the result tree events.
288 *
289 * @return pointer to new listener
290 */
293 {
294 return m_formatterListener;
295 }
296
297private:
298
299#if defined(XALAN_DEVELOPMENT)
302#endif
303
304 XalanDOMString m_fileName;
305
306 StreamType* m_byteStream;
307
308 XalanDOMString m_encoding;
309
310 Writer* m_characterStream;
311
312 FormatterListener* m_formatterListener;
313
314 FILE* m_stream;
315};
316
317
318
319}
320
321
322
323#endif // XALAN_XSLTRESULTTARGET_HEADER_GUARD
#define XALAN_XSLT_EXPORT
#define XALAN_DEFAULT_CONSTRUCTOR_MEMMGR
#define XALAN_CPP_NAMESPACE
Xalan-C++ namespace, including major and minor version.
A SAX-based formatter interface for the XSL processor.
void setFormatterListener(FormatterListener *handler)
Set a FormatterListener to process the result tree events.
XSLTResultTarget(MemoryManager &theManager XALAN_DEFAULT_CONSTRUCTOR_MEMMGR)
void setByteStream(StreamType *byteStream)
Set the byte stream for this output target.
XSLTResultTarget(StreamType &theStream, MemoryManager &theManager XALAN_DEFAULT_CONSTRUCTOR_MEMMGR)
Create a new output target with a stream.
XSLTResultTarget(FILE *characterStream, MemoryManager &theManager XALAN_DEFAULT_CONSTRUCTOR_MEMMGR)
Create a new output target with a stream.
FormatterListener * getFormatterListener() const
Get the FormatterListener that will process the result tree events.
StreamType * getByteStream() const
Get the byte stream for this output target.
XSLTResultTarget(const char *fileName, MemoryManager &theManager XALAN_DEFAULT_CONSTRUCTOR_MEMMGR)
Create a new output target with a file name.
void setEncoding(const XalanDOMChar *encoding)
Set the character encoding, if known.
XSLTResultTarget(const XalanDOMString &fileName, MemoryManager &theManager XALAN_DEFAULT_CONSTRUCTOR_MEMMGR)
Create a new output target with a file name.
XSLTResultTarget(const XalanDOMChar *fileName, MemoryManager &theManager XALAN_DEFAULT_CONSTRUCTOR_MEMMGR)
Create a new output target with a file name.
void setStream(FILE *theStream)
Set the stream for this output target.
XSLTResultTarget(FormatterListener &flistener, MemoryManager &theManager XALAN_DEFAULT_CONSTRUCTOR_MEMMGR)
Create a new output target with a FormatterListener.
void setEncoding(const XalanDOMString &encoding)
Set the character encoding, if known.
const XalanDOMString & getEncoding() const
Get the character encoding in use.
void setFileName(const char *fileName)
Set the file name where the results will be written.
Writer * getCharacterStream() const
Get the character stream for this output target.
FILE * getStream() const
Get the stream for this output target.
void setCharacterStream(Writer *characterStream)
Set the character stream for this output target.
const XalanDOMString & getFileName() const
Get the file name where the results will be written to.
XSLTResultTarget(StreamType *theStream, MemoryManager &theManager XALAN_DEFAULT_CONSTRUCTOR_MEMMGR)
Create a new output target with a stream.
void setFileName(const XalanDOMString &fileName)
Set the file name where the results will be written.
XSLTResultTarget(Writer *characterStream, MemoryManager &theManager XALAN_DEFAULT_CONSTRUCTOR_MEMMGR)
Create a new output target with a character stream.
XSLTResultTarget(const XSLTResultTarget &other, MemoryManager &theManager XALAN_DEFAULT_CONSTRUCTOR_MEMMGR)