18#if !defined(XALANUNICODESUBSETWRITER_HEADER_GUARD_1357924680)
19#define XALANUNICODESUBSETWRITER_HEADER_GUARD_1357924680
31template <
class Predicate,
51 m_writer.writeNumericCharacterReference(value);
71 m_writer.throwUnrepresentableCharacterException(
93 m_bufferPosition(m_buffer),
94 m_bufferRemaining(kBufferSize),
95 m_predicate(
writer.getStream()),
97 m_charRefFunctor(*
this),
98 m_exceptionFunctor(*
this)
113 assert(m_newlineString != 0);
114 assert(
length(m_newlineString) == m_newlineStringLength);
118 m_newlineStringLength);
140 if (isUTF16HighSurrogate(
theChar) ==
true)
144 throwInvalidUTF16SurrogateException(
151 value = decodeUTF16SurrogatePair(
theChar,
chars[start+1], getMemoryManager());
157 if(m_predicate(value))
171 m_constants.s_cdataOpenString,
172 m_constants.s_cdataOpenStringLength);
186 m_constants.s_cdataCloseString,
187 m_constants.s_cdataCloseStringLength);
189 writeNumericCharacterReference(value);
195 writeNumericCharacterReference(value);
213 i = write(data,
i ,
theLength, m_exceptionFunctor);
228 i = write(data,
i ,
theLength, m_exceptionFunctor);
244 i = write(data,
i ,
theLength, m_exceptionFunctor);
273 isUTF16HighSurrogate(
theChar) ==
false &&
274 isUTF16LowSurrogate(
theChar) ==
false);
276 if (m_bufferRemaining == 0)
290 writeNumericCharacterReference(
theChar);
301 return write(
chars, start,
length, m_charRefFunctor);
313 if (isUTF16HighSurrogate(
ch) ==
true)
317 throwInvalidUTF16SurrogateException(
ch, 0, getMemoryManager());
329 this->writeNumberedEntityReference(value);
357 m_writer.write(m_buffer, 0, m_bufferPosition - m_buffer);
359 m_bufferPosition = m_buffer;
360 m_bufferRemaining = kBufferSize;
379 template <
class TranscodingFailureFunctor>
396 if (isUTF16HighSurrogate(
ch) ==
true)
398 if (start + 1 >= length)
400 throwInvalidUTF16SurrogateException(
407 value = decodeUTF16SurrogatePair(ch, chars[start+1], getMemoryManager());
413 if(m_predicate(value))
419 failureHandler(value);
432 write(XalanUnicodeChar theChar)
436 if (theChar > 0xFFFF)
438 if (m_bufferRemaining < 2)
443 *m_bufferPosition =
static_cast<XalanDOMChar
>((theChar >> 10) + 0xD7C0);
447 *m_bufferPosition =
static_cast<XalanDOMChar
>((theChar & 0x03FF) + 0xDC00);
451 m_bufferRemaining = m_bufferRemaining -
size_type(2);
455 if (m_bufferRemaining == 0)
460 *m_bufferPosition = XalanDOMChar(theChar);
468 writeNumericCharacterReference(XalanUnicodeChar theChar)
470 const XalanDOMString& theString =
471 formatNumericCharacterReference(theChar);
473 const XalanDOMString::size_type theLength =
476 if (m_bufferRemaining < theLength)
483 assert(theString.size() <= m_bufferRemaining);
491 m_bufferRemaining -= theLength;
504 XalanDOMChar m_buffer[kBufferSize];
506 XalanDOMChar* m_bufferPosition;
510 const Predicate m_predicate;
512 const ConstantsType m_constants;
514 const WriteCharRef m_charRefFunctor;
516 const ThrowTranscodingException m_exceptionFunctor;
#define XALAN_CPP_NAMESPACE
Xalan-C++ namespace, including major and minor version.
MemoryManager * getMemoryManager()
ThrowTranscodingException(ThisType &writer)
void operator()(XalanUnicodeChar value) const
void operator()(XalanUnicodeChar value) const
WriteCharRef(ThisType &writer)
void writeNameChar(const XalanDOMChar *data, size_type theLength)
Writes name characters.
virtual ~XalanOtherEncodingWriter()
void writeCommentChars(const XalanDOMChar *data, size_type theLength)
Writes comment characters.
void writePIChars(const XalanDOMChar *data, size_type theLength)
Writes PI characters.
size_type writeCDATAChar(const XalanDOMChar chars[], size_type start, size_type length, bool &outsideCDATA)
Writes CDATA chars , if not presentable, fixes it with addition CDATA sections.
size_type write(const XalanDOMChar chars[], size_type start, size_type length)
void write(const XalanDOMString &theChars)
XalanOtherEncodingWriter< Predicate, ConstantsType > ThisType
void write(const XalanDOMChar *theChars, size_type theLength)
void writeSafe(const XalanDOMChar *theChars, size_type theLength)
void write(const XalanDOMChar *theChars)
XalanOtherEncodingWriter(Writer &writer, MemoryManager &theMemoryManager)
void write(XalanDOMChar theChar)
Writes writes a UTF-16 code unit that isn't part of the surrogate pair.
void outputNewline()
Output a line break.
XalanDOMString::size_type length(const XalanDOMString &theString)
Get the length of a XalanDOMString.