Xalan-C++ API Reference 1.12.0
FormatterToText.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#if !defined(FORMATTERTOTEXT_HEADER_GUARD_1357924680)
19#define FORMATTERTOTEXT_HEADER_GUARD_1357924680
20
21
22
23// Base include file. Must be first.
25
26
27
29
30
31
32// Base class header file.
34
35
36
37namespace XALAN_CPP_NAMESPACE {
38
39
40
41class Writer;
42
43
44
45/**
46 * This class takes SAX events (in addition to some extra events
47 * that SAX doesn't handle yet) and produces simple text only.
48 */
50{
51public:
52
53 /**
54 * FormatterToText instance constructor.
55 */
57
58 /**
59 * FormatterToText instance constructor.
60 *
61 * @param writer writer for output
62 * @param normalizeLindefeed Normalize \n or \r\n (on certain platforms).
63 * @param handleIgnorableWhitespace If true ignorableWhitespace() will write data to the Writer
64 */
67 bool normalizeLinefeed = true,
68 bool handleIgnorableWhitespace = true,
69 MemoryManager& theManager XALAN_DEFAULT_MEMMGR);
70
71 /**
72 * FormatterToText instance constructor.
73 *
74 * @param writer writer for output
75 * @param encoding character encoding for the writer
76 * @param normalizeLindefeed Normalize \n or \r\n on certain platforms.
77 * @param handleIgnorableWhitespace If true ignorableWhitespace() will write data to the Writer
78 */
82 bool normalizeLinefeed = true,
83 bool handleIgnorableWhitespace = true,
84 MemoryManager& theManager XALAN_DEFAULT_MEMMGR);
85
86 static FormatterToText*
88 MemoryManager& theManager,
91 bool normalizeLinefeed = true,
92 bool handleIgnorableWhitespace = true);
93
94 virtual
96
97 MemoryManager&
99 {
100 return m_encoding.getMemoryManager();
101 }
102
103 Writer*
104 getWriter() const
105 {
106 return m_writer;
107 }
108
109 void
111 {
112 m_writer = theWriter;
113
114 update(false);
115 }
116
117 void
119
120 const XalanDOMString&
122 {
123 return m_encoding;
124 }
125
126 void
128 {
129 m_encoding = theEncoding;
130
131 update(false);
132 }
133
136 {
137 return m_maxCharacter;
138 }
139
140 void
142 {
143 m_maxCharacter = theMaxChar;
144 }
145
146 bool
148 {
149 return m_normalize;
150 }
151
152 void
154 {
155 m_normalize = fNormalize;
156 }
157
158 bool
160 {
161 return m_handleIgnorableWhitespace;
162 }
163
164 void
166 {
167 m_handleIgnorableWhitespace = fHandle;
168 }
169
170 // These methods are inherited from FormatterListener ...
171
172 virtual void
173 setDocumentLocator(const Locator* const locator);
174
175 virtual void
177
178 virtual void
180
181 virtual void
183 const XMLCh* const name,
185
186 virtual void
187 endElement(const XMLCh* const name);
188
189 virtual void
191 const XMLCh* const chars,
192 const size_type length);
193
194 virtual void
196 const XMLCh* const chars,
197 const size_type length);
198
199 virtual void
201
202 virtual void
204 const XMLCh* const chars,
205 const size_type length);
206
207 virtual void
209 const XMLCh* const target,
210 const XMLCh* const data);
211
212 virtual void
214
215 virtual void
216 comment(const XMLCh* const data);
217
218 virtual void
220 const XMLCh* const ch,
221 const size_type length);
222
223private:
224
225 // These are not implemented.
227
229 operator=(const FormatterToText&);
230
231 bool
232 operator==(const FormatterToText&) const;
233
234 // Utility function to update various member variables
235 // when data changes.
236 void
237 update(bool fNormalizationOnly);
238
239 // Data members...
240 Writer* m_writer;
241
242 XalanDOMChar m_maxCharacter;
243
244 XalanDOMString m_encoding;
245
246 bool m_haveEncoding;
247
248 bool m_normalize;
249
250 bool m_handleIgnorableWhitespace;
251
252 const XalanDOMChar* m_newlineString;
253
254 XalanDOMString::size_type m_newlineStringLength;
255};
256
257
258
259}
260
261
262
263#endif // FORMATTERTOTEXT_HEADER_GUARD_1357924680
#define XALAN_XMLSUPPORT_EXPORT
#define XALAN_DEFAULT_CONSTRUCTOR_MEMMGR
#define XALAN_DEFAULT_MEMMGR
#define XALAN_CPP_NAMESPACE
Xalan-C++ namespace, including major and minor version.
A SAX-based formatter interface for the XSL processor.
This class takes SAX events (in addition to some extra events that SAX doesn't handle yet) and produc...
virtual void endDocument()
virtual void startDocument()
void setEncoding(const XalanDOMString &theEncoding)
const XalanDOMString & getEncoding() const
void setHandleIgnorableWhitespace(bool fHandle)
virtual void ignorableWhitespace(const XMLCh *const chars, const size_type length)
virtual void processingInstruction(const XMLCh *const target, const XMLCh *const data)
XalanDOMChar getMaxCharacter() const
virtual void characters(const XMLCh *const chars, const size_type length)
virtual void endElement(const XMLCh *const name)
void setNormalizeLinefeed(bool fNormalize)
FormatterToText(MemoryManager &theManager XALAN_DEFAULT_CONSTRUCTOR_MEMMGR)
FormatterToText instance constructor.
bool getHandleIgnorableWhitespace() const
FormatterToText(Writer &writer, bool normalizeLinefeed=true, bool handleIgnorableWhitespace=true, MemoryManager &theManager XALAN_DEFAULT_MEMMGR)
FormatterToText instance constructor.
MemoryManager & getMemoryManager()
void setWriter(Writer *theWriter)
static FormatterToText * create(MemoryManager &theManager, Writer &writer, const XalanDOMString &encoding, bool normalizeLinefeed=true, bool handleIgnorableWhitespace=true)
virtual void comment(const XMLCh *const data)
Called when a Comment is to be constructed.
virtual void charactersRaw(const XMLCh *const chars, const size_type length)
Receive notification of character data.
FormatterToText(Writer &writer, const XalanDOMString &encoding, bool normalizeLinefeed=true, bool handleIgnorableWhitespace=true, MemoryManager &theManager XALAN_DEFAULT_MEMMGR)
FormatterToText instance constructor.
virtual void entityReference(const XMLCh *const name)
Receive notification of a entityReference.
virtual void startElement(const XMLCh *const name, AttributeListType &attrs)
virtual void resetDocument()
virtual void cdata(const XMLCh *const ch, const size_type length)
Receive notification of cdata.
void setMaxCharacter(XalanDOMChar theMaxChar)
virtual void setDocumentLocator(const Locator *const locator)
xercesc::AttributeList AttributeListType
bool operator==(const XalanVector< Type > &theLHS, const XalanVector< Type > &theRHS)