Xalan-C++ API Documentation

The Xalan C++ XSLT Processor Version 1.10

XalanUTF16Writer.hpp
Go to the documentation of this file.
1 /*
2  * Copyright 1999-2004 The Apache Software Foundation.
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  * http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */
16 #if !defined(XALANUTF16WRITER_HEADER_GUARD_1357924680)
17 #define XALANUTF16WRITER_HEADER_GUARD_1357924680
18 
19 
21 
22 
23 XALAN_CPP_NAMESPACE_BEGIN
24 
25 
27 {
28 public:
29 
30  typedef XalanDOMChar value_type;
31 
32 
34  Writer& writer,
35  MemoryManager& theMemoryManager);
36 
37  virtual
39  {
40  }
41 
45  void
47  {
48  assert(m_newlineString != 0);
50 
51  write(
54  }
55 
56 
57  size_type
59  const XalanDOMChar chars[],
60  size_type start,
61  size_type /*length*/,
62  bool& /* outsideCDATA */)
63  {
64  assert( chars != 0 );
65 
66  write(chars[start]);
67 
68  return start;
69  }
70 
74  void writeNameChar(const XalanDOMChar* data,
75  size_type theLength)
76  {
77  write(data, theLength);
78  }
79 
83  void writePIChars(const XalanDOMChar* data,
84  size_type theLength)
85  {
86  write(data, theLength);
87  }
88 
92  void writeCommentChars(const XalanDOMChar* data,
93  size_type theLength)
94  {
95  write(data, theLength);
96  }
97 
98  void
100  const XalanDOMChar* theChars,
101  size_type theLength)
102  {
103  write(theChars, theLength);
104  }
105 
106  void
108  const value_type* theChars,
109  size_type theLength)
110  {
111  if (theLength > sizeof(m_buffer))
112  {
113  flushBuffer();
114 
115  m_writer.write(theChars, 0, theLength);
116  }
117  else
118  {
119  if (m_bufferRemaining < theLength)
120  {
121  flushBuffer();
122  }
123 
124  for(size_type i = 0; i < theLength; ++i)
125  {
126  *m_bufferPosition = theChars[i];
127 
128  ++m_bufferPosition;
129  }
130 
131  m_bufferRemaining -= theLength;
132  }
133 
134  }
135 
136  void
137  write(const XalanDOMString& theChars)
138  {
139  write(theChars.c_str(), theChars.length());
140  }
141 
142  void
143  write(value_type theChar)
144  {
145 
146  if (m_bufferRemaining == 0)
147  {
148  flushBuffer();
149  }
150 
151  *m_bufferPosition = theChar;
152 
153  ++m_bufferPosition;
154  --m_bufferRemaining;
155  }
156 
157 
158  size_type
160  const value_type chars[],
161  size_type start,
162  size_type /*length*/)
163  {
164  write(chars[start]);
165 
166  return start;
167  }
168 
169  void
171  const XalanDOMChar* theChars,
172  size_type theLength)
173  {
174  write(theChars, theLength);
175  }
176 
177  void
178  write(const value_type* theChars)
179  {
180  write(theChars, XalanDOMString::length(theChars));
181  }
182 
183  void
185  {
186  m_writer.write(
187  reinterpret_cast<const char*>(m_buffer),
188  0,
189  (m_bufferPosition - m_buffer) * sizeof m_buffer[0]);
190 
191 
192  m_bufferPosition = m_buffer;
193  m_bufferRemaining = kBufferSize;
194  }
195 
196 
197 private:
198 
199  enum
200  {
201  kBufferSize = 512 // The size of the buffer
202  };
203 
204 
205  // Data members...
206  value_type m_buffer[kBufferSize];
207 
208  value_type* m_bufferPosition;
209 
210  size_type m_bufferRemaining;
211 };
212 
213 
214 
215 XALAN_CPP_NAMESPACE_END
216 
217 
218 
219 #endif // XALANUTF16WRITER_HEADER_GUARD_1357924680

Interpreting class diagrams

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

dot

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

Apache Logo