Xalan-C++ API Documentation

The Xalan C++ XSLT Processor Version 1.11


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

Interpreting class diagrams

Doxygen and GraphViz are used to generate this API documentation from the Xalan-C header files.

Xalan-C++ XSLT Processor Version 1.11
Copyright © 1999-2012 The Apache Software Foundation.
All Rights Reserved.

Apache Logo