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
XalanOtherEncodingWriter(Writer &writer, MemoryManager &theMemoryManager)
Definition: XalanOtherEncodingWriter.hpp:82
size_type length() const
Definition: XalanDOMString.hpp:209
size_type write(const XalanDOMChar chars[], size_type start, size_type length)
Definition: XalanOtherEncodingWriter.hpp:291
void write(const XalanDOMString &theChars)
Definition: XalanOtherEncodingWriter.hpp:256
virtual void write(const char *s, size_t theOffset=0, size_t theLength=npos)=0
Writes a string.
Definition: Writer.hpp:42
virtual ~XalanOtherEncodingWriter()
Definition: XalanOtherEncodingWriter.hpp:99
Definition: XalanOtherEncodingWriter.hpp:31
void write(const XalanDOMChar *theChars)
Definition: XalanOtherEncodingWriter.hpp:339
void writeSafe(const XalanDOMChar *theChars, size_type theLength)
Definition: XalanOtherEncodingWriter.hpp:301
friend class WriteCharRef
Definition: XalanOtherEncodingWriter.hpp:77
void flushBuffer()
Definition: XalanOtherEncodingWriter.hpp:351
void operator()(unsigned int value) const
Definition: XalanOtherEncodingWriter.hpp:67
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.
Definition: XalanOtherEncodingWriter.hpp:122
virtual void flush()=0
Flush the stream.
ThrowTranscodingException(ThisType &writer)
Definition: XalanOtherEncodingWriter.hpp:61
void write(XalanDOMChar theChar)
Writes writes a UTF-16 code unit that isn't part of the surrogate pair.
Definition: XalanOtherEncodingWriter.hpp:266
const XalanDOMChar * c_str() const
Definition: XalanDOMString.hpp:314
XalanDOMChar value_type
Definition: XalanOtherEncodingWriter.hpp:80
friend class ThrowTranscodingException
Definition: XalanOtherEncodingWriter.hpp:78
void flushWriter()
Definition: XalanOtherEncodingWriter.hpp:345
void writePIChars(const XalanDOMChar *data, size_type theLength)
Writes PI characters.
Definition: XalanOtherEncodingWriter.hpp:218
XalanOtherEncodingWriter< Predicate, ConstantsType > ThisType
Definition: XalanOtherEncodingWriter.hpp:35
void writeCommentChars(const XalanDOMChar *data, size_type theLength)
Writes comment characters.
Definition: XalanOtherEncodingWriter.hpp:234
WriteCharRef(ThisType &writer)
Definition: XalanOtherEncodingWriter.hpp:41
Definition: XalanOtherEncodingWriter.hpp:37
Definition: XalanDOMString.hpp:42
void write(const XalanDOMChar *theChars, size_type theLength)
Definition: XalanOtherEncodingWriter.hpp:245
XalanDOMString::size_type length(const XalanDOMString &theString)
Get the length of a XalanDOMString.
Definition: DOMStringHelper.hpp:277
void outputNewline()
Output a line break.
Definition: XalanOtherEncodingWriter.hpp:107
void operator()(unsigned int value) const
Definition: XalanOtherEncodingWriter.hpp:47
void writeNameChar(const XalanDOMChar *data, size_type theLength)
Writes name characters.
Definition: XalanOtherEncodingWriter.hpp:203
Definition: XalanOtherEncodingWriter.hpp:57