18 #if !defined(XALANUNICODESUBSETWRITER_HEADER_GUARD_1357924680) 19 #define XALANUNICODESUBSETWRITER_HEADER_GUARD_1357924680 26 XALAN_CPP_NAMESPACE_BEGIN
31 template <
class Predicate,
51 m_writer.writeNumericCharacterReference(value);
71 m_writer.throwUnrepresentableCharacterException(
73 m_writer.getMemoryManager());
88 MemoryManager& theMemoryManager) :
93 m_bufferPosition(m_buffer),
94 m_bufferRemaining(kBufferSize),
97 m_charRefFunctor(*this),
98 m_exceptionFunctor(*this)
127 const XalanDOMChar chars[],
132 assert(chars != 0 && length > 0 && start < length);
134 const XalanDOMChar theChar = chars[start];
136 XalanUnicodeChar value = theChar;
142 if (start + 1 >= length)
157 if(m_predicate(value))
159 if (outsideCDATA ==
false)
171 m_constants.s_cdataOpenString,
172 m_constants.s_cdataOpenStringLength);
176 outsideCDATA =
false;
181 if(outsideCDATA ==
false)
186 m_constants.s_cdataCloseString,
187 m_constants.s_cdataCloseStringLength);
189 writeNumericCharacterReference(value);
195 writeNumericCharacterReference(value);
208 const XalanDOMChar* data,
211 for(
size_type i = 0; i < theLength; ++i)
213 i =
write(data, i , theLength, m_exceptionFunctor);
223 const XalanDOMChar* data,
228 i =
write(data, i , theLength, m_exceptionFunctor);
239 const XalanDOMChar* data,
244 i =
write(data, i , theLength, m_exceptionFunctor);
250 const XalanDOMChar* theChars,
276 if (m_bufferRemaining == 0)
281 if(m_predicate(theChar))
283 *m_bufferPosition = theChar;
290 writeNumericCharacterReference(theChar);
296 const XalanDOMChar chars[],
301 return write(chars, start, length, m_charRefFunctor);
306 const XalanDOMChar* theChars,
311 const XalanDOMChar ch = theChars[i];
315 if (i + 1 >= theLength)
323 if (this->m_isPresentable(value))
329 this->writeNumberedEntityReference(value);
337 write(static_cast<XalanUnicodeChar>(ch));
357 m_writer.write(m_buffer, 0, m_bufferPosition - m_buffer);
359 m_bufferPosition = m_buffer;
360 m_bufferRemaining = kBufferSize;
379 template <
class TranscodingFailureFunctor>
382 const XalanDOMChar chars[],
385 TranscodingFailureFunctor& failureHandler)
387 assert(chars != 0 && length > 0);
388 assert(start <= length);
392 const XalanDOMChar ch = chars[start];
394 XalanUnicodeChar value = ch;
398 if (start + 1 >= length)
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)
476 if (m_bufferRemaining < theLength)
481 XALAN_USING_STD(copy)
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;
521 XALAN_CPP_NAMESPACE_END
525 #endif // XALANUNICODESUBSETWRITER_HEADER_GUARD_1357924680 XalanOtherEncodingWriter(Writer &writer, MemoryManager &theMemoryManager)
size_type write(const XalanDOMChar chars[], size_type start, size_type length)
void write(const XalanDOMString &theChars)
virtual ~XalanOtherEncodingWriter()
void write(const XalanDOMChar *theChars)
void writeSafe(const XalanDOMChar *theChars, size_type theLength)
const XalanDOMChar * c_str() const
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.
ThrowTranscodingException(ThisType &writer)
void write(XalanDOMChar theChar)
Writes writes a UTF-16 code unit that isn't part of the surrogate pair.
void writePIChars(const XalanDOMChar *data, size_type theLength)
Writes PI characters.
XalanOtherEncodingWriter< Predicate, ConstantsType > ThisType
void writeCommentChars(const XalanDOMChar *data, size_type theLength)
Writes comment characters.
WriteCharRef(ThisType &writer)
void write(const XalanDOMChar *theChars, size_type theLength)
XalanDOMString::size_type length(const XalanDOMString &theString)
Get the length of a XalanDOMString.
void outputNewline()
Output a line break.
void operator()(XalanUnicodeChar value) const
void writeNameChar(const XalanDOMChar *data, size_type theLength)
Writes name characters.
void operator()(XalanUnicodeChar value) const