You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@xalan.apache.org by db...@apache.org on 2001/08/09 22:30:27 UTC
cvs commit: xml-xalan/c/src/PlatformSupport XalanOutputStream.cpp XalanOutputStream.hpp
dbertoni 01/08/09 13:30:27
Modified: c/src/PlatformSupport XalanOutputStream.cpp
XalanOutputStream.hpp
Log:
Added option to disable throwing exceptions during transcoding.
Revision Changes Path
1.12 +17 -3 xml-xalan/c/src/PlatformSupport/XalanOutputStream.cpp
Index: XalanOutputStream.cpp
===================================================================
RCS file: /home/cvs/xml-xalan/c/src/PlatformSupport/XalanOutputStream.cpp,v
retrieving revision 1.11
retrieving revision 1.12
diff -u -r1.11 -r1.12
--- XalanOutputStream.cpp 2001/06/15 21:16:07 1.11
+++ XalanOutputStream.cpp 2001/08/09 20:30:26 1.12
@@ -70,13 +70,15 @@
XalanOutputStream::XalanOutputStream(
BufferType::size_type theBufferSize,
- TranscodeVectorType::size_type theTranscoderBlockSize) :
+ TranscodeVectorType::size_type theTranscoderBlockSize,
+ bool fThrowTranscodeException) :
m_transcoderBlockSize(theTranscoderBlockSize),
m_transcoder(0),
m_bufferSize(theBufferSize),
m_buffer(),
m_encoding(),
m_writeAsUTF16(false),
+ m_throwTranscodeException(fThrowTranscodeException),
m_transcodingBuffer()
{
if (m_bufferSize == 0)
@@ -135,7 +137,13 @@
theBufferLength,
theDestination) == false)
{
- throw TranscodingException();
+ if (m_throwTranscodeException == true)
+ {
+ throw TranscodingException();
+ }
+ else
+ {
+ }
}
}
else
@@ -186,7 +194,13 @@
if(theResult != XalanTranscodingServices::OK)
{
- throw TranscodingException();
+ if (m_throwTranscodeException == true)
+ {
+ throw TranscodingException();
+ }
+ else
+ {
+ }
}
theTotalBytesFilled += theTargetBytesEaten;
1.6 +41 -1 xml-xalan/c/src/PlatformSupport/XalanOutputStream.hpp
Index: XalanOutputStream.hpp
===================================================================
RCS file: /home/cvs/xml-xalan/c/src/PlatformSupport/XalanOutputStream.hpp,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -r1.5 -r1.6
--- XalanOutputStream.hpp 2001/06/15 21:16:07 1.5
+++ XalanOutputStream.hpp 2001/08/09 20:30:26 1.6
@@ -97,10 +97,18 @@
typedef std::vector<char> TranscodeVectorType;
#endif
+ /**
+ * Constructor.
+ *
+ * @param theBufferSize the size of the transcoding buffer
+ * @param theTranscoderBlockSize the size of the block used by the transcoder
+ * @param fThrowTranscodeException If true, an error transcoding will result in an exception being thrown.
+ */
explicit
XalanOutputStream(
BufferType::size_type theBufferSize = eDefaultBufferSize,
- TranscodeVectorType::size_type theTranscoderBlockSize = eDefaultTranscoderBlockSize);
+ TranscodeVectorType::size_type theTranscoderBlockSize = eDefaultTranscoderBlockSize,
+ bool fThrowTranscodeException = true);
virtual
~XalanOutputStream();
@@ -225,6 +233,36 @@
setOutputEncoding(const XalanDOMString& theEncoding);
/**
+ * Set the flag that indicates whether a transcoding
+ * error should throw an exception. The default is
+ * to throw an exception. If this flag is false, and
+ * and an error occurs transcoding, then data will
+ * likely be lost.
+ *
+ * @return the value of the flag.
+ */
+ bool
+ getThrowTranscodeException() const
+ {
+ return m_throwTranscodeException;
+ }
+
+ /**
+ * Set the flag that indicates whether a transcoding
+ * error should throw an exception. The default is
+ * to throw an exception. If this flag is false, and
+ * and an error occurs transcoding, then data will
+ * likely be lost.
+ *
+ * @param the new value of the flag.
+ */
+ void
+ setThrowTranscodeException(bool flag)
+ {
+ m_throwTranscodeException = flag;
+ }
+
+ /**
* Set the size of the output buffer.
*
* @param theBufferSize The buffer size.
@@ -361,6 +399,8 @@
XalanDOMString m_encoding;
bool m_writeAsUTF16;
+
+ bool m_throwTranscodeException;
TranscodeVectorType m_transcodingBuffer;
};
---------------------------------------------------------------------
To unsubscribe, e-mail: xalan-cvs-unsubscribe@xml.apache.org
For additional commands, e-mail: xalan-cvs-help@xml.apache.org