00001 /* 00002 * Copyright 1999-2004 The Apache Software Foundation. 00003 * 00004 * Licensed under the Apache License, Version 2.0 (the "License"); 00005 * you may not use this file except in compliance with the License. 00006 * You may obtain a copy of the License at 00007 * 00008 * http://www.apache.org/licenses/LICENSE-2.0 00009 * 00010 * Unless required by applicable law or agreed to in writing, software 00011 * distributed under the License is distributed on an "AS IS" BASIS, 00012 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 00013 * See the License for the specific language governing permissions and 00014 * limitations under the License. 00015 */ 00016 #if !defined(FORMATTERTOTEXT_HEADER_GUARD_1357924680) 00017 #define FORMATTERTOTEXT_HEADER_GUARD_1357924680 00018 00019 00020 00021 // Base include file. Must be first. 00022 #include <xalanc/XMLSupport/XMLSupportDefinitions.hpp> 00023 00024 00025 00026 #include <xalanc/XalanDOM/XalanDOMString.hpp> 00027 00028 00029 00030 // Base class header file. 00031 #include <xalanc/PlatformSupport/FormatterListener.hpp> 00032 00033 00034 00035 XALAN_CPP_NAMESPACE_BEGIN 00036 00037 00038 00039 class Writer; 00040 00041 00042 00047 class XALAN_XMLSUPPORT_EXPORT FormatterToText : public FormatterListener 00048 { 00049 public: 00050 00054 FormatterToText(MemoryManagerType& theManager XALAN_DEFAULT_CONSTRACTOR_MEMORY_MGR); 00055 00063 FormatterToText( 00064 Writer& writer, 00065 bool normalizeLinefeed = true, 00066 bool handleIgnorableWhitespace = true, 00067 MemoryManagerType& theManager XALAN_DEFAULT_MEMMGR); 00068 00077 FormatterToText( 00078 Writer& writer, 00079 const XalanDOMString& encoding, 00080 bool normalizeLinefeed = true, 00081 bool handleIgnorableWhitespace = true, 00082 MemoryManagerType& theManager XALAN_DEFAULT_MEMMGR); 00083 00084 static FormatterToText* 00085 create( 00086 MemoryManagerType& theManager, 00087 Writer& writer, 00088 const XalanDOMString& encoding, 00089 bool normalizeLinefeed = true, 00090 bool handleIgnorableWhitespace = true); 00091 00092 virtual 00093 ~FormatterToText(); 00094 00095 MemoryManagerType& 00096 getMemoryManager() 00097 { 00098 return m_encoding.getMemoryManager(); 00099 } 00100 00101 Writer* 00102 getWriter() const 00103 { 00104 return m_writer; 00105 } 00106 00107 void 00108 setWriter(Writer* theWriter) 00109 { 00110 m_writer = theWriter; 00111 00112 update(false); 00113 } 00114 00115 void 00116 clearEncoding(); 00117 00118 const XalanDOMString& 00119 getEncoding() const 00120 { 00121 return m_encoding; 00122 } 00123 00124 void 00125 setEncoding(const XalanDOMString& theEncoding) 00126 { 00127 m_encoding = theEncoding; 00128 00129 update(false); 00130 } 00131 00132 XalanDOMChar 00133 getMaxCharacter() const 00134 { 00135 return m_maxCharacter; 00136 } 00137 00138 void 00139 setMaxCharacter(XalanDOMChar theMaxChar) 00140 { 00141 m_maxCharacter = theMaxChar; 00142 } 00143 00144 bool 00145 getNormalizeLinefeed() const 00146 { 00147 return m_normalize; 00148 } 00149 00150 void 00151 setNormalizeLinefeed(bool fNormalize) 00152 { 00153 m_normalize = fNormalize; 00154 } 00155 00156 bool 00157 getHandleIgnorableWhitespace() const 00158 { 00159 return m_handleIgnorableWhitespace; 00160 } 00161 00162 void 00163 setHandleIgnorableWhitespace(bool fHandle) 00164 { 00165 m_handleIgnorableWhitespace = fHandle; 00166 } 00167 00168 // These methods are inherited from FormatterListener ... 00169 00170 virtual void 00171 setDocumentLocator(const LocatorType* const locator); 00172 00173 virtual void 00174 startDocument(); 00175 00176 virtual void 00177 endDocument(); 00178 00179 virtual void 00180 startElement( 00181 const XMLCh* const name, 00182 AttributeListType& attrs); 00183 00184 virtual void 00185 endElement(const XMLCh* const name); 00186 00187 virtual void 00188 characters( 00189 const XMLCh* const chars, 00190 const unsigned int length); 00191 00192 virtual void 00193 charactersRaw( 00194 const XMLCh* const chars, 00195 const unsigned int length); 00196 00197 virtual void 00198 entityReference(const XMLCh* const name); 00199 00200 virtual void 00201 ignorableWhitespace( 00202 const XMLCh* const chars, 00203 const unsigned int length); 00204 00205 virtual void 00206 processingInstruction( 00207 const XMLCh* const target, 00208 const XMLCh* const data); 00209 00210 virtual void 00211 resetDocument(); 00212 00213 virtual void 00214 comment(const XMLCh* const data); 00215 00216 virtual void 00217 cdata( 00218 const XMLCh* const ch, 00219 const unsigned int length); 00220 00221 private: 00222 00223 // These are not implemented. 00224 FormatterToText(const FormatterToText&); 00225 00226 FormatterToText& 00227 operator=(const FormatterToText&); 00228 00229 bool 00230 operator==(const FormatterToText&) const; 00231 00232 // Utility function to update various member variables 00233 // when data changes. 00234 void 00235 update(bool fNormalizationOnly); 00236 00237 // Data members... 00238 Writer* m_writer; 00239 00240 XalanDOMChar m_maxCharacter; 00241 00242 XalanDOMString m_encoding; 00243 00244 bool m_haveEncoding; 00245 00246 bool m_normalize; 00247 00248 bool m_handleIgnorableWhitespace; 00249 00250 const XalanDOMChar* m_newlineString; 00251 00252 XalanDOMString::size_type m_newlineStringLength; 00253 }; 00254 00255 00256 00257 XALAN_CPP_NAMESPACE_END 00258 00259 00260 00261 #endif // FORMATTERTOTEXT_HEADER_GUARD_1357924680
Doxygen and GraphViz are used to generate this API documentation from the Xalan-C header files.
Xalan-C++ XSLT Processor Version 1.10 |
|