00001 /* 00002 * Licensed to the Apache Software Foundation (ASF) under one 00003 * or more contributor license agreements. See the NOTICE file 00004 * distributed with this work for additional information 00005 * regarding copyright ownership. The ASF licenses this file 00006 * to you under the Apache License, Version 2.0 (the "License"); 00007 * you may not use this file except in compliance with the License. 00008 * You may obtain a copy of the License at 00009 * 00010 * http://www.apache.org/licenses/LICENSE-2.0 00011 * 00012 * Unless required by applicable law or agreed to in writing, software 00013 * distributed under the License is distributed on an "AS IS" BASIS, 00014 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 00015 * See the License for the specific language governing permissions and 00016 * limitations under the License. 00017 */ 00018 00019 #if !defined(XALAN_XSLTRESULTTARGET_HEADER_GUARD) 00020 #define XALAN_XSLTRESULTTARGET_HEADER_GUARD 00021 00022 // Base include file. Must be first. 00023 #include "XSLTDefinitions.hpp" 00024 00025 00026 00027 #include <cstdio> 00028 #if defined(XALAN_CLASSIC_IOSTREAMS) 00029 class ostream; 00030 #else 00031 #include <iosfwd> 00032 #endif 00033 00034 00035 00036 #include <xalanc/XalanDOM/XalanDOMString.hpp> 00037 00038 00039 00040 XALAN_CPP_NAMESPACE_BEGIN 00041 00042 00043 00044 class FormatterListener; 00045 class Writer; 00046 00047 00048 00049 class XALAN_XSLT_EXPORT XSLTResultTarget 00050 { 00051 public: 00052 00053 #if defined(XALAN_NO_STD_NAMESPACE) 00054 typedef ostream StreamType; 00055 #else 00056 typedef std::ostream StreamType; 00057 #endif 00058 00059 #if defined(XALAN_STRICT_ANSI_HEADERS) 00060 typedef std::FILE FILE; 00061 #endif 00062 00063 00064 explicit 00065 XSLTResultTarget(MemoryManager& theManager XALAN_DEFAULT_CONSTRUCTOR_MEMMGR); 00066 00067 /** 00068 * Create a new output target with a file name. 00069 * 00070 * @param fileName valid system file name 00071 */ 00072 XSLTResultTarget(const XalanDOMString& fileName, 00073 MemoryManager& theManager XALAN_DEFAULT_CONSTRUCTOR_MEMMGR); 00074 00075 /** 00076 * Create a new output target with a file name. 00077 * 00078 * @param fileName valid system file name 00079 */ 00080 XSLTResultTarget(const XalanDOMChar* fileName, 00081 MemoryManager& theManager XALAN_DEFAULT_CONSTRUCTOR_MEMMGR); 00082 00083 /** 00084 * Create a new output target with a file name. 00085 * 00086 * @param fileName valid system file name 00087 */ 00088 XSLTResultTarget(const char* fileName, 00089 MemoryManager& theManager XALAN_DEFAULT_CONSTRUCTOR_MEMMGR); 00090 00091 /** 00092 * Create a new output target with a stream. 00093 * 00094 * @param byteStream a pointer to a std ostream for the output 00095 */ 00096 XSLTResultTarget(StreamType* theStream, 00097 MemoryManager& theManager XALAN_DEFAULT_CONSTRUCTOR_MEMMGR); 00098 00099 /** 00100 * Create a new output target with a stream. 00101 * 00102 * @param byteStream a reference to a std ostream for the output 00103 */ 00104 XSLTResultTarget(StreamType& theStream, 00105 MemoryManager& theManager XALAN_DEFAULT_CONSTRUCTOR_MEMMGR); 00106 00107 /** 00108 * Create a new output target with a character stream. 00109 * 00110 * @param characterStream pointer to character stream where the results 00111 * will be written 00112 */ 00113 XSLTResultTarget(Writer* characterStream, 00114 MemoryManager& theManager XALAN_DEFAULT_CONSTRUCTOR_MEMMGR); 00115 00116 /** 00117 * Create a new output target with a stream. 00118 * 00119 * @param characterStream pointer to character stream where the results 00120 * will be written 00121 */ 00122 XSLTResultTarget(FILE* characterStream, 00123 MemoryManager& theManager XALAN_DEFAULT_CONSTRUCTOR_MEMMGR); 00124 00125 /** 00126 * Create a new output target with a FormatterListener. 00127 * 00128 * @param flistener A FormatterListener instance for result tree events. 00129 */ 00130 XSLTResultTarget(FormatterListener& flistener, 00131 MemoryManager& theManager XALAN_DEFAULT_CONSTRUCTOR_MEMMGR); 00132 00133 XSLTResultTarget(const XSLTResultTarget& other, 00134 MemoryManager& theManager XALAN_DEFAULT_CONSTRUCTOR_MEMMGR); 00135 ~XSLTResultTarget(); 00136 00137 /** 00138 * Set the file name where the results will be written. 00139 * 00140 * @param fileName system identifier as a string 00141 */ 00142 void 00143 setFileName(const char* fileName) 00144 { 00145 if (fileName == 0) 00146 { 00147 m_fileName.clear(); 00148 } 00149 else 00150 { 00151 m_fileName = fileName; 00152 } 00153 } 00154 00155 /** 00156 * Set the file name where the results will be written. 00157 * 00158 * @param fileName system identifier as a string 00159 */ 00160 void 00161 setFileName(const XalanDOMString& fileName) 00162 { 00163 m_fileName = fileName; 00164 } 00165 00166 /** 00167 * Get the file name where the results will be written to. 00168 * 00169 * @return file name string 00170 */ 00171 const XalanDOMString& 00172 getFileName() const 00173 { 00174 return m_fileName; 00175 } 00176 00177 /** 00178 * Set the byte stream for this output target. 00179 * 00180 * @param byteStream pointer to byte stream that will contain the result 00181 * document 00182 */ 00183 void 00184 setByteStream(StreamType* byteStream) 00185 { 00186 m_byteStream = byteStream; 00187 } 00188 00189 /** 00190 * Get the byte stream for this output target. 00191 * 00192 * @return pointer to byte stream, or null if none was supplied. 00193 */ 00194 StreamType* 00195 getByteStream() const 00196 { 00197 return m_byteStream; 00198 } 00199 00200 /** 00201 * Set the character encoding, if known. 00202 * 00203 * @param encoding new encoding string 00204 */ 00205 void 00206 setEncoding(const XalanDOMChar* encoding) 00207 { 00208 if (encoding == 0) 00209 { 00210 m_encoding.clear(); 00211 } 00212 else 00213 { 00214 m_encoding = encoding; 00215 } 00216 } 00217 00218 /** 00219 * Set the character encoding, if known. 00220 * 00221 * @param encoding new encoding string 00222 */ 00223 void 00224 setEncoding(const XalanDOMString& encoding) 00225 { 00226 m_encoding = encoding; 00227 } 00228 00229 /** 00230 * Get the character encoding in use. 00231 * 00232 * @return encoding string, or empty string if none was supplied. 00233 */ 00234 const XalanDOMString& 00235 getEncoding() const 00236 { 00237 return m_encoding; 00238 } 00239 00240 /** 00241 * Set the character stream for this output target. 00242 * 00243 * @param characterStream pointer to character stream that will contain 00244 * the result document 00245 */ 00246 void 00247 setCharacterStream(Writer* characterStream) 00248 { 00249 m_characterStream = characterStream; 00250 } 00251 00252 /** 00253 * Get the character stream for this output target. 00254 * 00255 * @return pointer to character stream, or null if none was supplied. 00256 */ 00257 Writer* 00258 getCharacterStream() const 00259 { 00260 return m_characterStream; 00261 } 00262 00263 /** 00264 * Get the stream for this output target. 00265 * 00266 * @return pointer to stream, or null if none was supplied. 00267 */ 00268 FILE* 00269 getStream() const 00270 { 00271 return m_stream; 00272 } 00273 00274 /** 00275 * Set the stream for this output target. 00276 * 00277 * @theStream pointer to stream. 00278 */ 00279 void 00280 setStream(FILE* theStream) 00281 { 00282 m_stream = theStream; 00283 } 00284 00285 /** 00286 * Set a FormatterListener to process the result tree events. 00287 * 00288 * @param handler pointer to new listener 00289 */ 00290 void 00291 setFormatterListener(FormatterListener* handler) 00292 { 00293 m_formatterListener = handler; 00294 } 00295 00296 /** 00297 * Get the FormatterListener that will process the result tree events. 00298 * 00299 * @return pointer to new listener 00300 */ 00301 FormatterListener* 00302 getFormatterListener() const 00303 { 00304 return m_formatterListener; 00305 } 00306 00307 private: 00308 00309 #if defined(XALAN_DEVELOPMENT) 00310 XSLTResultTarget(); 00311 XSLTResultTarget(const XSLTResultTarget&); 00312 #endif 00313 00314 XalanDOMString m_fileName; 00315 00316 StreamType* m_byteStream; 00317 00318 XalanDOMString m_encoding; 00319 00320 Writer* m_characterStream; 00321 00322 FormatterListener* m_formatterListener; 00323 00324 FILE* m_stream; 00325 }; 00326 00327 00328 00329 XALAN_CPP_NAMESPACE_END 00330 00331 00332 00333 #endif // XALAN_XSLTRESULTTARGET_HEADER_GUARD
Doxygen and GraphViz are used to generate this API documentation from the Xalan-C header files.
Xalan-C++ XSLT Processor Version 1.11 |
|