16 #if !defined(XALANUNICODESUBSETWRITER_HEADER_GUARD_1357924680)
17 #define XALANUNICODESUBSETWRITER_HEADER_GUARD_1357924680
24 XALAN_CPP_NAMESPACE_BEGIN
29 template <
class Predicate,
49 m_writer.writeNumericCharacterReference(value);
84 MemoryManager& theMemoryManager) :
89 m_bufferPosition(m_buffer),
90 m_bufferRemaining(kBufferSize),
93 m_charRefFunctor(*this),
94 m_exceptionFunctor(*this)
123 const XalanDOMChar chars[],
128 assert(chars != 0 && length > 0 && start < length);
130 const XalanDOMChar theChar = chars[start];
132 unsigned int value = theChar;
138 if (start + 1 >= length)
153 if(m_predicate(value))
155 if (outsideCDATA ==
false)
167 m_constants.s_cdataOpenString,
168 m_constants.s_cdataOpenStringLength);
172 outsideCDATA =
false;
177 if(outsideCDATA ==
false)
182 m_constants.s_cdataCloseString,
183 m_constants.s_cdataCloseStringLength);
185 writeNumericCharacterReference(value);
191 writeNumericCharacterReference(value);
204 const XalanDOMChar* data,
207 for(
size_type i = 0; i < theLength; ++i)
209 i =
write(data, i , theLength, m_exceptionFunctor);
219 const XalanDOMChar* data,
224 i =
write(data, i , theLength, m_exceptionFunctor);
235 const XalanDOMChar* data,
240 i =
write(data, i , theLength, m_exceptionFunctor);
246 const XalanDOMChar* theChars,
272 if (m_bufferRemaining == 0)
277 if(m_predicate(theChar))
279 *m_bufferPosition = theChar;
286 writeNumericCharacterReference(theChar);
292 const XalanDOMChar chars[],
297 return write(chars, start, length, m_charRefFunctor);
302 const XalanDOMChar* theChars,
307 const XalanDOMChar ch = theChars[i];
311 if (i + 1 >= theLength)
319 if(this->m_isPresentable(value))
325 this->writeNumberedEntityReference(value);
333 write((
unsigned int)ch);
355 m_bufferPosition = m_buffer;
356 m_bufferRemaining = kBufferSize;
375 template <
class TranscodingFailureFunctor>
378 const XalanDOMChar chars[],
381 TranscodingFailureFunctor& failureHandler)
383 assert(chars != 0 && length > 0);
384 assert(start <= length);
388 const XalanDOMChar ch = chars[start];
390 unsigned int value = ch;
394 if (start + 1 >= length)
409 if(m_predicate(value))
415 failureHandler(value);
428 write(
unsigned int theChar)
432 if( theChar > 0xFFFF )
434 if (m_bufferRemaining < 2)
439 *m_bufferPosition = (XalanDOMChar((theChar >> 10) + 0xD7C0));
443 *m_bufferPosition = (XalanDOMChar((theChar & 0x03FF) + 0xDC00));
447 m_bufferRemaining = m_bufferRemaining -
size_type(2);
451 if (m_bufferRemaining == 0)
456 *m_bufferPosition = XalanDOMChar(theChar);
464 writeNumericCharacterReference(
unsigned int theNumber)
476 XalanDOMChar m_buffer[kBufferSize];
478 XalanDOMChar* m_bufferPosition;
482 const Predicate m_predicate;
484 const ConstantsType m_constants;
493 XALAN_CPP_NAMESPACE_END
497 #endif // XALANUNICODESUBSETWRITER_HEADER_GUARD_1357924680