18#if !defined(XALANUTF8WRITER_HEADER_GUARD_1357924680)
19#define XALANUTF8WRITER_HEADER_GUARD_1357924680
33 return static_cast<char>((theChar >> 18) & 0x7);
41 return static_cast<char>((theChar >> 12) & 0x3F);
49 return static_cast<char>((theChar >> 12) & 0xF);
57 return static_cast<char>((theChar >> 6) & 0x3f);
65 return static_cast<char>((theChar >> 6) & 0x1f);
73 return static_cast<char>(theChar & 0x3f);
81 return static_cast<char>(0xC0 + theBits);
89 return static_cast<char>(0xE0 + theBits);
97 return static_cast<char>(0xF0 + theBits);
105 return static_cast<char>(0x80 + theBits);
119 MemoryManager& theMemoryManager);
132 assert(m_newlineString != 0);
133 assert(
length(m_newlineString) == m_newlineStringLength);
137 m_newlineStringLength);
142 const XalanDOMChar chars[],
149 return write(chars, start,
length);
158 const XalanDOMChar* data,
161 write(data, theLength);
170 const XalanDOMChar* data,
173 write(data, theLength);
182 const XalanDOMChar* data,
185 write(data, theLength);
190 const XalanDOMChar* theChars,
205 if (theLength >
sizeof(m_buffer))
209 m_writer.write(theChars, 0, theLength);
213 if (m_bufferRemaining < theLength)
220 *m_bufferPosition = theChars[i];
225 m_bufferRemaining -= theLength;
250 assert(theChar < 128);
252 if (m_bufferRemaining == 0)
257 *m_bufferPosition = theChar;
265 const XalanDOMChar* theChars,
270 if (isUTF16HighSurrogate(theChars[i]) ==
false)
272 write(
static_cast<XalanUnicodeChar
>(theChars[i]));
274 else if (i + 1 >= theLength)
276 throwInvalidUTF16SurrogateException(
284 decodeUTF16SurrogatePair(
287 getMemoryManager()));
296 const XalanDOMChar chars[],
300 const XalanDOMChar ch = chars[start];
302 if (isUTF16HighSurrogate(ch) ==
false)
304 write(
static_cast<XalanUnicodeChar
>(ch));
306 else if (start + 1 >=
length)
308 throwInvalidUTF16SurrogateException(
316 decodeUTF16SurrogatePair(
319 getMemoryManager()));
327 const XalanDOMChar* theChars,
332 const XalanDOMChar ch = theChars[i];
334 if (isUTF16HighSurrogate(ch) ==
true)
336 if (i + 1 >= theLength)
338 throwInvalidUTF16SurrogateException(
346 decodeUTF16SurrogatePair(
349 getMemoryManager()));
356 write(
static_cast<XalanUnicodeChar
>(ch));
377 m_writer.write(m_buffer, 0, m_bufferPosition - m_buffer);
379 m_bufferPosition = m_buffer;
380 m_bufferRemaining = kBufferSize;
386 write(XalanUnicodeChar theChar)
390 write(
char(theChar));
392 else if (theChar <= 0x7FF)
394 if (m_bufferRemaining < 2)
404 m_bufferRemaining -= 2;
406 else if (theChar <= 0xFFFF)
409 assert(theChar < 0xD800 || theChar > 0xDBFF);
410 assert(theChar < 0xDC00 || theChar > 0xDFFF);
412 if (m_bufferRemaining < 3)
424 m_bufferRemaining -= 3;
426 else if (theChar <= 0x10FFFF)
428 if (m_bufferRemaining < 4)
442 m_bufferRemaining -= 4;
446 throwInvalidCharacterException(theChar, getMemoryManager());
457 value_type m_buffer[kBufferSize];
459 value_type* m_bufferPosition;
#define XALAN_CPP_NAMESPACE
Xalan-C++ namespace, including major and minor version.
const XalanDOMChar * c_str() const
void write(const XalanDOMChar *theChars, size_type theLength)
void write(const XalanDOMChar *theChars)
void safeWriteContent(const XalanDOMChar *theChars, size_type theLength)
XalanUTF8Writer(Writer &writer, MemoryManager &theMemoryManager)
size_type writeCDATAChar(const XalanDOMChar chars[], size_type start, size_type length, bool &)
void writePIChars(const XalanDOMChar *data, size_type theLength)
Writes PI characters.
void outputNewline()
Output a line break.
void writeSafe(const XalanDOMChar *theChars, size_type theLength)
void write(const value_type *theChars, size_type theLength)
size_type write(const XalanDOMChar chars[], size_type start, size_type length)
void write(const value_type *theChars)
void writeNameChar(const XalanDOMChar *data, size_type theLength)
Writes name characters.
void writeCommentChars(const XalanDOMChar *data, size_type theLength)
Writes comment characters.
void write(value_type theChar)
void write(const XalanDOMString &theChars)
virtual ~XalanUTF8Writer()
char leadingByteOf2(char theBits)
char leadingByteOf3(char theBits)
XalanDOMString::size_type length(const XalanDOMString &theString)
Get the length of a XalanDOMString.
char bits7to11(XalanUnicodeChar theChar)
char trailingByte(char theBits)
char leadingByteOf4(char theBits)
char bits13to18(XalanUnicodeChar theChar)
char bits13to16(XalanUnicodeChar theChar)
char bits1to6(XalanUnicodeChar theChar)
char bits19to21(XalanUnicodeChar theChar)
char bits7to12(XalanUnicodeChar theChar)